From: Matthew Dillon Date: Sat, 1 Aug 2009 18:26:48 +0000 (-0700) Subject: DEVFS - remove dev_ops_add(), dev_ops_get(), and get_dev() X-Git-Tag: v2.4.0~377 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/3e82b46c18bc48fdb3c1d60729c7661b3a0bf6bf DEVFS - remove dev_ops_add(), dev_ops_get(), and get_dev() --- diff --git a/sys/bus/cam/cam_xpt.c b/sys/bus/cam/cam_xpt.c index be9dcefdfd..1995cc22e3 100644 --- a/sys/bus/cam/cam_xpt.c +++ b/sys/bus/cam/cam_xpt.c @@ -953,7 +953,6 @@ dev_allocq_is_runnable(struct cam_devq *devq) static void xpt_periph_init(void) { - dev_ops_add(&xpt_ops, 0, 0); make_dev(&xpt_ops, 0, UID_ROOT, GID_OPERATOR, 0600, "xpt0"); } diff --git a/sys/bus/cam/scsi/scsi_ch.c b/sys/bus/cam/scsi/scsi_ch.c index b91ece790a..a32745e691 100644 --- a/sys/bus/cam/scsi/scsi_ch.c +++ b/sys/bus/cam/scsi/scsi_ch.c @@ -362,7 +362,6 @@ chregister(struct cam_periph *periph, void *arg) DEVSTAT_PRIORITY_OTHER); /* Register the device */ - dev_ops_add(&ch_ops, -1, periph->unit_number); make_dev(&ch_ops, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); diff --git a/sys/bus/cam/scsi/scsi_pass.c b/sys/bus/cam/scsi/scsi_pass.c index 107882bc97..23b9771832 100644 --- a/sys/bus/cam/scsi/scsi_pass.c +++ b/sys/bus/cam/scsi/scsi_pass.c @@ -283,7 +283,6 @@ passregister(struct cam_periph *periph, void *arg) DEVSTAT_PRIORITY_PASS); /* Register the device */ - dev_ops_add(&pass_ops, -1, periph->unit_number); make_dev(&pass_ops, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); diff --git a/sys/bus/cam/scsi/scsi_pt.c b/sys/bus/cam/scsi/scsi_pt.c index 4f080f6ef4..4e98e253fb 100644 --- a/sys/bus/cam/scsi/scsi_pt.c +++ b/sys/bus/cam/scsi/scsi_pt.c @@ -314,7 +314,6 @@ ptctor(struct cam_periph *periph, void *arg) SID_TYPE(&cgd->inq_data) | DEVSTAT_TYPE_IF_SCSI, DEVSTAT_PRIORITY_OTHER); - dev_ops_add(&pt_ops, -1, periph->unit_number); make_dev(&pt_ops, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); diff --git a/sys/bus/cam/scsi/scsi_sa.c b/sys/bus/cam/scsi/scsi_sa.c index 3e0f8dc34a..9fd3168b2a 100644 --- a/sys/bus/cam/scsi/scsi_sa.c +++ b/sys/bus/cam/scsi/scsi_sa.c @@ -1519,7 +1519,6 @@ saregister(struct cam_periph *periph, void *arg) DEVSTAT_BS_UNAVAILABLE, SID_TYPE(&cgd->inq_data) | DEVSTAT_TYPE_IF_SCSI, DEVSTAT_PRIORITY_TAPE); - dev_ops_add(&sa_ops, SA_UNITMASK, SA_UNIT(periph->unit_number)); make_dev(&sa_ops, SAMINOR(SA_CTLDEV, periph->unit_number, 0, SA_ATYPE_R), UID_ROOT, GID_OPERATOR, 0660, "%s%d.ctl", periph->periph_name, periph->unit_number); diff --git a/sys/bus/cam/scsi/scsi_ses.c b/sys/bus/cam/scsi/scsi_ses.c index 05ce8a3f37..2a0bdf8cf3 100644 --- a/sys/bus/cam/scsi/scsi_ses.c +++ b/sys/bus/cam/scsi/scsi_ses.c @@ -349,7 +349,6 @@ sesregister(struct cam_periph *periph, void *arg) cam_extend_set(sesperiphs, periph->unit_number, periph); cam_periph_unlock(periph); - dev_ops_add(&ses_ops, -1, periph->unit_number); make_dev(&ses_ops, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); diff --git a/sys/bus/firewire/firewirereg.h b/sys/bus/firewire/firewirereg.h index 1dececc383..9453065fef 100644 --- a/sys/bus/firewire/firewirereg.h +++ b/sys/bus/firewire/firewirereg.h @@ -300,7 +300,6 @@ struct fw_device *fw_noderesolve_nodeid (struct firewire_comm *, int); struct fw_device *fw_noderesolve_eui64 (struct firewire_comm *, struct fw_eui64 *); struct fw_bind *fw_bindlookup (struct firewire_comm *, u_int16_t, u_int32_t); void fw_drain_txq (struct firewire_comm *); -int fwdev_makedev (struct firewire_softc *); int fwdev_destroydev (struct firewire_softc *); void fwdev_clone (void *, char *, int, cdev_t *); diff --git a/sys/bus/iicbus/iic.c b/sys/bus/iicbus/iic.c index 47ef3d8085..ab69d6f064 100644 --- a/sys/bus/iicbus/iic.c +++ b/sys/bus/iicbus/iic.c @@ -123,7 +123,6 @@ iic_probe(device_t dev) static int iic_attach(device_t dev) { - dev_ops_add(&iic_ops, -1, device_get_unit(dev)); make_dev(&iic_ops, device_get_unit(dev), /* XXX cleanup */ UID_ROOT, GID_WHEEL, 0600, "iic%d", device_get_unit(dev)); diff --git a/sys/bus/isa/vga_isa.c b/sys/bus/isa/vga_isa.c index 66e9675cdd..3a1c1f0dea 100644 --- a/sys/bus/isa/vga_isa.c +++ b/sys/bus/isa/vga_isa.c @@ -153,7 +153,6 @@ isavga_attach(device_t dev) #ifdef FB_INSTALL_CDEV /* attach a virtual frame buffer device */ - dev_ops_add(&isavga_ops, VGA_MKMINOR(-1), VGA_MKMINOR(unit)); sc->devt = make_dev(&isavga_ops, VGA_MKMINOR(unit), 0, 0, 02660, "vga%x", VGA_MKMINOR(unit)); reference_dev(sc->devt); error = fb_attach(sc->devt, sc->adp); diff --git a/sys/bus/pci/pci.c b/sys/bus/pci/pci.c index 7a4257f2fc..c462a35989 100644 --- a/sys/bus/pci/pci.c +++ b/sys/bus/pci/pci.c @@ -4026,9 +4026,8 @@ pci_modevent(module_t mod, int what, void *arg) case MOD_LOAD: STAILQ_INIT(&pci_devq); pci_generation = 0; - dev_ops_add(&pcic_ops, -1, 0); pci_cdev = make_dev(&pcic_ops, 0, UID_ROOT, GID_WHEEL, 0644, - "pci%d", 0); + "pci%d", 0); pci_load_vendor_data(); break; diff --git a/sys/bus/smbus/smb.c b/sys/bus/smbus/smb.c index 681c3858ae..fb25491de5 100644 --- a/sys/bus/smbus/smb.c +++ b/sys/bus/smbus/smb.c @@ -124,10 +124,9 @@ smb_probe(device_t dev) static int smb_attach(device_t dev) { - dev_ops_add(&smb_ops, -1, device_get_unit(dev)); - make_dev(&smb_ops, device_get_unit(dev), /* XXX cleanup */ - UID_ROOT, GID_WHEEL, - 0600, "smb%d", device_get_unit(dev)); + make_dev(&smb_ops, device_get_unit(dev), + UID_ROOT, GID_WHEEL, + 0600, "smb%d", device_get_unit(dev)); return (0); } diff --git a/sys/bus/usb/usb.c b/sys/bus/usb/usb.c index 7aafa77b62..d2b736db38 100644 --- a/sys/bus/usb/usb.c +++ b/sys/bus/usb/usb.c @@ -314,16 +314,17 @@ usb_attach(device_t self) sc->sc_bus->use_polling--; usb_create_event_thread(self); - /* The per controller devices (used for usb_discover) */ - /* XXX This is redundant now, but old usbd's will want it */ - dev_ops_add(&usb_ops, -1, device_get_unit(self)); + + /* + * The per controller devices (used for usb_discover) + * XXX This is redundant now, but old usbd's will want it + */ tmp_dev = make_dev(&usb_ops, device_get_unit(self), UID_ROOT, GID_OPERATOR, 0660, "usb%d", device_get_unit(self)); sc->sc_usbdev = reference_dev(tmp_dev); if (usb_ndevs++ == 0) { /* The device spitting out events */ - dev_ops_add(&usb_ops, -1, USB_DEV_MINOR); tmp_dev = make_dev(&usb_ops, USB_DEV_MINOR, UID_ROOT, GID_OPERATOR, 0660, "usb"); usb_dev = reference_dev(tmp_dev); @@ -882,7 +883,6 @@ usb_detach(device_t self) } release_dev(sc->sc_usbdev); - dev_ops_add(&usb_ops, -1, device_get_unit(self)); if (--usb_ndevs == 0) { int i; diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c b/sys/contrib/ipfilter/netinet/mlfk_ipl.c index 289493e85e..f47d84763e 100644 --- a/sys/contrib/ipfilter/netinet/mlfk_ipl.c +++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c @@ -123,7 +123,6 @@ ipfilter_modevent(module_t mod, int type, void *unused) error = iplattach(); if (error) break; - dev_ops_add(&ipl_ops, 0, 0); c = NULL; for(i=strlen(IPL_NAME); i>0; i--) diff --git a/sys/dev/acpica5/acpi.c b/sys/dev/acpica5/acpi.c index 7910265312..cb1aa9dd00 100644 --- a/sys/dev/acpica5/acpi.c +++ b/sys/dev/acpica5/acpi.c @@ -667,7 +667,6 @@ acpi_attach(device_t dev) sc->acpi_sleep_disabled = 0; /* Create the control device */ - dev_ops_add(&acpi_ops, 0, 0); sc->acpi_dev_t = make_dev(&acpi_ops, 0, UID_ROOT, GID_WHEEL, 0644, "acpi"); sc->acpi_dev_t->si_drv1 = sc; diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index e246dc6254..7da4e4ff83 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -241,9 +241,8 @@ agp_generic_attach(device_t dev) TAILQ_INIT(&sc->as_memory); sc->as_nextid = 1; - dev_ops_add(&agp_ops, -1, device_get_unit(dev)); make_dev(&agp_ops, device_get_unit(dev), UID_ROOT, GID_WHEEL, - 0600, "agpgart"); + 0600, "agpgart"); return 0; } diff --git a/sys/dev/disk/ata/ata-all.c b/sys/dev/disk/ata/ata-all.c index fd741dc98f..925e1dceea 100644 --- a/sys/dev/disk/ata/ata-all.c +++ b/sys/dev/disk/ata/ata-all.c @@ -1595,8 +1595,7 @@ bpack(int8_t *src, int8_t *dst, int len) static void ata_init(void) { - /* register controlling device */ - dev_ops_add(&ata_ops, 0, 0); make_dev(&ata_ops, 0, UID_ROOT, GID_OPERATOR, 0600, "ata"); } + SYSINIT(atadev, SI_SUB_DRIVERS, SI_ORDER_SECOND, ata_init, NULL) diff --git a/sys/dev/disk/ata/atapi-tape.c b/sys/dev/disk/ata/atapi-tape.c index 0e290fa293..4023a678ce 100644 --- a/sys/dev/disk/ata/atapi-tape.c +++ b/sys/dev/disk/ata/atapi-tape.c @@ -124,7 +124,6 @@ astattach(struct ata_device *atadev) DEVSTAT_NO_ORDERED_TAGS, DEVSTAT_TYPE_SEQUENTIAL | DEVSTAT_TYPE_IF_IDE, DEVSTAT_PRIORITY_TAPE); - dev_ops_add(&ast_ops, dkunitmask(), dkmakeunit(stp->lun)); dev = make_dev(&ast_ops, dkmakeminor(stp->lun, 0, 0), UID_ROOT, GID_OPERATOR, 0640, "ast%d", stp->lun); dev->si_drv1 = stp; diff --git a/sys/dev/disk/fd/fd.c b/sys/dev/disk/fd/fd.c index d6af48b2ae..a22fa8a954 100644 --- a/sys/dev/disk/fd/fd.c +++ b/sys/dev/disk/fd/fd.c @@ -1022,9 +1022,6 @@ fd_attach(device_t dev) * whole-slice-part. If we did we would have to provide our * own DIOCGPART ioctl. */ - dev_ops_add(&fd_ops, - dkunitmask() | dkmakeslice(-1) | dkmakepart(128|64), - dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128)); make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 1), UID_ROOT, GID_WHEEL, 0600, "fd%d.1720", fd->fdu); make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 2), diff --git a/sys/dev/disk/isp/isp_freebsd.c b/sys/dev/disk/isp/isp_freebsd.c index b2eb054029..fd3f7dbe2e 100644 --- a/sys/dev/disk/isp/isp_freebsd.c +++ b/sys/dev/disk/isp/isp_freebsd.c @@ -192,9 +192,8 @@ isp_attach(struct ispsoftc *isp) /* * Create device nodes */ - dev_ops_add(&isp_ops, -1, device_get_unit(isp->isp_dev)); make_dev(&isp_ops, device_get_unit(isp->isp_dev), UID_ROOT, - GID_OPERATOR, 0600, "%s", device_get_nameunit(isp->isp_dev)); + GID_OPERATOR, 0600, "%s", device_get_nameunit(isp->isp_dev)); if (isp->isp_role != ISP_ROLE_NONE) { isp->isp_state = ISP_RUNSTATE; diff --git a/sys/dev/disk/nata/ata-all.c b/sys/dev/disk/nata/ata-all.c index 72629e3205..4f7b151459 100644 --- a/sys/dev/disk/nata/ata-all.c +++ b/sys/dev/disk/nata/ata-all.c @@ -1003,7 +1003,6 @@ ata_module_event_handler(module_t mod, int what, void *arg) switch (what) { case MOD_LOAD: /* register controlling device */ - dev_ops_add(&ata_ops, 0, 0); atacdev = make_dev(&ata_ops, 0, UID_ROOT, GID_OPERATOR, 0600, "ata"); reference_dev(atacdev); return 0; diff --git a/sys/dev/disk/nata/atapi-cd.c b/sys/dev/disk/nata/atapi-cd.c index 6becb234a0..23d662eecb 100644 --- a/sys/dev/disk/nata/atapi-cd.c +++ b/sys/dev/disk/nata/atapi-cd.c @@ -144,7 +144,6 @@ acd_attach(device_t dev) cdev = disk_create(device_get_unit(dev), &cdp->disk, &acd_ops); #if 0 - dev_ops_add(&acd_ops, dkunitmask(), dkmakeunit(device_get_unit(dev))); cdev = make_dev(&acd_ops, dkmakeminor(device_get_unit(dev), 0, 0), UID_ROOT, GID_OPERATOR, 0644, "acd%d", device_get_unit(dev)); diff --git a/sys/dev/disk/nata/atapi-tape.c b/sys/dev/disk/nata/atapi-tape.c index f625a217c4..c1842e03b7 100644 --- a/sys/dev/disk/nata/atapi-tape.c +++ b/sys/dev/disk/nata/atapi-tape.c @@ -135,7 +135,6 @@ ast_attach(device_t dev) DEVSTAT_NO_ORDERED_TAGS, DEVSTAT_TYPE_SEQUENTIAL | DEVSTAT_TYPE_IF_IDE, DEVSTAT_PRIORITY_TAPE); - dev_ops_add(&ast_ops, dkunitmask(), dkmakeunit(device_get_unit(dev))); cdev = make_dev(&ast_ops, 2 * device_get_unit(dev), UID_ROOT, GID_OPERATOR, 0640, "ast%d", device_get_unit(dev)); reference_dev(cdev); diff --git a/sys/dev/disk/wt/wt.c b/sys/dev/disk/wt/wt.c index e9ed822466..b989599e21 100644 --- a/sys/dev/disk/wt/wt.c +++ b/sys/dev/disk/wt/wt.c @@ -260,7 +260,6 @@ wtattach (struct isa_device *id) t->dens = -1; /* unknown density */ isa_dmainit(t->chan, 1024); - dev_ops_add(&wt_ops, -1, id->id_unit); make_dev(&wt_ops, id->id_unit, 0, 0, 0600, "rwt%d", id->id_unit); return (1); } diff --git a/sys/dev/drm/drm_drv.c b/sys/dev/drm/drm_drv.c index f4c2cf018a..fa2166bab7 100644 --- a/sys/dev/drm/drm_drv.c +++ b/sys/dev/drm/drm_drv.c @@ -194,13 +194,8 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist) else dev->device = kdev; - dev_ops_add(&drm_cdevsw, -1, unit); - dev->devnode = make_dev(&drm_cdevsw, - unit, - DRM_DEV_UID, - DRM_DEV_GID, - DRM_DEV_MODE, - "dri/card%d", unit); + dev->devnode = make_dev(&drm_cdevsw, unit, DRM_DEV_UID, DRM_DEV_GID, + DRM_DEV_MODE, "dri/card%d", unit); dev->pci_domain = 0; dev->pci_bus = pci_get_bus(dev->device); diff --git a/sys/dev/misc/cmx/cmx.c b/sys/dev/misc/cmx/cmx.c index 1969db13e4..7aa26d59c2 100644 --- a/sys/dev/misc/cmx/cmx.c +++ b/sys/dev/misc/cmx/cmx.c @@ -246,7 +246,6 @@ cmx_attach(device_t dev) if (!sc || sc->dying) return ENXIO; - dev_ops_add(&cmx_ops, -1, device_get_unit(dev)); sc->cdev = make_dev(&cmx_ops, 0, UID_ROOT, GID_WHEEL, 0600, "cmx%d", device_get_unit(dev)); if (!sc->cdev) { diff --git a/sys/dev/misc/dcons/dcons_os.c b/sys/dev/misc/dcons/dcons_os.c index 4232d3d563..f684a71b46 100644 --- a/sys/dev/misc/dcons/dcons_os.c +++ b/sys/dev/misc/dcons/dcons_os.c @@ -567,9 +567,6 @@ dcons_attach(void) { int polltime; -#ifdef __DragonFly__ - dev_ops_add(&dcons_ops, -1, 0); -#endif dcons_attach_port(DCONS_CON, "dcons", 0); dcons_attach_port(DCONS_GDB, "dgdb", DC_GDB); #if __FreeBSD_version < 500000 diff --git a/sys/dev/misc/gpib/gpib.c b/sys/dev/misc/gpib/gpib.c index ba8e77c3de..b3149f7dba 100644 --- a/sys/dev/misc/gpib/gpib.c +++ b/sys/dev/misc/gpib/gpib.c @@ -126,7 +126,6 @@ gpattach(struct isa_device *isdp) kprintf ("gp%d: type AT-GPIB chip NAT4882A\n",sc->sc_unit); sc->sc_flags |=ATTACHED; - dev_ops_add(&gp_ops, -1, sc->sc_unit); make_dev(&gp_ops, sc->sc_unit, 0, 0, 0600, "gp"); return (1); } diff --git a/sys/dev/misc/joy/joy.c b/sys/dev/misc/joy/joy.c index ab0949daf7..4ab4e4246a 100644 --- a/sys/dev/misc/joy/joy.c +++ b/sys/dev/misc/joy/joy.c @@ -132,7 +132,6 @@ joy_attach (device_t dev) joy->bt = rman_get_bustag(res); joy->port = rman_get_bushandle(res); joy->timeout[0] = joy->timeout[1] = 0; - dev_ops_add(&joy_ops, -1, unit); make_dev(&joy_ops, unit, 0, 0, 0600, "joy%d", unit); return 0; } diff --git a/sys/dev/misc/kbd/kbd.c b/sys/dev/misc/kbd/kbd.c index dd1f18345f..a64bfceeda 100644 --- a/sys/dev/misc/kbd/kbd.c +++ b/sys/dev/misc/kbd/kbd.c @@ -466,7 +466,6 @@ kbd_attach(keyboard_t *kbd) if (keyboard[kbd->kb_index] != kbd) return EINVAL; - dev_ops_add(&kbd_ops, -1, kbd->kb_index); dev = make_dev(&kbd_ops, kbd->kb_index, UID_ROOT, GID_WHEEL, 0600, "kbd%r", kbd->kb_index); if (dev->si_drv1 == NULL) diff --git a/sys/dev/misc/labpc/labpc.c b/sys/dev/misc/labpc/labpc.c index 070e49ef8a..b27247f462 100644 --- a/sys/dev/misc/labpc/labpc.c +++ b/sys/dev/misc/labpc/labpc.c @@ -475,9 +475,8 @@ labpcattach(struct isa_device *dev) ctlr->dcr_is = 0x80; loutb(DCR(ctlr), ctlr->dcr_val); - dev_ops_add(&labpc_ops, -1, dev->id_unit); make_dev(&labpc_ops, dev->id_unit, 0, 0, 0600, - "labpc%d", dev->id_unit); + "labpc%d", dev->id_unit); return 1; } diff --git a/sys/dev/misc/lpt/lpt.c b/sys/dev/misc/lpt/lpt.c index f07954353b..0ef454ec0b 100644 --- a/sys/dev/misc/lpt/lpt.c +++ b/sys/dev/misc/lpt/lpt.c @@ -399,11 +399,10 @@ lpt_attach(device_t dev) lpt_release_ppbus(dev); - dev_ops_add(&lpt_ops, LP_UNITMASK, unit); - make_dev(&lpt_ops, unit, - UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d", unit); - make_dev(&lpt_ops, unit | LP_BYPASS, - UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d.ctl", unit); + make_dev(&lpt_ops, unit, UID_ROOT, GID_WHEEL, + 0600, LPT_NAME "%d", unit); + make_dev(&lpt_ops, unit | LP_BYPASS, UID_ROOT, GID_WHEEL, + 0600, LPT_NAME "%d.ctl", unit); return (0); } diff --git a/sys/dev/misc/mse/mse.c b/sys/dev/misc/mse/mse.c index 6fcab81d07..a5b3556c6f 100644 --- a/sys/dev/misc/mse/mse.c +++ b/sys/dev/misc/mse/mse.c @@ -347,7 +347,6 @@ mse_attach(device_t dev) sc->mode.accelfactor = (flags & MSE_CONFIG_ACCEL) >> 4; callout_init(&sc->sc_callout); - dev_ops_add(&mse_ops, ~1, unit << 1); make_dev(&mse_ops, unit << 1, 0, 0, 0600, "mse%d", unit); make_dev(&mse_ops, (unit<<1)+1, 0, 0, 0600, "nmse%d", unit); diff --git a/sys/dev/misc/nmdm/nmdm.c b/sys/dev/misc/nmdm/nmdm.c index fd151dad5f..40757a3c2f 100644 --- a/sys/dev/misc/nmdm/nmdm.c +++ b/sys/dev/misc/nmdm/nmdm.c @@ -131,11 +131,10 @@ nmdminit(int n) return; pt = kmalloc(sizeof(*pt), M_NLMDM, M_WAITOK | M_ZERO); - dev_ops_add(&nmdm_ops, ~1, n << 1); pt->part1.dev = dev1 = make_dev(&nmdm_ops, n << 1, - 0, 0, 0666, "nmdm%dA", n); + 0, 0, 0666, "nmdm%dA", n); pt->part2.dev = dev2 = make_dev(&nmdm_ops, (n << 1) + 1, - 0, 0, 0666, "nmdm%dB", n); + 0, 0, 0666, "nmdm%dB", n); dev1->si_drv1 = dev2->si_drv1 = pt; dev1->si_tty = &pt->part1.nm_tty; diff --git a/sys/dev/misc/pcfclock/pcfclock.c b/sys/dev/misc/pcfclock/pcfclock.c index 6549a5ff7c..190658aab6 100644 --- a/sys/dev/misc/pcfclock/pcfclock.c +++ b/sys/dev/misc/pcfclock/pcfclock.c @@ -132,9 +132,8 @@ pcfclock_attach(device_t dev) unit = device_get_unit(dev); - dev_ops_add(&pcfclock_ops, -1, unit); make_dev(&pcfclock_ops, unit, - UID_ROOT, GID_WHEEL, 0444, PCFCLOCK_NAME "%d", unit); + UID_ROOT, GID_WHEEL, 0444, PCFCLOCK_NAME "%d", unit); return (0); } diff --git a/sys/dev/misc/ppi/ppi.c b/sys/dev/misc/ppi/ppi.c index 192e4158f9..c607f2cc8f 100644 --- a/sys/dev/misc/ppi/ppi.c +++ b/sys/dev/misc/ppi/ppi.c @@ -163,7 +163,6 @@ ppi_attach(device_t dev) &zero, irq, irq, 1, RF_ACTIVE); #endif /* PERIPH_1284 */ - dev_ops_add(&ppi_ops, -1, device_get_unit(dev)); make_dev(&ppi_ops, device_get_unit(dev), /* XXX cleanup */ UID_ROOT, GID_WHEEL, 0600, "ppi%d", device_get_unit(dev)); diff --git a/sys/dev/misc/pps/pps.c b/sys/dev/misc/pps/pps.c index 86484dc9c3..190e60daa2 100644 --- a/sys/dev/misc/pps/pps.c +++ b/sys/dev/misc/pps/pps.c @@ -104,9 +104,8 @@ ppsattach(device_t ppsdev) return (ENXIO); unit = device_get_unit(ppsdev); - dev_ops_add(&pps_ops, -1, unit); - make_dev(&pps_ops, unit, UID_ROOT, GID_WHEEL, 0644, - PPS_NAME "%d", unit); + make_dev(&pps_ops, unit, UID_ROOT, GID_WHEEL, + 0644, PPS_NAME "%d", unit); return (0); } diff --git a/sys/dev/misc/psm/psm.c b/sys/dev/misc/psm/psm.c index 66e58679d2..ed7e9568b6 100644 --- a/sys/dev/misc/psm/psm.c +++ b/sys/dev/misc/psm/psm.c @@ -1240,7 +1240,6 @@ psmattach(device_t dev) } /* Done */ - dev_ops_add(&psm_ops, PSM_MKMINOR(-1, 0), PSM_MKMINOR(unit, 0)); make_dev(&psm_ops, PSM_MKMINOR(unit, FALSE), 0, 0, 0666, "psm%d", unit); make_dev(&psm_ops, PSM_MKMINOR(unit, TRUE), 0, 0, 0666, "bpsm%d", unit); diff --git a/sys/dev/misc/spic/spic.c b/sys/dev/misc/spic/spic.c index fe656a59fd..83eedb5c1b 100644 --- a/sys/dev/misc/spic/spic.c +++ b/sys/dev/misc/spic/spic.c @@ -347,7 +347,6 @@ spic_attach(device_t dev) spic_call1(sc, 0x92); /* There can be only one */ - dev_ops_add(&spic_ops, -1, device_get_unit(dev)); make_dev(&spic_ops, device_get_unit(dev), 0, 0, 0600, "jogdial"); return 0; diff --git a/sys/dev/misc/spigot/spigot.c b/sys/dev/misc/spigot/spigot.c index 8054827ca0..6fd953afbb 100644 --- a/sys/dev/misc/spigot/spigot.c +++ b/sys/dev/misc/spigot/spigot.c @@ -140,7 +140,6 @@ spigot_attach(struct isa_device *devp) devp->id_intr = (inthand2_t *)spigintr; ss->maddr = kvtop(devp->id_maddr); ss->irq = devp->id_irq; - dev_ops_add(&spigot_ops, -1, unit); make_dev(&spigot_ops, unit, 0, 0, 0644, "spigot%d", unit); return 1; } diff --git a/sys/dev/misc/syscons/syscons.c b/sys/dev/misc/syscons/syscons.c index e1997664c7..3d056d2206 100644 --- a/sys/dev/misc/syscons/syscons.c +++ b/sys/dev/misc/syscons/syscons.c @@ -390,23 +390,18 @@ sc_attach_unit(int unit, int flags) (void *)(uintptr_t)unit, SHUTDOWN_PRI_DEFAULT); /* - * create devices. dev_ops_add() must be called to make devices under - * this major number available to userland. + * create devices. + * + * The first vty already has struct tty and scr_stat initialized + * in scinit(). The other vtys will have these structs when + * first opened. */ - dev_ops_add(&sc_ops, ~(MAXCONS - 1), unit * MAXCONS); - - for (vc = 1; vc < sc->vtys; vc++) { //XXX: possibly breaks something, or even a lot + for (vc = 1; vc < sc->vtys; vc++) { dev = make_dev(&sc_ops, vc + unit * MAXCONS, - UID_ROOT, GID_WHEEL, 0600, "ttyv%r", vc + unit * MAXCONS); + UID_ROOT, GID_WHEEL, + 0600, "ttyv%r", vc + unit * MAXCONS); sc->dev[vc] = dev; - /* - * The first vty already has struct tty and scr_stat initialized - * in scinit(). The other vtys will have these structs when - * first opened. - */ } - - dev_ops_add(&sc_ops, -1, SC_CONSOLECTL); /* XXX */ cctl_dev = make_dev(&sc_ops, SC_CONSOLECTL, UID_ROOT, GID_WHEEL, 0600, "consolectl"); cctl_dev->si_tty = sc_console_tty = ttymalloc(sc_console_tty); diff --git a/sys/dev/misc/syscons/sysmouse.c b/sys/dev/misc/syscons/sysmouse.c index 64e2f12e39..ba3ea516c7 100644 --- a/sys/dev/misc/syscons/sysmouse.c +++ b/sys/dev/misc/syscons/sysmouse.c @@ -252,9 +252,8 @@ sm_attach_mouse(void *unused) { cdev_t dev; - dev_ops_add(&sm_ops, -1, SC_MOUSE); - dev = make_dev(&sm_ops, SC_MOUSE, UID_ROOT, GID_WHEEL, 0600, - "sysmouse"); + dev = make_dev(&sm_ops, SC_MOUSE, UID_ROOT, GID_WHEEL, + 0600, "sysmouse"); /* sysmouse doesn't have scr_stat */ } diff --git a/sys/dev/misc/tw/tw.c b/sys/dev/misc/tw/tw.c index 516ea5f0aa..587280c7ff 100644 --- a/sys/dev/misc/tw/tw.c +++ b/sys/dev/misc/tw/tw.c @@ -397,7 +397,6 @@ twattach(struct isa_device *idp) sc->sc_state = 0; sc->sc_rcount = 0; callout_init(&sc->abortrcv_ch); - dev_ops_add(&tw_ops, -1, unit); make_dev(&tw_ops, unit, 0, 0, 0600, "tw%d", unit); return (1); } diff --git a/sys/dev/raid/aac/aac.c b/sys/dev/raid/aac/aac.c index 5c8114949e..a03e9453ed 100644 --- a/sys/dev/raid/aac/aac.c +++ b/sys/dev/raid/aac/aac.c @@ -351,9 +351,8 @@ aac_attach(struct aac_softc *sc) * Make the control device. */ unit = device_get_unit(sc->aac_dev); - dev_ops_add(&aac_ops, -1, unit); - sc->aac_dev_t = make_dev(&aac_ops, unit, UID_ROOT, GID_OPERATOR, 0640, - "aac%d", unit); + sc->aac_dev_t = make_dev(&aac_ops, unit, UID_ROOT, GID_OPERATOR, + 0640, "aac%d", unit); sc->aac_dev_t->si_drv1 = sc; reference_dev(sc->aac_dev_t); diff --git a/sys/dev/raid/amr/amr.c b/sys/dev/raid/amr/amr.c index 7d33a653f6..5abffca837 100644 --- a/sys/dev/raid/amr/amr.c +++ b/sys/dev/raid/amr/amr.c @@ -236,7 +236,6 @@ amr_attach(struct amr_softc *sc) /* * Create the control device. */ - dev_ops_add(&amr_ops, -1, device_get_unit(sc->amr_dev)); sc->amr_dev_t = make_dev(&amr_ops, device_get_unit(sc->amr_dev), UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, "amr%d", device_get_unit(sc->amr_dev)); diff --git a/sys/dev/raid/asr/asr.c b/sys/dev/raid/asr/asr.c index f17dc9210c..25ba50b339 100644 --- a/sys/dev/raid/asr/asr.c +++ b/sys/dev/raid/asr/asr.c @@ -473,28 +473,6 @@ STATIC struct dev_ops asr_ops = { .d_ioctl = asr_ioctl, }; -/* - * Initialize the dynamic dev_ops hooks. - */ -STATIC void -asr_drvinit (void * unused) -{ - static int asr_devsw_installed = 0; - - if (asr_devsw_installed) { - return; - } - asr_devsw_installed++; - - /* - * Adding the ops will dynamically assign a major number. - */ - dev_ops_add(&asr_ops, 0, 0); -} /* asr_drvinit */ - -/* XXX Must initialize before CAM layer picks up our HBA driver */ -SYSINIT(asrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE,asr_drvinit,NULL) - /* I2O support routines */ #define defAlignLong(STRUCT,NAME) char NAME[sizeof(STRUCT)] #define getAlignLong(STRUCT,NAME) ((STRUCT *)(NAME)) diff --git a/sys/dev/raid/ciss/ciss.c b/sys/dev/raid/ciss/ciss.c index 70bcadcf46..5250dd678d 100644 --- a/sys/dev/raid/ciss/ciss.c +++ b/sys/dev/raid/ciss/ciss.c @@ -456,10 +456,9 @@ ciss_attach(device_t dev) */ ciss_periodic(sc); - /* + /* * Create the control device. */ - dev_ops_add(&ciss_ops, -1, device_get_unit(sc->ciss_dev)); sc->ciss_dev_t = make_dev(&ciss_ops, device_get_unit(sc->ciss_dev), UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, "ciss%d", device_get_unit(sc->ciss_dev)); diff --git a/sys/dev/raid/iir/iir_ctrl.c b/sys/dev/raid/iir/iir_ctrl.c index 269ab81bea..2d06e715b6 100644 --- a/sys/dev/raid/iir/iir_ctrl.c +++ b/sys/dev/raid/iir/iir_ctrl.c @@ -81,7 +81,6 @@ static struct dev_ops iir_ops = { .d_ioctl = iir_ioctl, }; -static int iir_devsw_installed = 0; #ifndef SDEV_PER_HBA static int sdev_made = 0; #endif @@ -366,16 +365,3 @@ iir_ioctl(struct dev_ioctl_args *ap) return (0); } -static void -iir_drvinit(void *unused) -{ - GDT_DPRINTF(GDT_D_DEBUG, ("iir_drvinit()\n")); - - if (!iir_devsw_installed) { - /* Add the I/O (data) channel */ - dev_ops_add(&iir_ops, 0, 0); - iir_devsw_installed = 1; - } -} - -SYSINIT(iir_dev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE + CDEV_MAJOR, iir_drvinit, NULL) diff --git a/sys/dev/raid/ips/ips.c b/sys/dev/raid/ips/ips.c index 00afa1f70d..31657f3f30 100644 --- a/sys/dev/raid/ips/ips.c +++ b/sys/dev/raid/ips/ips.c @@ -450,10 +450,9 @@ ips_adapter_init(ips_softc_t *sc) "failed to initialize command buffers\n"); goto error; } - dev_ops_add(&ips_ops, -1, device_get_unit(sc->dev)); dev = make_dev(&ips_ops, device_get_unit(sc->dev), - UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, - "ips%d", device_get_unit(sc->dev)); + UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, + "ips%d", device_get_unit(sc->dev)); dev->si_drv1 = sc; ips_diskdev_init(sc); callout_reset(&sc->timer, 10 * hz, ips_timeout, sc); diff --git a/sys/dev/raid/mlx/mlx.c b/sys/dev/raid/mlx/mlx.c index b5d43b8007..093f477f78 100644 --- a/sys/dev/raid/mlx/mlx.c +++ b/sys/dev/raid/mlx/mlx.c @@ -468,10 +468,9 @@ mlx_attach(struct mlx_softc *sc) /* * Create the control device. */ - dev_ops_add(&mlx_ops, -1, device_get_unit(sc->mlx_dev)); make_dev(&mlx_ops, device_get_unit(sc->mlx_dev), - UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, - "mlx%d", device_get_unit(sc->mlx_dev)); + UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, + "mlx%d", device_get_unit(sc->mlx_dev)); /* * Start the timeout routine. diff --git a/sys/dev/raid/mly/mly.c b/sys/dev/raid/mly/mly.c index 2cb1c07eb5..5883830cff 100644 --- a/sys/dev/raid/mly/mly.c +++ b/sys/dev/raid/mly/mly.c @@ -310,10 +310,9 @@ mly_attach(device_t dev) /* * Create the control device. */ - dev_ops_add(&mly_ops, -1, device_get_unit(sc->mly_dev)); sc->mly_dev_t = make_dev(&mly_ops, device_get_unit(sc->mly_dev), - UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, - "mly%d", device_get_unit(sc->mly_dev)); + UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, + "mly%d", device_get_unit(sc->mly_dev)); sc->mly_dev_t->si_drv1 = sc; /* enable interrupts now */ diff --git a/sys/dev/raid/twa/twa_freebsd.c b/sys/dev/raid/twa/twa_freebsd.c index 98bd59b56d..e705bf9306 100644 --- a/sys/dev/raid/twa/twa_freebsd.c +++ b/sys/dev/raid/twa/twa_freebsd.c @@ -290,7 +290,6 @@ twa_attach(device_t dev) twa_describe_controller(sc); /* Create the control device. */ - dev_ops_add(&twa_ops, -1, device_get_unit(sc->twa_bus_dev)); xdev = make_dev(&twa_ops, device_get_unit(sc->twa_bus_dev), UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, "twa%d", device_get_unit(sc->twa_bus_dev)); diff --git a/sys/dev/raid/twe/twe_freebsd.c b/sys/dev/raid/twe/twe_freebsd.c index 1b9d528637..ff05f42357 100644 --- a/sys/dev/raid/twe/twe_freebsd.c +++ b/sys/dev/raid/twe/twe_freebsd.c @@ -301,16 +301,17 @@ twe_attach(device_t dev) /* * Create the control device. */ - dev_ops_add(&twe_ops, -1, device_get_unit(sc->twe_dev)); sc->twe_dev_t = make_dev(&twe_ops, device_get_unit(sc->twe_dev), - UID_ROOT, GID_OPERATOR, S_IRUSR | S_IWUSR, "twe%d", - device_get_unit(sc->twe_dev)); + UID_ROOT, GID_OPERATOR, + S_IRUSR | S_IWUSR, "twe%d", + device_get_unit(sc->twe_dev)); sc->twe_dev_t->si_drv1 = sc; + /* - * Schedule ourselves to bring the controller up once interrupts are available. - * This isn't strictly necessary, since we disable interrupts while probing the - * controller, but it is more in keeping with common practice for other disk - * devices. + * Schedule ourselves to bring the controller up once interrupts are + * available. This isn't strictly necessary, since we disable + * interrupts while probing the controller, but it is more in keeping + * with common practice for other disk devices. */ sc->twe_ich.ich_func = twe_intrhook; sc->twe_ich.ich_arg = sc; diff --git a/sys/dev/raid/vinum/vinum.c b/sys/dev/raid/vinum/vinum.c index 5d83821dc9..3c85619f38 100644 --- a/sys/dev/raid/vinum/vinum.c +++ b/sys/dev/raid/vinum/vinum.c @@ -97,7 +97,9 @@ vinumattach(void *dummy) daemonq = NULL; /* initialize daemon's work queue */ dqend = NULL; - dev_ops_add(&vinum_ops, 0, 0); /* add the ops entry */ +#if 0 + dev_ops_add(&vinum_ops, 0, 0); +#endif vinum_conf.physbufs = nswbuf / 2 + 1; /* maximum amount of physical bufs */ diff --git a/sys/dev/serial/cy/cy.c b/sys/dev/serial/cy/cy.c index 403b7deae2..66a8774610 100644 --- a/sys/dev/serial/cy/cy.c +++ b/sys/dev/serial/cy/cy.c @@ -613,7 +613,6 @@ cyattach_common(cy_addr cy_iobase, int cy_align) sio_registered = TRUE; } minorbase = UNIT_TO_MINOR(unit); - dev_ops_add(&sio_ops, UNIT_TO_MINOR(-1), minorbase); make_dev(&sio_ops, minorbase, UID_ROOT, GID_WHEEL, 0600, "ttyc%r%r", adapter, unit % CY_MAX_PORTS); diff --git a/sys/dev/serial/dgb/dgm.c b/sys/dev/serial/dgb/dgm.c index afd11c8cc2..73868320be 100644 --- a/sys/dev/serial/dgb/dgm.c +++ b/sys/dev/serial/dgb/dgm.c @@ -784,7 +784,6 @@ dgmattach(device_t dev) else shrinkmem = 0; - dev_ops_add(&dgm_ops, DGM_UNITMASK, DGM_UNIT(sc->unit)); for (i = 0; i < sc->numports; i++, bc++) { DPRINT3(DB_INFO, "dgm%d: Set up port %d\n", sc->unit, i); port = &sc->ports[i]; diff --git a/sys/dev/serial/rc/rc.c b/sys/dev/serial/rc/rc.c index 6465c56bf6..bcc2bddbde 100644 --- a/sys/dev/serial/rc/rc.c +++ b/sys/dev/serial/rc/rc.c @@ -260,7 +260,6 @@ rcattach(struct isa_device *dvp) } rcb->rcb_probed = RC_ATTACHED; if (!rc_started) { - dev_ops_add(&rc_ops, -1, rcb->rcb_unit); register_swi(SWI_TTY, rcpoll, NULL, "rcpoll", NULL); callout_init(&rc_wakeup_ch); rc_wakeup(NULL); diff --git a/sys/dev/serial/rp/rp.c b/sys/dev/serial/rp/rp.c index 8569c06592..d831ad7944 100644 --- a/sys/dev/serial/rp/rp.c +++ b/sys/dev/serial/rp/rp.c @@ -828,7 +828,6 @@ rp_attachcommon(CONTROLLER_T *ctlp, int num_aiops, int num_ports) rp_addr(unit) = rp; crit_exit(); - dev_ops_add(&rp_ops, 0xffff0000, (unit + 1) << 16); for (i = 0 ; i < rp_num_ports[unit] ; i++) { make_dev(&rp_ops, ((unit + 1) << 16) | i, UID_ROOT, GID_WHEEL, 0666, "ttyR%c", diff --git a/sys/dev/serial/si/si.c b/sys/dev/serial/si/si.c index 564a56fe84..dfc8e5e73c 100644 --- a/sys/dev/serial/si/si.c +++ b/sys/dev/serial/si/si.c @@ -600,8 +600,6 @@ try_next2: done_chartimes = 1; } - dev_ops_add(&si_ops, 0x7f, unit); -/* path name devsw minor type uid gid perm*/ for (x = 0; x < sc->sc_nport; x++) { /* sync with the manuals that start at 1 */ y = x + 1 + unit * (1 << SI_CARDSHIFT); diff --git a/sys/dev/serial/sio/sio.c b/sys/dev/serial/sio/sio.c index 8ad8b9f364..dc95110744 100644 --- a/sys/dev/serial/sio/sio.c +++ b/sys/dev/serial/sio/sio.c @@ -1178,8 +1178,6 @@ determined_type: ; sio_registered = TRUE; } minorbase = UNIT_TO_MINOR(unit); - dev_ops_add(&sio_ops, UNIT_TO_MINOR(-1), minorbase); - //kprintf("sioattach: make_dev for ttyd%r\n", unit); make_dev(&sio_ops, minorbase, UID_ROOT, GID_WHEEL, 0600, "ttyd%r", unit); make_dev(&sio_ops, minorbase | CONTROL_INIT_STATE, diff --git a/sys/dev/serial/stl/stallion.c b/sys/dev/serial/stl/stallion.c index 7c63792483..3c194041c8 100644 --- a/sys/dev/serial/stl/stallion.c +++ b/sys/dev/serial/stl/stallion.c @@ -868,7 +868,6 @@ static int stlattach(struct isa_device *idp) /* register devices for DEVFS */ boardnr = brdp->brdnr; - dev_ops_add(&stl_ops, 31, boardnr); make_dev(&stl_ops, boardnr + 0x1000000, UID_ROOT, GID_WHEEL, 0600, "staliomem%d", boardnr); diff --git a/sys/dev/serial/stli/istallion.c b/sys/dev/serial/stli/istallion.c index 660dd0fde7..8553f3e229 100644 --- a/sys/dev/serial/stli/istallion.c +++ b/sys/dev/serial/stli/istallion.c @@ -3415,7 +3415,6 @@ static int stli_brdattach(stlibrd_t *brdp) kprintf("stli%d: %s (driver version %s), unit=%d nrpanels=%d " "nrports=%d\n", brdp->unitid, stli_brdnames[brdp->brdtype], stli_drvversion, brdp->brdnr, brdp->nrpanels, brdp->nrports); - dev_ops_add(&stli_ops, -1, brdp->unitid); return(0); } diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 4ef452864c..0663865a34 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -364,9 +364,8 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo) mixer_setrecsrc(m, SOUND_MASK_MIC); unit = device_get_unit(dev); - dev_ops_add(&mixer_cdevsw, -1, PCMMKMINOR(unit, SND_DEV_CTL, 0)); pdev = make_dev(&mixer_cdevsw, PCMMKMINOR(unit, SND_DEV_CTL, 0), - UID_ROOT, GID_WHEEL, 0666, "mixer%d", unit); + UID_ROOT, GID_WHEEL, 0666, "mixer%d", unit); reference_dev(pdev); pdev->si_drv1 = m; snddev = device_get_softc(dev); diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 5103c0c873..e665e01747 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -343,10 +343,9 @@ sndstat_init(void) { lockinit(&sndstat_lock, "sndstat", 0, 0); if (make_dev(&sndstat_cdevsw, SND_DEV_STATUS, - UID_ROOT, GID_WHEEL, 0444, "sndstat") == NULL) + UID_ROOT, GID_WHEEL, 0444, "sndstat") == NULL) { return ENXIO; - dev_ops_add(&sndstat_cdevsw, -1, SND_DEV_STATUS); - + } return 0; } diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index a4909ade46..dc9238792a 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -671,44 +671,26 @@ retry_chan_num_search_out: /* * I will revisit these someday, and nuke it mercilessly.. */ - dev_ops_add(&dsp_cdevsw, - PCMMKMINOR(-1, -1, 0), - PCMMKMINOR(device, SND_DEV_DSP, sce->chan_num)); sce->dsp_devt = make_dev(&dsp_cdevsw, - PCMMKMINOR(device, SND_DEV_DSP, sce->chan_num), - UID_ROOT, GID_WHEEL, 0666, "dsp%d.%d", - device, sce->chan_num); + PCMMKMINOR(device, SND_DEV_DSP, sce->chan_num), + UID_ROOT, GID_WHEEL, 0666, "dsp%d.%d", + device, sce->chan_num); reference_dev(sce->dsp_devt); - dev_ops_add(&dsp_cdevsw, - PCMMKMINOR(-1, -1, 0), - PCMMKMINOR(device, SND_DEV_DSP16, sce->chan_num)); sce->dspW_devt = make_dev(&dsp_cdevsw, - PCMMKMINOR(device, SND_DEV_DSP16, sce->chan_num), - UID_ROOT, GID_WHEEL, 0666, "dspW%d.%d", - device, sce->chan_num); + PCMMKMINOR(device, SND_DEV_DSP16, sce->chan_num), + UID_ROOT, GID_WHEEL, 0666, "dspW%d.%d", + device, sce->chan_num); reference_dev(sce->dspW_devt); - /* - dev_ops_add(&dsp_cdevsw, - PCMMKMINOR(-1, -1, 0), - PCMMKMINOR(device, SND_DEV_DSP, sce->chan_num)); - sce->audio_devt = make_dev(&dsp_cdevsw, - PCMMKMINOR(device, SND_DEV_DSP, sce->chan_num), - UID_ROOT, GID_WHEEL, 0666, "audio%d.%d", - device, sce->chan_num); - */ sce->audio_devt = sce->dsp_devt; reference_dev(sce->audio_devt); if (ch->direction == PCMDIR_REC) { - dev_ops_add(&dsp_cdevsw, - PCMMKMINOR(-1, -1, 0), - PCMMKMINOR(device, SND_DEV_DSPREC, sce->chan_num)); sce->dspr_devt = make_dev(&dsp_cdevsw, - PCMMKMINOR(device, SND_DEV_DSPREC, + PCMMKMINOR(device, SND_DEV_DSPREC, sce->chan_num), UID_ROOT, GID_WHEEL, - 0666, "dspr%d.%d", device, sce->chan_num); + 0666, "dspr%d.%d", device, sce->chan_num); reference_dev(sce->dspr_devt); } diff --git a/sys/dev/usbmisc/ucom/ucom.c b/sys/dev/usbmisc/ucom/ucom.c index 4d9f7545ee..d18cd42fd8 100644 --- a/sys/dev/usbmisc/ucom/ucom.c +++ b/sys/dev/usbmisc/ucom/ucom.c @@ -177,7 +177,6 @@ ucom_attach(struct ucom_softc *sc) DPRINTF(("ucom_attach: make_dev: ucom%d\n", unit)); - dev_ops_add(&ucom_ops, UCOMUNIT_MASK, unit); dev = make_dev(&ucom_ops, unit | UCOM_CALLOUT_MASK, UID_UUCP, GID_DIALER, 0660, "ucom%d", unit); diff --git a/sys/dev/usbmisc/ufm/ufm.c b/sys/dev/usbmisc/ufm/ufm.c index 02d44606b4..3ecb7ec8c7 100644 --- a/sys/dev/usbmisc/ufm/ufm.c +++ b/sys/dev/usbmisc/ufm/ufm.c @@ -176,10 +176,9 @@ ufm_attach(device_t self) sc->sc_epaddr = edesc->bEndpointAddress; /* XXX no error trapping, no storing of cdev_t */ - dev_ops_add(&ufm_ops, -1, device_get_unit(self)); make_dev(&ufm_ops, device_get_unit(self), - UID_ROOT, GID_OPERATOR, - 0644, "ufm%d", device_get_unit(self)); + UID_ROOT, GID_OPERATOR, + 0644, "ufm%d", device_get_unit(self)); DPRINTFN(10, ("ufm_attach: %p\n", sc->sc_udev)); diff --git a/sys/dev/usbmisc/ugen/ugen.c b/sys/dev/usbmisc/ugen/ugen.c index ffc54a5bcf..ebfc008c0f 100644 --- a/sys/dev/usbmisc/ugen/ugen.c +++ b/sys/dev/usbmisc/ugen/ugen.c @@ -244,10 +244,9 @@ ugen_attach(device_t self) } /* the main device, ctrl endpoint */ - dev_ops_add(&ugen_ops, - UGENUNITMASK, UGENMINOR(device_get_unit(sc->sc_dev), 0)); make_dev(&ugen_ops, UGENMINOR(device_get_unit(sc->sc_dev), 0), - UID_ROOT, GID_OPERATOR, 0644, "%s", device_get_nameunit(sc->sc_dev)); + UID_ROOT, GID_OPERATOR, 0644, + "%s", device_get_nameunit(sc->sc_dev)); usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev); return 0; diff --git a/sys/dev/usbmisc/uhid/uhid.c b/sys/dev/usbmisc/uhid/uhid.c index f2f6b83ae4..c66b965016 100644 --- a/sys/dev/usbmisc/uhid/uhid.c +++ b/sys/dev/usbmisc/uhid/uhid.c @@ -257,10 +257,9 @@ uhid_attach(device_t self) sc->sc_repdesc = desc; sc->sc_repdesc_size = size; - dev_ops_add(&uhid_ops, -1, device_get_unit(self)); make_dev(&uhid_ops, device_get_unit(self), - UID_ROOT, GID_OPERATOR, - 0644, "uhid%d", device_get_unit(self)); + UID_ROOT, GID_OPERATOR, + 0644, "uhid%d", device_get_unit(self)); return 0; } diff --git a/sys/dev/usbmisc/ulpt/ulpt.c b/sys/dev/usbmisc/ulpt/ulpt.c index 2fd6916a82..d3754aa42c 100644 --- a/sys/dev/usbmisc/ulpt/ulpt.c +++ b/sys/dev/usbmisc/ulpt/ulpt.c @@ -295,12 +295,13 @@ ulpt_attach(device_t self) sc->sc_ifaceno = id->bInterfaceNumber; sc->sc_udev = dev; - dev_ops_add(&ulpt_ops, -1, device_get_unit(self)); make_dev(&ulpt_ops, device_get_unit(self), - UID_ROOT, GID_OPERATOR, 0644, "ulpt%d", device_get_unit(self)); + UID_ROOT, GID_OPERATOR, 0644, + "ulpt%d", device_get_unit(self)); make_dev(&ulpt_ops, - device_get_unit(self)|ULPT_NOPRIME, - UID_ROOT, GID_OPERATOR, 0644, "unlpt%d", device_get_unit(self)); + device_get_unit(self)|ULPT_NOPRIME, + UID_ROOT, GID_OPERATOR, 0644, + "unlpt%d", device_get_unit(self)); usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev); diff --git a/sys/dev/usbmisc/ums/ums.c b/sys/dev/usbmisc/ums/ums.c index b68c85447e..01bd6f4be8 100644 --- a/sys/dev/usbmisc/ums/ums.c +++ b/sys/dev/usbmisc/ums/ums.c @@ -340,10 +340,9 @@ ums_attach(device_t self) sc->status.button = sc->status.obutton = 0; sc->status.dx = sc->status.dy = sc->status.dz = 0; - dev_ops_add(&ums_ops, -1, device_get_unit(self)); make_dev(&ums_ops, device_get_unit(self), - UID_ROOT, GID_OPERATOR, - 0644, "ums%d", device_get_unit(self)); + UID_ROOT, GID_OPERATOR, + 0644, "ums%d", device_get_unit(self)); if (usbd_get_quirks(uaa->device)->uq_flags & UQ_SPUR_BUT_UP) { DPRINTF(("%s: Spurious button up events\n", diff --git a/sys/dev/usbmisc/urio/urio.c b/sys/dev/usbmisc/urio/urio.c index 2382ec910f..b7a55ceb82 100644 --- a/sys/dev/usbmisc/urio/urio.c +++ b/sys/dev/usbmisc/urio/urio.c @@ -221,10 +221,9 @@ urio_attach(device_t self) goto nobulk; } - dev_ops_add(&urio_ops, -1, device_get_unit(self)); make_dev(&urio_ops, device_get_unit(self), - UID_ROOT, GID_OPERATOR, - 0644, "urio%d", device_get_unit(self)); + UID_ROOT, GID_OPERATOR, + 0644, "urio%d", device_get_unit(self)); DPRINTFN(10, ("urio_attach: %p\n", sc->sc_udev)); diff --git a/sys/dev/usbmisc/uscanner/uscanner.c b/sys/dev/usbmisc/uscanner/uscanner.c index 36d1a92800..37fb997d45 100644 --- a/sys/dev/usbmisc/uscanner/uscanner.c +++ b/sys/dev/usbmisc/uscanner/uscanner.c @@ -371,9 +371,9 @@ uscanner_attach(device_t self) sc->sc_bulkout = ed_bulkout->bEndpointAddress; /* the main device, ctrl endpoint */ - dev_ops_add(&uscanner_ops, -1, device_get_unit(sc->sc_dev)); make_dev(&uscanner_ops, device_get_unit(sc->sc_dev), - UID_ROOT, GID_OPERATOR, 0644, "%s", device_get_nameunit(sc->sc_dev)); + UID_ROOT, GID_OPERATOR, 0644, + "%s", device_get_nameunit(sc->sc_dev)); usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev); diff --git a/sys/dev/video/bktr/bktr_os.c b/sys/dev/video/bktr/bktr_os.c index 368a2899d4..5247f4e415 100644 --- a/sys/dev/video/bktr/bktr_os.c +++ b/sys/dev/video/bktr/bktr_os.c @@ -351,12 +351,10 @@ bktr_attach( device_t dev ) common_bktr_attach( bktr, unit, fun, rev ); /* make the device entries */ - dev_ops_add(&bktr_ops, 0x0f, unit); make_dev(&bktr_ops, unit, 0, 0, 0444, "bktr%d", unit); make_dev(&bktr_ops, unit+16, 0, 0, 0444, "tuner%d", unit); make_dev(&bktr_ops, unit+32, 0, 0, 0444, "vbi%d" , unit); - return 0; fail: diff --git a/sys/dev/video/ctx/ctx.c b/sys/dev/video/ctx/ctx.c index 40f044a220..6432060080 100644 --- a/sys/dev/video/ctx/ctx.c +++ b/sys/dev/video/ctx/ctx.c @@ -193,9 +193,8 @@ ctxattach(struct isa_device * devp) sr->iobase = devp->id_iobase; sr->maddr = devp->id_maddr; sr->msize = devp->id_msize; - dev_ops_add(&ctx_ops, -1, devp->id_unit); make_dev(&ctx_ops, devp->id_unit, 0, 0, 0600, - "ctx%d", devp->id_unit); + "ctx%d", devp->id_unit); return (1); } diff --git a/sys/dev/video/cxm/cxm.c b/sys/dev/video/cxm/cxm.c index bf872b445c..c70009f838 100644 --- a/sys/dev/video/cxm/cxm.c +++ b/sys/dev/video/cxm/cxm.c @@ -1882,9 +1882,8 @@ cxm_attach(device_t dev) /* make the device entries */ - dev_ops_add(&cxm_ops, -1, unit); sc->cxm_dev_t = make_dev(&cxm_ops, unit, - 0, 0, 0444, "cxm%d", unit); + 0, 0, 0444, "cxm%d", unit); return 0; diff --git a/sys/dev/video/gsc/gsc.c b/sys/dev/video/gsc/gsc.c index 24b5990f32..d94e295665 100644 --- a/sys/dev/video/gsc/gsc.c +++ b/sys/dev/video/gsc/gsc.c @@ -518,16 +518,16 @@ gscattach(struct isa_device *isdp) scu->flags |= ATTACHED; lprintf(("gsc%d.attach: ok\n", unit)); scu->flags &= ~FLAG_DEBUG; + #define GSC_UID 0 #define GSC_GID 13 - dev_ops_add(&gsc_ops, 0xc0, unit << 6); make_dev(&gsc_ops, unit<<6, GSC_UID, GSC_GID, 0666, "gsc%d", unit); make_dev(&gsc_ops, ((unit<<6) + FRMT_PBM), - GSC_UID, GSC_GID, 0666, "gsc%dp", unit); + GSC_UID, GSC_GID, 0666, "gsc%dp", unit); make_dev(&gsc_ops, ((unit<<6) + DBUG_MASK), - GSC_UID, GSC_GID, 0666, "gsc%dd", unit); + GSC_UID, GSC_GID, 0666, "gsc%dd", unit); make_dev(&gsc_ops, ((unit<<6) + DBUG_MASK+FRMT_PBM), - GSC_UID, GSC_GID, 0666, "gsc%dpd", unit); + GSC_UID, GSC_GID, 0666, "gsc%dpd", unit); return ATTACH_SUCCESS; } diff --git a/sys/dev/video/meteor/meteor.c b/sys/dev/video/meteor/meteor.c index a475f13b64..9214a31bdd 100644 --- a/sys/dev/video/meteor/meteor.c +++ b/sys/dev/video/meteor/meteor.c @@ -1104,8 +1104,7 @@ met_attach(pcici_t tag, int unit) mtr->frames = 1; /* one frame */ mtr->flags |= METEOR_INITALIZED | METEOR_AUTOMODE | METEOR_DEV0 | - METEOR_RGB16; - dev_ops_add(&meteor_ops, -1, unit); + METEOR_RGB16; make_dev(&meteor_ops, unit, 0, 0, 0644, "meteor"); } diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 761a0173ca..09538fa796 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -255,10 +255,6 @@ makeudev(int x, int y) /* * Create an internal or external device. * - * Device majors can be overloaded and used directly by the kernel without - * conflict, but userland will only see the particular device major that - * has been installed with dev_ops_add(). - * * This routine creates and returns an unreferenced ad-hoc entry for the * device which will remain intact until the device is destroyed. If the * caller intends to store the device pointer it must call reference_dev() @@ -406,21 +402,6 @@ make_sub_dev(cdev_t odev, int minor) return (dev); } -cdev_t -get_dev(int x, int y) -{ - cdev_t dev; - struct dev_ops *ops; - - if (x == NOUDEV) - return(NULL); - ops = dev_ops_get(x, y); - if (ops == NULL) - return(NULL); - dev = hashdev(ops, x, y, TRUE); - return(dev); -} - /* * destroy_dev() removes the adhoc association for a device and revectors * its ops to &dead_dev_ops. @@ -437,52 +418,12 @@ destroy_dev(cdev_t dev) { int hash; - if (dev == NULL) - return; - - devfs_debug(DEVFS_DEBUG_DEBUG, "destroy_dev called for %s\n", dev->si_name); - devfs_destroy_dev(dev); - - return; - - if ((dev->si_flags & SI_ADHOC) == 0) { - release_dev(dev); - return; - } - if (dev_ref_debug) { - kprintf("destroy dev %p %s(minor=%08x) refs=%d\n", - dev, devtoname(dev), dev->si_uminor, - dev->si_sysref.refcnt); - } - if (dev->si_sysref.refcnt < 2) { - kprintf("destroy_dev(): too few references on device! " - "%p %s(minor=%08x) refs=%d\n", - dev, devtoname(dev), dev->si_uminor, - dev->si_sysref.refcnt); - } - dev->si_flags &= ~SI_ADHOC; - if (dev->si_flags & SI_HASHED) { - hash = __devthash(dev->si_umajor, dev->si_uminor); - LIST_REMOVE(dev, si_hash); - dev->si_flags &= ~SI_HASHED; + if (dev) { + devfs_debug(DEVFS_DEBUG_DEBUG, + "destroy_dev called for %s\n", + dev->si_name); + devfs_destroy_dev(dev); } - - /* - * We have to release the ops reference before we replace the - * device switch with dead_dev_ops. - */ - - - if (dead_dev_ops.d_strategy == NULL) - compile_dev_ops(&dead_dev_ops); - if (dev->si_ops && dev->si_ops != &dead_dev_ops) - dev_ops_release(dev->si_ops); - dev->si_drv1 = NULL; - dev->si_drv2 = NULL; - dev->si_ops = &dead_dev_ops; - sysref_put(&dev->si_sysref); /* release adhoc association */ - - release_dev(dev); /* release callers reference */ } /* diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 99519b1e48..f6ced0f9a5 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2675,10 +2675,9 @@ fildesc_drvinit(void *unused) { int fd; - dev_ops_add(&fildesc_ops, 0, 0); for (fd = 0; fd < NUMFDESC; fd++) { make_dev(&fildesc_ops, fd, - UID_BIN, GID_BIN, 0666, "fd/%d", fd); + UID_BIN, GID_BIN, 0666, "fd/%d", fd); } kprintf("fildesc_drvinit() building stdin, stdout, stderr: \n"); diff --git a/sys/kern/kern_device.c b/sys/kern/kern_device.c index ba160a88e0..8c5f869eb3 100644 --- a/sys/kern/kern_device.c +++ b/sys/kern/kern_device.c @@ -410,14 +410,6 @@ compile_dev_ops(struct dev_ops *ops) /* * This makes a dev_ops entry visible to userland (e.g /dev/). * - * The kernel can overload a data space by making multiple dev_ops_add() - * calls, but only the most recent one in the list matching the mask/match - * will be visible to userland. - * - * make_dev() does not automatically call dev_ops_add() (nor do we want it - * to, since partition-managed disk devices are overloaded on top of the - * raw device). - * * Disk devices typically register their major, e.g. 'ad0', and then call * into the disk label management code which overloads its own onto e.g. 'ad0' * to support all the various slice and partition combinations. @@ -445,97 +437,11 @@ RB_GENERATE2(dev_ops_rb_tree, dev_ops_maj, rbnode, rb_dev_ops_compare, int, maj) struct dev_ops_rb_tree dev_ops_rbhead = RB_INITIALIZER(dev_ops_rbhead); -int -dev_ops_add(struct dev_ops *ops, u_int mask, u_int match) -{ - return 0; - - static int next_maj = 256; /* first dynamic major number */ - struct dev_ops_maj *rbmaj; - struct dev_ops_link *link; - - compile_dev_ops(ops); - if (ops->head.maj < 0) { - while (dev_ops_rb_tree_RB_LOOKUP(&dev_ops_rbhead, next_maj) != NULL) { - if (++next_maj <= 0) - next_maj = 256; - } - ops->head.maj = next_maj; - } - rbmaj = dev_ops_rb_tree_RB_LOOKUP(&dev_ops_rbhead, ops->head.maj); - if (rbmaj == NULL) { - rbmaj = kmalloc(sizeof(*rbmaj), M_DEVBUF, M_INTWAIT | M_ZERO); - rbmaj->maj = ops->head.maj; - dev_ops_rb_tree_RB_INSERT(&dev_ops_rbhead, rbmaj); - } - for (link = rbmaj->link; link; link = link->next) { - /* - * If we get an exact match we usurp the target, but we only print - * a warning message if a different device switch is installed. - */ - if (link->mask == mask && link->match == match) { - if (link->ops != ops) { - kprintf("WARNING: \"%s\" (%p) is usurping \"%s\"'s" - " (%p)\n", - ops->head.name, ops, - link->ops->head.name, link->ops); - link->ops = ops; - ++ops->head.refs; - } - return(0); - } - /* - * XXX add additional warnings for overlaps - */ - } - - link = kmalloc(sizeof(struct dev_ops_link), M_DEVBUF, M_INTWAIT|M_ZERO); - link->mask = mask; - link->match = match; - link->ops = ops; - link->next = rbmaj->link; - rbmaj->link = link; - ++ops->head.refs; - return(0); -} - -/* - * Should only be used by udev2dev(). - * - * If the minor number is -1, we match the first ops we find for this - * major. If the mask is not -1 then multiple minor numbers can match - * the same ops. - * - * Note that this function will return NULL if the minor number is not within - * the bounds of the installed mask(s). - * - * The specified minor number should NOT include any major bits. - */ -struct dev_ops * -dev_ops_get(int x, int y) -{ - struct dev_ops_maj *rbmaj; - struct dev_ops_link *link; - - return NULL; - - rbmaj = dev_ops_rb_tree_RB_LOOKUP(&dev_ops_rbhead, x); - if (rbmaj == NULL) - return(NULL); - for (link = rbmaj->link; link; link = link->next) { - if (y == -1 || (link->mask & y) == link->match) - return(link->ops); - } - return(NULL); -} - /* * Remove all matching dev_ops entries from the dev_ops_array[] major * array so no new user opens can be performed, and destroy all devices * installed in the hash table that are associated with this dev_ops. (see * destroy_all_devs()). - * - * The mask and match should match a previous call to dev_ops_add*(). */ int dev_ops_remove(struct dev_ops *ops, u_int mask, u_int match) diff --git a/sys/kern/kern_memio.c b/sys/kern/kern_memio.c index 032b293d4c..7f8bb4736a 100644 --- a/sys/kern/kern_memio.c +++ b/sys/kern/kern_memio.c @@ -560,7 +560,6 @@ mem_drvinit(void *unused) if (mem_range_softc.mr_op != NULL) mem_range_softc.mr_op->init(&mem_range_softc); - dev_ops_add(&mem_ops, 0xf0, 0); make_dev(&mem_ops, 0, UID_ROOT, GID_KMEM, 0640, "mem"); make_dev(&mem_ops, 1, UID_ROOT, GID_KMEM, 0640, "kmem"); make_dev(&mem_ops, 2, UID_ROOT, GID_WHEEL, 0666, "null"); diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 57b1c92b28..943aa7e2e1 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -173,7 +173,6 @@ static struct dev_softc static void devinit(void) { - dev_ops_add(&devctl_ops, -1, 0); make_dev(&devctl_ops, 0, UID_ROOT, GID_WHEEL, 0600, "devctl"); lockinit(&devsoftc.lock, "dev mtx", 0, 0); TAILQ_INIT(&devsoftc.devq); diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index 11bb6033c4..e2ea11919b 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -250,7 +250,6 @@ logioctl(struct dev_ioctl_args *ap) static void log_drvinit(void *unused) { - dev_ops_add(&log_ops, 0, 0); make_dev(&log_ops, 0, UID_ROOT, GID_WHEEL, 0600, "klog"); } diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 44e8e0e493..f38fc9ae78 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -537,9 +537,8 @@ cndbctl(int on) static void cn_drvinit(void *unused) { - dev_ops_add(&cn_ops, 0, 0); cn_devfsdev = make_only_devfs_dev(&cn_ops, 0, UID_ROOT, GID_WHEEL, - 0600, "console"); + 0600, "console"); } SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL) diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 23b4cfb246..787ed8f5e7 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -861,8 +861,6 @@ static void ptc_drvinit(void *unused) { int i; - dev_ops_add(&pts_ops, 0, 0); - dev_ops_add(&ptc_ops, 0, 0); devfs_clone_bitmap_init(&DEVFS_CLONE_BITMAP(pty)); devfs_clone_bitmap_init(&DEVFS_CLONE_BITMAP(pts)); diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 9b73517161..26be9f9371 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -256,7 +256,6 @@ cttypoll(struct dev_poll_args *ap) static void ctty_drvinit(void *unused __unused) { - dev_ops_add(&ctty_ops, 0, 0); make_dev(&ctty_ops, 0, 0, 0, 0666, "tty"); } diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 705fd8996b..511b32b343 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1504,7 +1504,6 @@ bpf_setdlt(struct bpf_d *d, u_int dlt) static void bpf_drvinit(void *unused) { - dev_ops_add(&bpf_ops, 0, 0); make_dev(&bpf_ops, 0, 0, 0, 0600, "bpf"); devfs_clone_bitmap_init(&DEVFS_CLONE_BITMAP(bpf)); devfs_clone_handler_add("bpf", bpfclone); diff --git a/sys/net/i4b/driver/i4b_ctl.c b/sys/net/i4b/driver/i4b_ctl.c index 4205e4632c..6a0a8356c4 100644 --- a/sys/net/i4b/driver/i4b_ctl.c +++ b/sys/net/i4b/driver/i4b_ctl.c @@ -84,17 +84,6 @@ PSEUDO_SET(i4bctlattach, i4b_i4bctldrv); #define PDEVSTATIC static -/*---------------------------------------------------------------------------* - * initialization at kernel load time - *---------------------------------------------------------------------------*/ -static void -i4bctlinit(void *unused) -{ - dev_ops_add(&i4bctl_ops, 0, 0); -} - -SYSINIT(i4bctldev, SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR, &i4bctlinit, NULL); - /*---------------------------------------------------------------------------* * interface attach routine *---------------------------------------------------------------------------*/ diff --git a/sys/net/i4b/driver/i4b_rbch.c b/sys/net/i4b/driver/i4b_rbch.c index 503c79339a..def0f143f8 100644 --- a/sys/net/i4b/driver/i4b_rbch.c +++ b/sys/net/i4b/driver/i4b_rbch.c @@ -141,18 +141,6 @@ PSEUDO_SET(i4brbchattach, i4b_rbch); * DEVICE DRIVER ROUTINES *===========================================================================*/ -/*---------------------------------------------------------------------------* - * initialization at kernel load time - *---------------------------------------------------------------------------*/ -static void -i4brbchinit(void *unused) -{ - dev_ops_add(&i4brbch_ops, 0, 0); -} - -SYSINIT(i4brbchdev, SI_SUB_DRIVERS, - SI_ORDER_MIDDLE+CDEV_MAJOR, &i4brbchinit, NULL); - /*---------------------------------------------------------------------------* * interface attach routine *---------------------------------------------------------------------------*/ diff --git a/sys/net/i4b/driver/i4b_tel.c b/sys/net/i4b/driver/i4b_tel.c index b9fc1b7cd3..859fef3d5a 100644 --- a/sys/net/i4b/driver/i4b_tel.c +++ b/sys/net/i4b/driver/i4b_tel.c @@ -166,18 +166,6 @@ PSEUDO_SET(i4btelattach, i4b_tel); * DEVICE DRIVER ROUTINES *===========================================================================*/ -/*---------------------------------------------------------------------------* - * initialization at kernel load time - *---------------------------------------------------------------------------*/ -PDEVSTATIC void -i4btelinit(void *unused) -{ - dev_ops_add(&i4btel_ops, 0, 0); -} - -SYSINIT(i4bteldev, SI_SUB_DRIVERS, - SI_ORDER_MIDDLE+CDEV_MAJOR, &i4btelinit, NULL); - /*---------------------------------------------------------------------------* * interface attach routine *---------------------------------------------------------------------------*/ diff --git a/sys/net/i4b/driver/i4b_trace.c b/sys/net/i4b/driver/i4b_trace.c index 83fb2d6080..d200aac358 100644 --- a/sys/net/i4b/driver/i4b_trace.c +++ b/sys/net/i4b/driver/i4b_trace.c @@ -90,15 +90,6 @@ static struct dev_ops i4btrc_ops = { /*---------------------------------------------------------------------------* * interface init routine *---------------------------------------------------------------------------*/ -static void -i4btrcinit(void *unused) -{ - dev_ops_add(&i4btrc_ops, 0, 0); -} - -SYSINIT(i4btrcdev, SI_SUB_DRIVERS, - SI_ORDER_MIDDLE+CDEV_MAJOR, &i4btrcinit, NULL); - static void i4btrcattach(void *); PSEUDO_SET(i4btrcattach, i4b_trace); diff --git a/sys/net/i4b/layer4/i4b_i4bdrv.c b/sys/net/i4b/layer4/i4b_i4bdrv.c index ee4576bf20..be392cc658 100644 --- a/sys/net/i4b/layer4/i4b_i4bdrv.c +++ b/sys/net/i4b/layer4/i4b_i4bdrv.c @@ -105,14 +105,6 @@ static struct dev_ops i4b_ops = { PDEVSTATIC void i4battach(void *); PSEUDO_SET(i4battach, i4b_i4bdrv); -static void -i4b_drvinit(void *unused) -{ - dev_ops_add(&i4b_ops, 0, 0); -} - -SYSINIT(i4bdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,i4b_drvinit,NULL) - /*---------------------------------------------------------------------------* * interface attach routine *---------------------------------------------------------------------------*/ diff --git a/sys/net/pf/pf_ioctl.c b/sys/net/pf/pf_ioctl.c index 2bf470a218..3bf7431ec5 100644 --- a/sys/net/pf/pf_ioctl.c +++ b/sys/net/pf/pf_ioctl.c @@ -3063,9 +3063,6 @@ pf_load(void) int error; init_zone_var(); - error = dev_ops_add(&pf_ops, 0, 0); - if (error) - return (error); pf_dev = make_dev(&pf_ops, 0, 0, 0, 0600, PF_NAME); error = pfattach(); if (error) { diff --git a/sys/netproto/smb/smb_dev.c b/sys/netproto/smb/smb_dev.c index c451e36310..de8433405e 100644 --- a/sys/netproto/smb/smb_dev.c +++ b/sys/netproto/smb/smb_dev.c @@ -352,7 +352,6 @@ nsmb_dev_load(module_t mod, int cmd, void *arg) smb_iod_done(); error = smb_sm_done(); error = 0; - //dev_ops_remove(&nsmb_ops, 0, 0); dev_ops_remove_all(&nsmb_ops); kprintf("netsmb_dev: unloaded\n"); break; diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 6da614719e..d6d76c479f 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -782,9 +782,8 @@ cryptodev_modevent(module_t mod, int type, void *unused) case MOD_LOAD: if (bootverbose) kprintf("crypto: \n"); - dev_ops_add(&crypto_ops, 0, 0); make_dev(&crypto_ops, 0, UID_ROOT, GID_WHEEL, - 0666, "crypto"); + 0666, "crypto"); return 0; case MOD_UNLOAD: /*XXX disallow if active sessions */ diff --git a/sys/platform/pc32/acpica5/acpi_machdep.c b/sys/platform/pc32/acpica5/acpi_machdep.c index dee90aea21..bce46bc522 100644 --- a/sys/platform/pc32/acpica5/acpi_machdep.c +++ b/sys/platform/pc32/acpica5/acpi_machdep.c @@ -300,7 +300,6 @@ apmpoll(struct dev_poll_args *ap) static void acpi_capm_init(struct acpi_softc *sc) { - dev_ops_add(&apm_ops, 0, 0); make_dev(&apm_ops, 0, 0, 5, 0664, "apm"); make_dev(&apm_ops, 8, 0, 5, 0664, "apm"); kprintf("Warning: ACPI is disabling APM's device. You can't run both\n"); diff --git a/sys/platform/pc32/apm/apm.c b/sys/platform/pc32/apm/apm.c index d2ee2f0d49..fc4d5ac91f 100644 --- a/sys/platform/pc32/apm/apm.c +++ b/sys/platform/pc32/apm/apm.c @@ -1090,7 +1090,6 @@ apm_attach(device_t dev) sc->initialized = 1; - dev_ops_add(&apm_ops, 0, 0); make_dev(&apm_ops, 0, UID_ROOT, GID_OPERATOR, 0660, "apm"); make_dev(&apm_ops, 8, UID_ROOT, GID_OPERATOR, 0660, "apmctl"); return 0; diff --git a/sys/platform/pc32/i386/elan-mmcr.c b/sys/platform/pc32/i386/elan-mmcr.c index 7cad960d91..0dd0fe4113 100644 --- a/sys/platform/pc32/i386/elan-mmcr.c +++ b/sys/platform/pc32/i386/elan-mmcr.c @@ -138,9 +138,7 @@ elan_drvinit(void) if (elan_mmcr == NULL) return; kprintf("Elan-mmcr driver: MMCR at %p\n", elan_mmcr); - dev_ops_add(&elan_ops, 0, 0); make_dev(&elan_ops, 0, UID_ROOT, GID_WHEEL, 0600, "elan-mmcr"); - return; } SYSINIT(elan, SI_SUB_PSEUDO, SI_ORDER_MIDDLE+CDEV_MAJOR,elan_drvinit,NULL); diff --git a/sys/platform/pc32/i386/perfmon.c b/sys/platform/pc32/i386/perfmon.c index 04a14747c1..55034982c7 100644 --- a/sys/platform/pc32/i386/perfmon.c +++ b/sys/platform/pc32/i386/perfmon.c @@ -80,7 +80,6 @@ static struct dev_ops perfmon_ops = { static void perfmon_driver_init(void *unused __unused) { - dev_ops_add(&perfmon_ops, 0xf0, 32); make_dev(&perfmon_ops, 32, UID_ROOT, GID_KMEM, 0640, "perfmon"); } diff --git a/sys/platform/pc32/isa/asc.c b/sys/platform/pc32/isa/asc.c index ac1840f611..d437e50136 100644 --- a/sys/platform/pc32/isa/asc.c +++ b/sys/platform/pc32/isa/asc.c @@ -472,14 +472,13 @@ ascattach(struct isa_device *isdp) scu->selp.si_pid=(pid_t)0; #define ASC_UID 0 #define ASC_GID 13 - dev_ops_add(&asc_ops, 0xc0, unit << 6); make_dev(&asc_ops, unit<<6, ASC_UID, ASC_GID, 0666, "asc%d", unit); make_dev(&asc_ops, ((unit<<6) + FRMT_PBM), - ASC_UID, ASC_GID, 0666, "asc%dp", unit); + ASC_UID, ASC_GID, 0666, "asc%dp", unit); make_dev(&asc_ops, ((unit<<6) + DBUG_MASK), - ASC_UID, ASC_GID, 0666, "asc%dd", unit); + ASC_UID, ASC_GID, 0666, "asc%dd", unit); make_dev(&asc_ops, ((unit<<6) + DBUG_MASK+FRMT_PBM), - ASC_UID, ASC_GID, 0666, "asc%dpd", unit); + ASC_UID, ASC_GID, 0666, "asc%dpd", unit); return ATTACH_SUCCESS; } diff --git a/sys/platform/pc64/acpica5/acpi_machdep.c b/sys/platform/pc64/acpica5/acpi_machdep.c index 723c568514..8a7223c83f 100644 --- a/sys/platform/pc64/acpica5/acpi_machdep.c +++ b/sys/platform/pc64/acpica5/acpi_machdep.c @@ -300,7 +300,6 @@ apmpoll(struct dev_poll_args *ap) static void acpi_capm_init(struct acpi_softc *sc) { - dev_ops_add(&apm_ops, 0, 0); make_dev(&apm_ops, 0, 0, 5, 0664, "apm"); make_dev(&apm_ops, 8, 0, 5, 0664, "apm"); kprintf("Warning: ACPI is disabling APM's device. You can't run both\n"); diff --git a/sys/platform/pc64/apm/apm.c b/sys/platform/pc64/apm/apm.c index 358c60267c..a40ca548c2 100644 --- a/sys/platform/pc64/apm/apm.c +++ b/sys/platform/pc64/apm/apm.c @@ -1090,7 +1090,6 @@ apm_attach(device_t dev) sc->initialized = 1; - dev_ops_add(&apm_ops, 0, 0); make_dev(&apm_ops, 0, UID_ROOT, GID_OPERATOR, 0660, "apm"); make_dev(&apm_ops, 8, UID_ROOT, GID_OPERATOR, 0660, "apmctl"); return 0; diff --git a/sys/platform/pc64/isa/asc.c b/sys/platform/pc64/isa/asc.c index fa68e82618..6ee47739bb 100644 --- a/sys/platform/pc64/isa/asc.c +++ b/sys/platform/pc64/isa/asc.c @@ -471,14 +471,13 @@ ascattach(struct isa_device *isdp) scu->selp.si_pid=(pid_t)0; #define ASC_UID 0 #define ASC_GID 13 - dev_ops_add(&asc_ops, 0xc0, unit << 6); make_dev(&asc_ops, unit<<6, ASC_UID, ASC_GID, 0666, "asc%d", unit); make_dev(&asc_ops, ((unit<<6) + FRMT_PBM), - ASC_UID, ASC_GID, 0666, "asc%dp", unit); + ASC_UID, ASC_GID, 0666, "asc%dp", unit); make_dev(&asc_ops, ((unit<<6) + DBUG_MASK), - ASC_UID, ASC_GID, 0666, "asc%dd", unit); + ASC_UID, ASC_GID, 0666, "asc%dd", unit); make_dev(&asc_ops, ((unit<<6) + DBUG_MASK+FRMT_PBM), - ASC_UID, ASC_GID, 0666, "asc%dpd", unit); + ASC_UID, ASC_GID, 0666, "asc%dpd", unit); return ATTACH_SUCCESS; } diff --git a/sys/platform/vkernel/platform/console.c b/sys/platform/vkernel/platform/console.c index 7d5efaa7f7..b141725029 100644 --- a/sys/platform/vkernel/platform/console.c +++ b/sys/platform/vkernel/platform/console.c @@ -355,7 +355,6 @@ vconsinit_fini(struct consdev *cp) /* * Implement ttyv0-ttyv7. At the moment ttyv1-7 are sink nulls. */ - dev_ops_add(&vcons_ops, -1 & ~7, 0); for (i = 0; i < 8; ++i) { kprintf("vconsinit_fini(): make_dev for ttyv%d\n", i); dev = make_dev(&vcons_ops, i, diff --git a/sys/sys/device.h b/sys/sys/device.h index 9f9ba9db4a..4daccca725 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -352,14 +352,12 @@ extern struct syslink_desc dev_kqfilter_desc; extern struct syslink_desc dev_clone_desc; void compile_dev_ops(struct dev_ops *); -int dev_ops_add(struct dev_ops *, u_int mask, u_int match); int dev_ops_remove(struct dev_ops *, u_int mask, u_int match); int dev_ops_remove_all(struct dev_ops *ops); int dev_ops_remove_minor(struct dev_ops *ops, int minor); void dev_ops_release(struct dev_ops *); struct dev_ops *dev_ops_intercept(cdev_t, struct dev_ops *); void dev_ops_restore(cdev_t, struct dev_ops *); -struct dev_ops *dev_ops_get(int x, int y); void destroy_all_devs(struct dev_ops *, u_int mask, u_int match); cdev_t make_dev(struct dev_ops *ops, int minor, uid_t uid, gid_t gid, diff --git a/sys/vfs/mfs/mfs_vfsops.c b/sys/vfs/mfs/mfs_vfsops.c index 2ced6ddac5..2284d67240 100644 --- a/sys/vfs/mfs/mfs_vfsops.c +++ b/sys/vfs/mfs/mfs_vfsops.c @@ -316,7 +316,7 @@ mfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred) devvp->v_type = VCHR; dev = make_dev(&mfs_ops, minnum, UID_ROOT, GID_WHEEL, 0600, - "MFS%d", minnum >> 16); + "MFS%d", minnum >> 16); /* It is not clear that these will get initialized otherwise */ dev->si_bsize_phys = DEV_BSIZE; dev->si_iosize_max = DFLTPHYS; @@ -473,6 +473,5 @@ mfs_statfs(struct mount *mp, struct statfs *sbp, struct ucred *cred) static int mfs_init(struct vfsconf *vfsp) { - dev_ops_add(&mfs_ops, 0, 0); return (0); }