diff options
author | phk <phk@FreeBSD.org> | 1999-05-09 13:00:50 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-05-09 13:00:50 +0000 |
commit | e05bc3b49a62c15237c5647caa75821e3355e91d (patch) | |
tree | c5c673ce4e60f5ce4f05e870c615d1b9f1150619 | |
parent | 7d04d621267e45d230142f9f342d01744819ec08 (diff) | |
download | FreeBSD-src-e05bc3b49a62c15237c5647caa75821e3355e91d.zip FreeBSD-src-e05bc3b49a62c15237c5647caa75821e3355e91d.tar.gz |
Unconfuse DEV_MODULE() and DEV_DRIVER_MODULE() about the difference between
a major number for a dev_t.
-rw-r--r-- | sys/alpha/tlsb/zs_tlsb.c | 4 | ||||
-rw-r--r-- | sys/dev/atkbdc/psm.c | 4 | ||||
-rw-r--r-- | sys/dev/iicbus/iic.c | 4 | ||||
-rw-r--r-- | sys/dev/sio/sio.c | 4 | ||||
-rw-r--r-- | sys/dev/smbus/smb.c | 4 | ||||
-rw-r--r-- | sys/dev/usb/ugen.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/ulpt.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/ums.c | 2 | ||||
-rw-r--r-- | sys/i386/apm/apm.c | 4 | ||||
-rw-r--r-- | sys/i386/bios/apm.c | 4 | ||||
-rw-r--r-- | sys/isa/psm.c | 4 | ||||
-rw-r--r-- | sys/isa/sio.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_conf.c | 13 | ||||
-rw-r--r-- | sys/pc98/cbus/sio.c | 4 | ||||
-rw-r--r-- | sys/pc98/pc98/sio.c | 4 | ||||
-rw-r--r-- | sys/sys/bus.h | 4 | ||||
-rw-r--r-- | sys/sys/conf.h | 12 | ||||
-rw-r--r-- | sys/sys/linedisc.h | 12 |
18 files changed, 52 insertions, 39 deletions
diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index 9ea89d3..9bb40e9 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: zs_tlsb.c,v 1.9 1999/05/07 10:09:38 phk Exp $ + * $Id: zs_tlsb.c,v 1.10 1999/05/08 21:58:54 dfr Exp $ */ /* * This driver is a hopeless hack to get the SimOS console working. A real @@ -375,7 +375,7 @@ zsdevtotty(dev_t dev) } DEV_DRIVER_MODULE(zs, zsc, zs_driver, zs_devclass, - CDEV_MAJOR, NODEV, zs_cdevsw, 0, 0); + CDEV_MAJOR, NOMAJ, zs_cdevsw, 0, 0); /* * The zsc bus holds two zs devices, one for channel A, one for channel B. diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 58550b8..a520b65 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -20,7 +20,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: psm.c,v 1.7 1999/05/08 21:59:29 dfr Exp $ + * $Id: psm.c,v 1.8 1999/05/09 04:58:35 yokota Exp $ */ /* @@ -2277,6 +2277,6 @@ psmresume(void *dummy) #endif /* PSM_HOOKAPM */ DEV_DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass, - CDEV_MAJOR, NODEV, psm_cdevsw, 0, 0); + CDEV_MAJOR, NOMAJ, psm_cdevsw, 0, 0); #endif /* NPSM > 0 */ diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c index 942d1b8..f7c7d6e 100644 --- a/sys/dev/iicbus/iic.c +++ b/sys/dev/iicbus/iic.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: iic.c,v 1.8 1999/05/07 10:09:46 phk Exp $ + * $Id: iic.c,v 1.9 1999/05/08 21:59:03 dfr Exp $ * */ #include <sys/param.h> @@ -277,6 +277,6 @@ iic_drvinit(void *unused) } DEV_DRIVER_MODULE(iic, iicbus, iic_driver, iic_devclass, CDEV_MAJOR, - NODEV, iic_cdevsw, 0, 0); + NOMAJ, iic_cdevsw, 0, 0); SYSINIT(iicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,iic_drvinit,NULL) diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 0f4cc01..4c5ecf7 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.235 1999/05/09 10:28:50 phk Exp $ + * $Id: sio.c,v 1.236 1999/05/09 10:51:13 phk Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -3176,4 +3176,4 @@ siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev) #endif DEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass, - CDEV_MAJOR, NODEV, sio_cdevsw, 0, 0); + CDEV_MAJOR, NOMAJ, sio_cdevsw, 0, 0); diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c index 364661f..c812b40 100644 --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: smb.c,v 1.9 1999/05/07 10:09:50 phk Exp $ + * $Id: smb.c,v 1.10 1999/05/08 21:59:08 dfr Exp $ * */ #include <sys/param.h> @@ -269,7 +269,7 @@ smb_drvinit(void *unused) } } -DEV_DRIVER_MODULE(smb, smbus, smb_driver, smb_devclass, CDEV_MAJOR, NODEV, +DEV_DRIVER_MODULE(smb, smbus, smb_driver, smb_devclass, CDEV_MAJOR, NOMAJ, smb_cdevsw, 0, 0); SYSINIT(smbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,smb_drvinit,NULL) diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index d073769..c0fa6bb 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -998,5 +998,5 @@ ugen_detach(device_t self) } DEV_DRIVER_MODULE(ugen, uhub, ugen_driver, ugen_devclass, - UGEN_CDEV_MAJOR, NODEV, ugen_cdevsw, usbd_driver_load, 0); + UGEN_CDEV_MAJOR, NOMAJ, ugen_cdevsw, usbd_driver_load, 0); #endif diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 677ef4b..196e79e 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -443,5 +443,5 @@ ulpt_detach(device_t self) } DEV_DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, - ULPT_CDEV_MAJOR, NODEV, ulpt_cdevsw, usbd_driver_load, 0); + ULPT_CDEV_MAJOR, NOMAJ, ulpt_cdevsw, usbd_driver_load, 0); #endif diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 37888b3..6b4e1b6 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -796,5 +796,5 @@ ums_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) #if defined(__FreeBSD__) DEV_DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, - UMS_CDEV_MAJOR, NODEV, ums_cdevsw, usbd_driver_load, 0); + UMS_CDEV_MAJOR, NOMAJ, ums_cdevsw, usbd_driver_load, 0); #endif diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c index 8f5b5ad..5b3ea19 100644 --- a/sys/i386/apm/apm.c +++ b/sys/i386/apm/apm.c @@ -15,7 +15,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.83 1999/05/08 21:59:13 dfr Exp $ + * $Id: apm.c,v 1.84 1999/05/09 04:58:13 yokota Exp $ */ #include "opt_devfs.h" @@ -1065,4 +1065,4 @@ static driver_t apm_driver = { static devclass_t apm_devclass; DEV_DRIVER_MODULE(apm, nexus, apm_driver, apm_devclass, - CDEV_MAJOR, NODEV, apm_cdevsw, 0, 0); + CDEV_MAJOR, NOMAJ, apm_cdevsw, 0, 0); diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 8f5b5ad..5b3ea19 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -15,7 +15,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.83 1999/05/08 21:59:13 dfr Exp $ + * $Id: apm.c,v 1.84 1999/05/09 04:58:13 yokota Exp $ */ #include "opt_devfs.h" @@ -1065,4 +1065,4 @@ static driver_t apm_driver = { static devclass_t apm_devclass; DEV_DRIVER_MODULE(apm, nexus, apm_driver, apm_devclass, - CDEV_MAJOR, NODEV, apm_cdevsw, 0, 0); + CDEV_MAJOR, NOMAJ, apm_cdevsw, 0, 0); diff --git a/sys/isa/psm.c b/sys/isa/psm.c index 58550b8..a520b65 100644 --- a/sys/isa/psm.c +++ b/sys/isa/psm.c @@ -20,7 +20,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: psm.c,v 1.7 1999/05/08 21:59:29 dfr Exp $ + * $Id: psm.c,v 1.8 1999/05/09 04:58:35 yokota Exp $ */ /* @@ -2277,6 +2277,6 @@ psmresume(void *dummy) #endif /* PSM_HOOKAPM */ DEV_DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass, - CDEV_MAJOR, NODEV, psm_cdevsw, 0, 0); + CDEV_MAJOR, NOMAJ, psm_cdevsw, 0, 0); #endif /* NPSM > 0 */ diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 0f4cc01..4c5ecf7 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.235 1999/05/09 10:28:50 phk Exp $ + * $Id: sio.c,v 1.236 1999/05/09 10:51:13 phk Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -3176,4 +3176,4 @@ siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev) #endif DEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass, - CDEV_MAJOR, NODEV, sio_cdevsw, 0, 0); + CDEV_MAJOR, NOMAJ, sio_cdevsw, 0, 0); diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 13952c3..c20e2aa 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_conf.c,v 1.34 1999/05/09 08:10:17 peter Exp $ + * $Id: kern_conf.c,v 1.35 1999/05/09 08:18:12 phk Exp $ */ #include <sys/param.h> @@ -123,12 +123,21 @@ devsw_module_handler(module_t mod, int what, void* arg) struct devsw_module_data* data = (struct devsw_module_data*) arg; int error; + if (data->cmaj == NOMAJ) + data->cdev = NODEV; + else + data->cdev = makedev(data->cmaj, 0); switch (what) { case MOD_LOAD: error = cdevsw_add(&data->cdev, data->cdevsw, NULL); if (!error && data->cdevsw->d_strategy != nostrategy) { - if (data->bdev == NODEV) + if (data->bmaj == NOMAJ) { data->bdev = data->cdev; + data->bmaj = data->cmaj; + } else { + data->bdev = makedev(data->bmaj, 0); + } + data->cdevsw->d_maj = data->bmaj; bmaj2cmaj[major(data->bdev)] = major(data->cdev); } if (!error && data->chainevh) diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index 7622a3f..eac328f 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.91 1999/05/07 10:11:17 phk Exp $ + * $Id: sio.c,v 1.92 1999/05/09 05:00:54 kato Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -4477,7 +4477,7 @@ siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev) #endif DEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass, - CDEV_MAJOR, NODEV, sio_cdevsw, 0, 0); + CDEV_MAJOR, NOMAJ, sio_cdevsw, 0, 0); #ifdef PC98 /* diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index 7622a3f..eac328f 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.91 1999/05/07 10:11:17 phk Exp $ + * $Id: sio.c,v 1.92 1999/05/09 05:00:54 kato Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -4477,7 +4477,7 @@ siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev) #endif DEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass, - CDEV_MAJOR, NODEV, sio_cdevsw, 0, 0); + CDEV_MAJOR, NOMAJ, sio_cdevsw, 0, 0); #ifdef PC98 /* diff --git a/sys/sys/bus.h b/sys/sys/bus.h index e7063de..8446884 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bus.h,v 1.13 1999/05/08 18:07:37 peter Exp $ + * $Id: bus.h,v 1.14 1999/05/08 21:59:43 dfr Exp $ */ #ifndef _SYS_BUS_H_ @@ -283,7 +283,7 @@ DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \ cmajor, bmajor, devsw, evh, arg) \ \ static struct devsw_module_data name##_##busname##_devsw_mod = { \ - evh, arg, makedev(bmajor, 0), makedev(cmajor, 0), &devsw \ + evh, arg, bmajor, cmajor, &devsw \ }; \ \ DRIVER_MODULE(name, busname, driver, devclass, \ diff --git a/sys/sys/conf.h b/sys/sys/conf.h index cd6e0aa..c949eb8 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)conf.h 8.5 (Berkeley) 1/9/95 - * $Id: conf.h,v 1.52 1999/05/08 06:40:12 phk Exp $ + * $Id: conf.h,v 1.53 1999/05/09 08:58:44 phk Exp $ */ #ifndef _SYS_CONF_H_ @@ -228,15 +228,17 @@ struct module; struct devsw_module_data { int (*chainevh)(struct module *, int, void *); /* next handler */ void *chainarg; /* arg for next event handler */ - dev_t bdev; /* device major to use */ - dev_t cdev; /* device major to use */ + int bmaj; /* device major to use */ + int cmaj; /* device major to use */ struct cdevsw *cdevsw; /* device functions */ + /* Do not initialize fields hereafter */ + dev_t bdev; + dev_t cdev; }; #define DEV_MODULE(name, cmaj, bmaj, devsw, evh, arg) \ static struct devsw_module_data name##_devsw_mod = { \ - evh, arg, bmaj == NOMAJ ? NODEV : makedev(bmaj, 0), \ - cmaj == NOMAJ ? NODEV : makedev(cmaj, 0), &devsw \ + evh, arg, bmaj, cmaj, &devsw \ }; \ \ static moduledata_t name##_mod = { \ diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h index cd6e0aa..c949eb8 100644 --- a/sys/sys/linedisc.h +++ b/sys/sys/linedisc.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)conf.h 8.5 (Berkeley) 1/9/95 - * $Id: conf.h,v 1.52 1999/05/08 06:40:12 phk Exp $ + * $Id: conf.h,v 1.53 1999/05/09 08:58:44 phk Exp $ */ #ifndef _SYS_CONF_H_ @@ -228,15 +228,17 @@ struct module; struct devsw_module_data { int (*chainevh)(struct module *, int, void *); /* next handler */ void *chainarg; /* arg for next event handler */ - dev_t bdev; /* device major to use */ - dev_t cdev; /* device major to use */ + int bmaj; /* device major to use */ + int cmaj; /* device major to use */ struct cdevsw *cdevsw; /* device functions */ + /* Do not initialize fields hereafter */ + dev_t bdev; + dev_t cdev; }; #define DEV_MODULE(name, cmaj, bmaj, devsw, evh, arg) \ static struct devsw_module_data name##_devsw_mod = { \ - evh, arg, bmaj == NOMAJ ? NODEV : makedev(bmaj, 0), \ - cmaj == NOMAJ ? NODEV : makedev(cmaj, 0), &devsw \ + evh, arg, bmaj, cmaj, &devsw \ }; \ \ static moduledata_t name##_mod = { \ |