Simplify cdevsw registration.

The cdevsw_add() function now finds the major number(s) in the
struct cdevsw passed to it.  cdevsw_add_generic() is no longer
needed, cdevsw_add() does the same thing.

cdevsw_add() will print an message if the d_maj field looks bogus.

Remove nblkdev and nchrdev variables.  Most places they were used
bogusly.  Instead check a dev_t for validity by seeing if devsw()
or bdevsw() returns NULL.

Move bdevsw() and devsw() functions to kern/kern_conf.c

Bump __FreeBSD_version to 400006

This commit removes:
        72 bogus makedev() calls
        26 bogus SYSINIT functions

if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.

I4b and vinum not changed.  Patches emailed to authors.  LINT
probably broken until they catch up.
This commit is contained in:
Poul-Henning Kamp 1999-05-31 11:29:30 +00:00
parent db453b1679
commit 2447bec829
130 changed files with 442 additions and 1200 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
* $Id: cons.c,v 1.7 1999/05/15 18:14:03 dfr Exp $
* $Id: cons.c,v 1.8 1999/05/30 16:50:40 phk Exp $
*/
#include "opt_devfs.h"
@ -444,23 +444,16 @@ cnputc(c)
}
}
static int cn_devsw_installed = 0;
static void
cn_drvinit(void *unused)
{
dev_t dev;
if( ! cn_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&cn_cdevsw,NULL);
cn_devsw_installed = 1;
cdevsw_add(&dev);
#ifdef DEVFS
cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR,
UID_ROOT, GID_WHEEL, 0600,
"console");
cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR,
UID_ROOT, GID_WHEEL, 0600, "console");
#endif
}
}
SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL)

View File

@ -38,7 +38,7 @@
*
* from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
* $Id: mem.c,v 1.8 1999/05/29 19:47:51 gallatin Exp $
* $Id: mem.c,v 1.9 1999/05/30 16:50:43 phk Exp $
*/
/*
@ -445,23 +445,14 @@ iszerodev(dev)
&& (minor(dev) == 0x02600000)));
}
static int mem_devsw_installed;
static void
mem_drvinit(void *unused)
{
dev_t dev;
if( ! mem_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&mem_cdevsw, NULL);
mem_devsw_installed = 1;
cdevsw_add(&mem_cdevsw);
#ifdef DEVFS
memdevfs_init();
memdevfs_init();
#endif
}
}
SYSINIT(memdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mem_drvinit,NULL)

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.122 1999/05/12 07:40:50 phk Exp $
* $Id: autoconf.c,v 1.123 1999/05/24 00:30:49 jb Exp $
*/
/*
@ -156,7 +156,7 @@ find_cdrom_root()
orootdev = rootdev;
for (i = 0 ; i < 2; i++)
for (j = 0 ; try_cdrom[j].name ; j++) {
if (try_cdrom[j].major >= nblkdev)
if (try_cdrom[j].major >= NUMCDEVSW)
continue;
rootdev = makedev(try_cdrom[j].major, i * 8);
bd = bdevsw(rootdev);
@ -382,7 +382,7 @@ setdumpdev(dev)
return (0);
}
maj = major(dev);
if (maj >= nblkdev || bdevsw(dev) == NULL)
if (bdevsw(dev) == NULL)
return (ENXIO); /* XXX is this right? */
if (bdevsw(dev)->d_psize == NULL)
return (ENXIO); /* XXX should be ENODEV ? */
@ -435,7 +435,7 @@ setroot()
return;
majdev = B_TYPE(bootdev);
dev = makedev(majdev, 0);
if (majdev >= nblkdev || bdevsw(dev) == NULL)
if (bdevsw(dev) == NULL)
return;
unit = B_UNIT(bootdev);
slice = B_SLICE(bootdev);
@ -523,7 +523,7 @@ setrootbyname(char *name)
}
unit = *cp - '0';
*cp++ = '\0';
for (bd = 0; bd < nblkdev; bd++) {
for (bd = 0; bd < NUMCDEVSW; bd++) {
dev = makedev(bd, 0);
if (bdevsw(dev) != NULL &&
strcmp(bdevsw(dev)->d_name, name) == 0)
@ -566,7 +566,7 @@ setconf()
return;
printf("use one of:\n");
for (i = 0; i < nblkdev; i++) {
for (i = 0; i < NUMCDEVSW; i++) {
dev = makedev(i, 0);
if (bdevsw(dev) != NULL)
printf(" %s", bdevsw(dev)->d_name);

View File

@ -38,7 +38,7 @@
*
* from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
* $Id: mem.c,v 1.61 1999/05/11 19:54:06 phk Exp $
* $Id: mem.c,v 1.62 1999/05/30 16:52:04 phk Exp $
*/
/*
@ -668,7 +668,6 @@ static int mem_devsw_installed;
static void
mem_drvinit(void *unused)
{
dev_t dev;
/* Initialise memory range handling */
if (mem_range_softc.mr_op != NULL)
@ -676,9 +675,7 @@ mem_drvinit(void *unused)
/* device registration */
if( ! mem_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&mem_cdevsw, NULL);
cdevsw_add(&mem_cdevsw);
mem_devsw_installed = 1;
#ifdef DEVFS
memdevfs_init();

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cam_xpt.c,v 1.61 1999/05/25 20:17:29 gibbs Exp $
* $Id: cam_xpt.c,v 1.62 1999/05/30 16:50:57 phk Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
@ -825,10 +825,7 @@ dev_allocq_is_runnable(struct cam_devq *devq)
static void
xpt_periph_init()
{
dev_t dev;
dev = makedev(XPT_CDEV_MAJOR, 0);
cdevsw_add(&dev, &xpt_cdevsw, NULL);
cdevsw_add(&xpt_cdevsw);
}
static void

View File

@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_cd.c,v 1.21 1999/05/22 22:00:18 gibbs Exp $
* $Id: scsi_cd.c,v 1.22 1999/05/30 16:51:00 phk Exp $
*/
/*
* Portions of this driver taken from the original FreeBSD cd driver.
@ -346,7 +346,7 @@ cdinit(void)
"due to status 0x%x!\n", status);
} else {
/* If we were successfull, register our devsw */
cdevsw_add_generic(CD_BDEV_MAJOR, CD_CDEV_MAJOR, &cd_cdevsw);
cdevsw_add(&cd_cdevsw);
}
}

View File

@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_ch.c,v 1.12 1999/05/22 22:00:19 gibbs Exp $
* $Id: scsi_ch.c,v 1.13 1999/05/30 16:51:01 phk Exp $
*/
/*
* Derived from the NetBSD SCSI changer driver.
@ -277,11 +277,8 @@ chinit(void)
printf("ch: Failed to attach master async callback "
"due to status 0x%x!\n", status);
} else {
dev_t dev;
/* If we were successfull, register our devsw */
dev = makedev(CH_CDEV_MAJOR, 0);
cdevsw_add(&dev, &ch_cdevsw, NULL);
cdevsw_add(&ch_cdevsw);
}
}

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_da.c,v 1.25 1999/05/22 22:00:20 gibbs Exp $
* $Id: scsi_da.c,v 1.26 1999/05/30 16:51:02 phk Exp $
*/
#include "opt_hw_wdog.h"
@ -821,7 +821,7 @@ dainit(void)
int err;
/* If we were successfull, register our devsw */
cdevsw_add_generic(DA_BDEV_MAJOR, DA_CDEV_MAJOR, &da_cdevsw);
cdevsw_add(&da_cdevsw);
/*
* Schedule a periodic event to occasioanly send an

View File

@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_pass.c,v 1.10 1999/05/22 22:00:21 gibbs Exp $
* $Id: scsi_pass.c,v 1.11 1999/05/30 16:51:03 phk Exp $
*/
#include <sys/param.h>
@ -184,11 +184,8 @@ passinit(void)
printf("pass: Failed to attach master async callback "
"due to status 0x%x!\n", status);
} else {
dev_t dev;
/* If we were successfull, register our devsw */
dev = makedev(PASS_CDEV_MAJOR, 0);
cdevsw_add(&dev, &pass_cdevsw, NULL);
cdevsw_add(&pass_cdevsw);
}
}

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_pt.c,v 1.8 1999/05/22 22:00:22 gibbs Exp $
* $Id: scsi_pt.c,v 1.9 1999/05/30 16:51:05 phk Exp $
*/
#include <sys/param.h>
@ -304,10 +304,7 @@ ptinit(void)
"due to status 0x%x!\n", status);
} else {
/* If we were successfull, register our devsw */
dev_t dev;
dev = makedev(PT_CDEV_MAJOR, 0);
cdevsw_add(&dev,&pt_cdevsw, NULL);
cdevsw_add(&pt_cdevsw);
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: scsi_sa.c,v 1.26 1999/05/25 23:10:54 mjacob Exp $
* $Id: scsi_sa.c,v 1.27 1999/05/30 16:51:07 phk Exp $
*
* Implementation of SCSI Sequential Access Peripheral driver for CAM.
*
@ -1148,7 +1148,7 @@ sainit(void)
"due to status 0x%x!\n", status);
} else {
/* If we were successfull, register our devsw */
cdevsw_add_generic(SA_BDEV_MAJOR, SA_CDEV_MAJOR, &sa_cdevsw);
cdevsw_add(&sa_cdevsw);
}
}

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_target.c,v 1.12 1999/05/22 22:00:24 gibbs Exp $
* $Id: scsi_target.c,v 1.13 1999/05/30 16:51:07 phk Exp $
*/
#include <stddef.h> /* For offsetof */
@ -196,7 +196,6 @@ static struct extend_array *targperiphs;
static void
targinit(void)
{
dev_t dev;
/*
* Create our extend array for storing the devices we attach to.
@ -208,8 +207,7 @@ targinit(void)
}
/* If we were successfull, register our devsw */
dev = makedev(TARG_CDEV_MAJOR, 0);
cdevsw_add(&dev,&targ_cdevsw, NULL);
cdevsw_add(&targ_cdevsw);
}
static void

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_fbsd.c,v 1.13 1999/01/28 00:57:46 dillon Exp $
* $Id: coda_fbsd.c,v 1.14 1999/05/30 16:51:10 phk Exp $
*
*/
@ -101,7 +101,6 @@ int vcdebug = 1;
static int
codadev_modevent(module_t mod, int type, void *data)
{
dev_t dev;
#ifdef DEVFS
int i;
#endif
@ -109,8 +108,7 @@ codadev_modevent(module_t mod, int type, void *data)
switch (type) {
case MOD_LOAD:
dev = makedev(VC_DEV_NO, 0);
cdevsw_add(&dev,&codadevsw, &oldcdevsw);
cdevsw_add(&codadevsw);
#ifdef DEVFS
/* tmp */
#undef NVCODA
@ -134,7 +132,7 @@ codadev_modevent(module_t mod, int type, void *data)
devfs_remove_dev(coda_devfs_token[i]);
}
#endif
cdevsw_add(&dev, oldcdevsw, NULL);
cdevsw_add(oldcdevsw);
break;
default:
break;

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_vfsops.c,v 1.12 1999/05/08 06:39:04 phk Exp $
* $Id: coda_vfsops.c,v 1.13 1999/05/09 13:11:37 phk Exp $
*
*/
@ -47,6 +47,9 @@
/*
* HISTORY
* $Log: coda_vfsops.c,v $
* Revision 1.13 1999/05/09 13:11:37 phk
* remove cast from dev_t to dev_t.
*
* Revision 1.12 1999/05/08 06:39:04 phk
* I got tired of seeing all the cdevsw[major(foo)] all over the place.
*
@ -341,10 +344,6 @@ coda_mount(vfsp, path, data, ndp, p)
}
dev = dvp->v_specinfo->si_rdev;
vrele(dvp);
if (major(dev) >= nchrdev || major(dev) < 0) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
return(ENXIO);
}
/*
* See if the device table matches our expectations.

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: ata-disk.c,v 1.11 1999/05/17 15:58:45 sos Exp $
* $Id: ata-disk.c,v 1.12 1999/05/30 16:51:12 phk Exp $
*/
#include "ata.h"
@ -88,6 +88,7 @@ static struct cdevsw ad_cdevsw = {
/* maxio */ 0,
/* bmaj */ BDEV_MAJOR,
};
static struct cdevsw fakewd_cdevsw;
/* misc defines */
#define UNIT(dev) (minor(dev)>>3 & 0x1f) /* assume 8 minor # per unit */
@ -663,8 +664,11 @@ ad_drvinit(void)
static int32_t ad_devsw_installed = 0;
if (!ad_devsw_installed) {
cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &ad_cdevsw);
cdevsw_add_generic(0, 3, &ad_cdevsw); /* grap wd entries too */
cdevsw_add(&ad_cdevsw);
fakewd_cdevsw = ad_cdevsw;
fakewd_cdevsw.d_maj = 3;
fakewd_cdevsw.d_bmaj = 0;
cdevsw_add(&fakewd_cdevsw); /* grap wd entries too */
ad_devsw_installed = 1;
}
/* register callback for when interrupts are enabled */

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: atapi-cd.c,v 1.8 1999/05/17 15:58:46 sos Exp $
* $Id: atapi-cd.c,v 1.9 1999/05/30 16:51:14 phk Exp $
*/
#include "ata.h"
@ -1426,7 +1426,7 @@ acd_drvinit(void *unused)
static int32_t acd_devsw_installed = 0;
if (!acd_devsw_installed) {
cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &acd_cdevsw);
cdevsw_add(&acd_cdevsw);
acd_devsw_installed = 1;
}
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: atapi-fd.c,v 1.8 1999/05/20 09:12:05 sos Exp $
* $Id: atapi-fd.c,v 1.9 1999/05/30 16:51:15 phk Exp $
*/
#include "ata.h"
@ -482,7 +482,7 @@ afd_drvinit(void *unused)
static int32_t afd_devsw_installed = 0;
if (!afd_devsw_installed) {
cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &afd_cdevsw);
cdevsw_add(&afd_cdevsw);
afd_devsw_installed = 1;
}
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: atapi-tape.c,v 1.8 1999/05/17 15:58:47 sos Exp $
* $Id: atapi-tape.c,v 1.9 1999/05/30 16:51:16 phk Exp $
*/
#include "ata.h"
@ -554,9 +554,7 @@ ast_drvinit(void *unused)
static int32_t ast_devsw_installed = 0;
if (!ast_devsw_installed) {
dev_t dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &ast_cdevsw, NULL);
cdevsw_add(&ast_cdevsw);
ast_devsw_installed = 1;
}
}

View File

@ -1,4 +1,4 @@
/* $Id: brooktree848.c,v 1.81 1999/05/25 12:43:40 roger Exp $ */
/* $Id: brooktree848.c,v 1.82 1999/05/30 16:53:32 phk Exp $ */
/* BT848 Driver for Brooktree's Bt848, Bt848A, Bt849A, Bt878, Bt879 based cards.
The Brooktree BT848 Driver driver is based upon Mark Tinguely and
Jim Lowe's driver for the Matrox Meteor PCI card . The
@ -668,6 +668,10 @@ bktr_probe(struct device *parent, struct cfdata *cf, void *aux)
pci_devaddr_t *pa;
pci_devres_t res;
struct isa_attach_args *ia = aux;
static int once;
if (!once++)
cdevsw_add(&bktr_cdevsw);
if (ia->ia_bustype != BUS_PCI)
return (0);
@ -7017,29 +7021,6 @@ static void msp_autodetect( bktr_ptr_t bktr ) {
/* msp_write(bktr, 0x12, 0x0014, 0x7f40); */
}
/******************************************************************************
* magic:
*/
#ifdef __FreeBSD__
static int bktr_devsw_installed;
static void
bktr_drvinit( void *unused )
{
dev_t dev;
if ( ! bktr_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&bktr_cdevsw, NULL);
bktr_devsw_installed = 1;
}
}
SYSINIT(bktrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bktr_drvinit,NULL)
#endif /* __FreeBSD__ */
#endif /* !defined(__FreeBSD__) || (NBKTR > 0 && NPCI > 0) */
/* Local Variables: */

View File

@ -27,7 +27,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: cy.c,v 1.88 1999/05/28 13:23:21 bde Exp $
* $Id: cy.c,v 1.89 1999/05/30 16:52:11 phk Exp $
*/
#include "opt_compat.h"
@ -541,7 +541,6 @@ cyattach_common(cy_iobase, cy_align)
{
int adapter;
int cyu;
dev_t dev;
u_char firmware_version;
cy_addr iobase;
int ncyu;
@ -633,8 +632,7 @@ cyattach_common(cy_iobase, cy_align)
splx(s);
if (!sio_registered) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &sio_cdevsw, NULL);
cdevsw_add(&sio_cdevsw);
register_swi(SWI_TTY, siopoll);
sio_registered = TRUE;
}

View File

@ -27,7 +27,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: cy.c,v 1.88 1999/05/28 13:23:21 bde Exp $
* $Id: cy.c,v 1.89 1999/05/30 16:52:11 phk Exp $
*/
#include "opt_compat.h"
@ -541,7 +541,6 @@ cyattach_common(cy_iobase, cy_align)
{
int adapter;
int cyu;
dev_t dev;
u_char firmware_version;
cy_addr iobase;
int ncyu;
@ -633,8 +632,7 @@ cyattach_common(cy_iobase, cy_align)
splx(s);
if (!sio_registered) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &sio_cdevsw, NULL);
cdevsw_add(&sio_cdevsw);
register_swi(SWI_TTY, siopoll);
sio_registered = TRUE;
}

View File

@ -1,5 +1,5 @@
/*-
* dgb.c $Id: dgb.c,v 1.48 1999/05/08 07:02:24 phk Exp $
* dgb.c $Id: dgb.c,v 1.49 1999/05/30 16:51:56 phk Exp $
*
* Digiboard driver.
*
@ -425,7 +425,10 @@ dgbprobe(dev)
int i, v;
u_long win_size; /* size of vizible memory window */
int unit=dev->id_unit;
static int once;
if (!once++)
cdevsw_add(&dgb_cdevsw);
sc->unit=dev->id_unit;
sc->port=dev->id_iobase;
@ -2301,21 +2304,4 @@ disc_optim(tp, t)
tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
}
static int dgb_devsw_installed;
static void
dgb_drvinit(void *unused)
{
dev_t dev;
if( ! dgb_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&dgb_cdevsw, NULL);
dgb_devsw_installed = 1;
}
}
SYSINIT(dgbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgb_drvinit,NULL)
#endif /* NDGB > 0 */

View File

@ -1,5 +1,5 @@
/*-
* $Id: dgm.c,v 1.13 1999/05/08 07:02:25 phk Exp $
* $Id: dgm.c,v 1.14 1999/05/30 16:51:58 phk Exp $
*
* This driver and the associated header files support the ISA PC/Xem
* Digiboards. Its evolutionary roots are described below.
@ -397,6 +397,10 @@ dgmprobe(dev)
struct dgm_softc *sc= &dgm_softc[dev->id_unit];
int i, v;
int unit=dev->id_unit;
static int once;
if (!once++)
cdevsw_add(&dgm_cdevsw);
sc->unit=dev->id_unit;
sc->port=dev->id_iobase;
@ -2105,21 +2109,4 @@ disc_optim(tp, t)
tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
}
static int dgm_devsw_installed;
static void
dgm_drvinit(void *unused)
{
dev_t dev;
if( ! dgm_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&dgm_cdevsw, NULL);
dgm_devsw_installed = 1;
}
}
SYSINIT(dgmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgm_drvinit,NULL)
#endif /* NDGM > 0 */

View File

@ -36,7 +36,7 @@
* future.
*/
#ident "$Id: dpt_control.c,v 1.12 1999/05/13 05:24:53 jkh Exp $"
#ident "$Id: dpt_control.c,v 1.13 1999/05/30 16:51:20 phk Exp $"
#include "opt_dpt.h"
@ -848,7 +848,6 @@ static dpt_devsw_installed = 0;
static void
dpt_drvinit(void *unused)
{
dev_t dev;
if (!dpt_devsw_installed) {
if (bootverbose)
@ -856,11 +855,7 @@ dpt_drvinit(void *unused)
DPT_CTL_RELEASE, DPT_CTL_VERSION, DPT_CTL_PATCH);
/* Add the I/O (data) channel */
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &dpt_cdevsw, NULL);
/* Add the Control (IOCTL) channel */
dev = makedev(CDEV_MAJOR, SCSI_CONTROL_MASK);
cdevsw_add(&dev, &dpt_cdevsw, NULL);
cdevsw_add(&dpt_cdevsw);
dpt_devsw_installed = 1;
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: fb.c,v 1.3 1999/01/19 11:31:10 yokota Exp $
* $Id: fb.c,v 1.4 1999/05/30 16:51:23 phk Exp $
*/
#include "fb.h"
@ -311,11 +311,9 @@ static void
vfbattach(void *arg)
{
static int fb_devsw_installed = FALSE;
dev_t dev;
if (!fb_devsw_installed) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &fb_cdevsw, NULL);
cdevsw_add(&fb_cdevsw);
fb_devsw_installed = TRUE;
}
}

View File

@ -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.10 1999/05/09 13:00:35 phk Exp $
* $Id: iic.c,v 1.11 1999/05/30 16:51:28 phk Exp $
*
*/
#include <sys/param.h>
@ -121,6 +121,10 @@ static int
iic_probe(device_t dev)
{
struct iic_softc *sc = (struct iic_softc *)device_get_softc(dev);
static int once;
if (!once++)
cdevsw_add(&iic_cdevsw);
sc->sc_addr = iicbus_get_addr(dev);
@ -279,21 +283,5 @@ iicioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return (error);
}
static int iic_devsw_installed = 0;
static void
iic_drvinit(void *unused)
{
dev_t dev;
if( ! iic_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&iic_cdevsw,NULL);
iic_devsw_installed = 1;
}
}
DEV_DRIVER_MODULE(iic, iicbus, iic_driver, iic_devclass, CDEV_MAJOR,
NOMAJ, iic_cdevsw, 0, 0);
SYSINIT(iicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,iic_drvinit,NULL)

View File

@ -120,6 +120,10 @@ static int get_tick __P((void));
static int
joyprobe (struct isa_device *dev)
{
static int once;
if (!once++)
cdevsw_add(&joy_cdevsw);
#ifdef WANT_JOYSTICK_CONNECTED
outb (dev->id_iobase, 0xff);
DELAY (10000); /* 10 ms delay */
@ -251,22 +255,6 @@ get_tick ()
return (high << 8) | low;
}
static int joy_devsw_installed;
static void joy_drvinit(void *unused)
{
dev_t dev;
if( ! joy_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&joy_cdevsw,NULL);
joy_devsw_installed = 1;
}
}
SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL)
#ifdef JOY_MODULE
#include <sys/exec.h>

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: kbd.c,v 1.7 1999/05/30 14:55:24 phk Exp $
* $Id: kbd.c,v 1.8 1999/05/30 16:51:31 phk Exp $
*/
#include "kbd.h"
@ -431,11 +431,9 @@ static void
vkbdattach(void *arg)
{
static int kbd_devsw_installed = FALSE;
dev_t dev;
if (!kbd_devsw_installed) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &kbd_cdevsw, NULL);
cdevsw_add(&kbd_cdevsw);
kbd_devsw_installed = TRUE;
}
}

View File

@ -40,7 +40,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: mcd.c,v 1.106 1999/05/08 07:02:30 phk Exp $
* $Id: mcd.c,v 1.107 1999/05/30 16:52:19 phk Exp $
*/
static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@ -756,6 +756,10 @@ mcd_probe(struct isa_device *dev)
int unit = dev->id_unit;
int i, j;
unsigned char stbytes[3];
static int once;
if (!once++)
cdevsw_add(&mcd_cdevsw);
mcd_data[unit].flags = MCDPROBING;
@ -1856,19 +1860,4 @@ mcd_resume(int unit)
return mcd_play(unit, &cd->lastpb);
}
static int mcd_devsw_installed;
static void mcd_drvinit(void *unused)
{
if( ! mcd_devsw_installed ) {
cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &mcd_cdevsw);
mcd_devsw_installed = 1;
}
}
SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL)
#endif /* NMCD > 0 */

View File

@ -11,7 +11,7 @@
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* $Id: mse.c,v 1.42 1999/05/06 18:44:02 peter Exp $
* $Id: mse.c,v 1.43 1999/05/30 16:52:20 phk Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@ -248,7 +248,10 @@ mseprobe(idp)
{
register struct mse_softc *sc = &mse_sc[idp->id_unit];
register int i;
static int once;
if (!once++)
cdevsw_add(&mse_cdevsw);
/*
* Check for each mouse type in the table.
*/
@ -788,20 +791,4 @@ mse_getati(port, dx, dy, but)
outb(port + MSE_PORTB, MSE_INPORT_INTREN);
}
static int mse_devsw_installed;
static void mse_drvinit(void *unused)
{
dev_t dev;
if( ! mse_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&mse_cdevsw, NULL);
mse_devsw_installed = 1;
}
}
SYSINIT(msedev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mse_drvinit,NULL)
#endif /* NMSE */

View File

@ -352,7 +352,11 @@ xe_memwrite(struct pccard_devinfo *devi, off_t offset, u_char byte)
uios.uio_rw = UIO_WRITE;
uios.uio_procp = 0;
#if 0 /* THIS IS BOGUS */
return cdevsw[CARD_MAJOR]->d_write(makedev(CARD_MAJOR, devi->slt->slotnum), &uios, 0);
#else
return (-1);
#endif
}
@ -373,7 +377,11 @@ xe_memread(struct pccard_devinfo *devi, off_t offset, u_char *buf, int size)
uios.uio_rw = UIO_READ;
uios.uio_procp = 0;
#if 0 /* THIS IS BOGUS */
return cdevsw[CARD_MAJOR]->d_read(makedev(CARD_MAJOR, devi->slt->slotnum), &uios, 0);
#else
return (-1);
#endif
}

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: pci.c,v 1.105 1999/05/30 10:54:31 dfr Exp $
* $Id: pci.c,v 1.106 1999/05/30 16:53:36 phk Exp $
*
*/
@ -875,10 +875,7 @@ static void *pci_devfs_token;
static void
pci_cdevinit(void *dummy)
{
dev_t dev;
dev = makedev(PCI_CDEV, 0);
cdevsw_add(&dev, &pcicdev, NULL);
cdevsw_add(&pcicdev);
#ifdef DEVFS
pci_devfs_token = devfs_add_devswf(&pcicdev, 0, DV_CHR,
UID_ROOT, GID_WHEEL, 0644, "pci");

View File

@ -48,7 +48,7 @@
* from: unknown origin, 386BSD 0.1
* From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp
* From Id: nlpt.c,v 1.14 1999/02/08 13:55:43 des Exp
* $Id: lpt.c,v 1.3 1999/04/28 10:51:35 dt Exp $
* $Id: lpt.c,v 1.4 1999/05/30 16:51:34 phk Exp $
*/
/*
@ -363,6 +363,10 @@ static struct ppb_device *
lptprobe(struct ppb_data *ppb)
{
struct lpt_data *sc;
static int once;
if (!once++)
cdevsw_add(&lpt_cdevsw);
sc = (struct lpt_data *) malloc(sizeof(struct lpt_data),
M_TEMP, M_NOWAIT);
@ -954,19 +958,3 @@ lptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return(error);
}
static int lpt_devsw_installed;
static void
lpt_drvinit(void *unused)
{
dev_t dev;
if( ! lpt_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&lpt_cdevsw, NULL);
lpt_devsw_installed = 1;
}
}
SYSINIT(lptdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,lpt_drvinit,NULL)

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ppi.c,v 1.13 1999/04/28 10:51:39 dt Exp $
* $Id: ppi.c,v 1.14 1999/05/30 16:51:35 phk Exp $
*
*/
#include "ppi.h"
@ -146,6 +146,10 @@ static struct ppb_device *
ppiprobe(struct ppb_data *ppb)
{
struct ppi_data *ppi;
static int once;
if (!once++)
cdevsw_add(&ppi_cdevsw);
ppi = (struct ppi_data *) malloc(sizeof(struct ppi_data),
M_TEMP, M_NOWAIT);
@ -547,19 +551,4 @@ ppiioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return (error);
}
static int ppi_devsw_installed;
static void ppi_drvinit(void *unused)
{
dev_t dev;
if (!ppi_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &ppi_cdevsw, NULL);
ppi_devsw_installed = 1;
}
}
SYSINIT(ppidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ppi_drvinit,NULL)
#endif /* NPPI */

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: pps.c,v 1.17 1999/05/06 22:03:14 peter Exp $
* $Id: pps.c,v 1.18 1999/05/30 16:51:36 phk Exp $
*
* This driver implements a draft-mogul-pps-api-02.txt PPS source.
*
@ -87,6 +87,10 @@ static struct ppb_device *
ppsprobe(struct ppb_data *ppb)
{
struct pps_data *sc;
static int once;
if (!once++)
cdevsw_add(&pps_cdevsw);
sc = (struct pps_data *) malloc(sizeof(struct pps_data),
M_TEMP, M_NOWAIT);
@ -113,7 +117,6 @@ ppsprobe(struct ppb_data *ppb)
static int
ppsattach(struct ppb_device *dev)
{
dev_t devt;
/*
* Report ourselves
@ -126,8 +129,6 @@ ppsattach(struct ppb_device *dev)
dev->id_unit, DV_CHR,
UID_ROOT, GID_WHEEL, 0600, PPS_NAME "%d", dev->id_unit);
#endif
devt = makedev(CDEV_MAJOR, 0);
cdevsw_add(&devt, &pps_cdevsw, NULL);
return (1);
}

View File

@ -213,6 +213,10 @@ rcprobe(dvp)
{
int irq = ffs(dvp->id_irq) - 1;
register int nec = dvp->id_iobase;
static int once;
if (!once++)
cdevsw_add(&rc_cdevsw);
if (dvp->id_unit > NRC)
return 0;
@ -1510,20 +1514,4 @@ rc_wait0(nec, unit, chan, line)
unit, chan, line);
}
static int rc_devsw_installed;
static void rc_drvinit(void *unused)
{
dev_t dev;
if( ! rc_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&rc_cdevsw, NULL);
rc_devsw_installed = 1;
}
}
SYSINIT(rcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,rc_drvinit,NULL)
#endif /* NRC */

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: rp.c,v 1.26 1999/05/09 17:07:20 peter Exp $
* $Id: rp.c,v 1.27 1999/05/30 16:52:22 phk Exp $
*/
/*
@ -1085,7 +1085,6 @@ struct isa_device *dev;
static void
rp_pciattach(pcici_t tag, int unit)
{
dev_t rp_dev;
int success, oldspl;
u_short iobase;
int num_ports, num_chan, num_aiops;
@ -1140,8 +1139,7 @@ rp_pciattach(pcici_t tag, int unit)
rp_addr(unit) = rp;
splx(oldspl);
rp_dev = makedev(CDEV_MAJOR, unit);
cdevsw_add(&rp_dev, &rp_cdevsw, NULL);
cdevsw_add(&rp_cdevsw);
port = 0;
for(aiop=0; aiop < num_aiops; aiop++) {
@ -1196,7 +1194,6 @@ int
rpattach(dev)
struct isa_device *dev;
{
dev_t rp_dev;
int iobase, unit, /*rpmajor,*/ oldspl;
int num_ports, num_chan, num_aiops;
int aiop, chan, port;
@ -1252,8 +1249,7 @@ struct isa_device *dev;
rp_addr(unit) = rp;
splx(oldspl);
rp_dev = makedev(CDEV_MAJOR, unit);
cdevsw_add(&rp_dev, &rp_cdevsw, NULL);
cdevsw_add(&rp_cdevsw);
port = 0;
for(aiop=0; aiop < num_aiops; aiop++) {

View File

@ -41,7 +41,7 @@
*/
/* $Id: scd.c,v 1.45 1999/05/09 20:29:04 phk Exp $ */
/* $Id: scd.c,v 1.46 1999/05/30 16:52:24 phk Exp $ */
/* Please send any comments to micke@dynas.se */
@ -718,6 +718,10 @@ scd_probe(struct isa_device *dev)
static char namebuf[8+16+8+3];
char *s = namebuf;
int loop_count = 0;
static int once;
if (!once++)
cdevsw_add(&scd_cdevsw);
scd_data[unit].flags = SCDPROBING;
scd_data[unit].iobase = dev->id_iobase;
@ -1574,19 +1578,4 @@ scd_toc_entry (int unit, struct ioc_read_toc_single_entry *te)
return 0;
}
static int scd_devsw_installed;
static void scd_drvinit(void *unused)
{
if( ! scd_devsw_installed ) {
cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_cdevsw);
scd_devsw_installed = 1;
}
}
SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL)
#endif /* NSCD > 0 */

View File

@ -30,7 +30,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHORS BE LIABLE.
*
* $Id: si.c,v 1.85 1999/05/09 17:07:21 peter Exp $
* $Id: si.c,v 1.86 1999/05/30 16:52:25 phk Exp $
*/
#ifndef lint
@ -2832,13 +2832,8 @@ static int si_devsw_installed;
static void
si_drvinit(void *unused)
{
dev_t dev;
if (!si_devsw_installed) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&si_cdevsw, NULL);
si_devsw_installed = 1;
}
cdevsw_add(&si_cdevsw);
}
SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,si_drvinit,NULL)

View File

@ -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.11 1999/05/09 13:00:37 phk Exp $
* $Id: smb.c,v 1.12 1999/05/30 16:51:37 phk Exp $
*
*/
#include <sys/param.h>
@ -122,6 +122,10 @@ static int
smb_probe(device_t dev)
{
struct smb_softc *sc = (struct smb_softc *)device_get_softc(dev);
static int once;
if (!once++)
cdevsw_add(&smb_cdevsw);
sc->sc_addr = smbus_get_addr(dev);
@ -272,21 +276,5 @@ smbioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return (error);
}
static int smb_devsw_installed = 0;
static void
smb_drvinit(void *unused)
{
dev_t dev;
if( ! smb_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&smb_cdevsw,NULL);
smb_devsw_installed = 1;
}
}
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)

View File

@ -83,11 +83,7 @@ snpdevtotty (dev)
dev_t dev;
{
struct cdevsw *cdp;
int maj;
maj = major(dev);
if ((u_int)maj >= nchrdev)
return (NULL);
cdp = devsw(dev);
if (cdp == NULL)
return (NULL);
@ -533,14 +529,12 @@ static void
snp_drvinit(unused)
void *unused;
{
dev_t dev;
#ifdef DEVFS
int i;
#endif
if( ! snp_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&snp_cdevsw, NULL);
cdevsw_add(&snp_cdevsw);
snp_devsw_installed = 1;
#ifdef DEVFS
for ( i = 0 ; i < NSNP ; i++) {

View File

@ -4,7 +4,7 @@
* v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
* modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
*
* $Id: spkr.c,v 1.35 1998/08/24 02:28:16 bde Exp $
* $Id: spkr.c,v 1.36 1999/05/30 16:52:27 phk Exp $
*/
#include "speaker.h"
@ -601,24 +601,14 @@ spkrioctl(dev, cmd, cmdarg, flags, p)
return(EINVAL);
}
static int spkr_devsw_installed;
static void
spkr_drvinit(void *unused)
{
dev_t dev;
if( ! spkr_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&spkr_cdevsw, NULL);
spkr_devsw_installed = 1;
cdevsw_add(&spkr_cdevsw);
#ifdef DEVFS
devfs_token = devfs_add_devswf(&spkr_cdevsw, 0, DV_CHR,
UID_ROOT, GID_WHEEL, 0600,
"speaker");
devfs_token = devfs_add_devswf(&spkr_cdevsw, 0, DV_CHR,
UID_ROOT, GID_WHEEL, 0600, "speaker");
#endif
}
}
SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL)

View File

@ -152,21 +152,14 @@ typedef struct streams_softc *sc_p;
static sc_p sca[NSTREAMS];
static void
streamsattach(void *dummy)
{
cdevsw_add_generic(CDEV_MAJOR, CDEV_MAJOR, &streams_cdevsw);
}
static int
streams_modevent(module_t mod, int type, void *unused)
{
switch (type) {
case MOD_LOAD:
streamsattach(NULL);
cdevsw_add(&streams_cdevsw);
return 0;
case MOD_UNLOAD:
cdevsw[CDEV_MAJOR] = NULL; /* clean up cdev */
return 0;
default:
break;
@ -394,12 +387,10 @@ svr4_soo_close(struct file *fp, struct proc *p)
static void
streams_drvinit(void *unused)
{
dev_t dev;
int unit;
sc_p scp = sca[unit];
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &streams_cdevsw, NULL);
cdevsw_add(&streams_cdevsw);
for (unit = 0; unit < NSTREAMS; unit++) {
/*
* Allocate storage for this instance .

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: syscons.c,v 1.303 1999/05/12 04:45:56 bde Exp $
* $Id: syscons.c,v 1.304 1999/05/30 16:51:42 phk Exp $
*/
#include "sc.h"
@ -574,7 +574,6 @@ sc_attach_unit(int unit, int flags)
#if defined(VESA) && defined(VM86)
video_info_t info;
#endif
dev_t cdev = makedev(CDEV_MAJOR, 0);
#ifdef DEVFS
int vc;
#endif
@ -661,7 +660,7 @@ sc_attach_unit(int unit, int flags)
at_shutdown(scshutdown, NULL, SHUTDOWN_PRE_SYNC);
cdevsw_add(&cdev, &sc_cdevsw, NULL);
cdevsw_add(&sc_cdevsw);
#ifdef DEVFS
for (vc = 0; vc < MAXCONS; vc++)

View File

@ -965,17 +965,13 @@ static int usbd_global_init_done = 0;
void
usbd_init()
{
#if defined(__FreeBSD__)
dev_t dev;
#endif
if (!usbd_global_init_done) {
usbd_global_init_done = 1;
SIMPLEQ_INIT(&usbd_free_requests);
#if defined(__FreeBSD__)
dev = makedev(USB_CDEV_MAJOR, 0);
cdevsw_add(&dev, &usb_cdevsw, NULL);
cdevsw_add(&usb_cdevsw);
#endif
}
}

View File

@ -352,7 +352,11 @@ xe_memwrite(struct pccard_devinfo *devi, off_t offset, u_char byte)
uios.uio_rw = UIO_WRITE;
uios.uio_procp = 0;
#if 0 /* THIS IS BOGUS */
return cdevsw[CARD_MAJOR]->d_write(makedev(CARD_MAJOR, devi->slt->slotnum), &uios, 0);
#else
return (-1);
#endif
}
@ -373,7 +377,11 @@ xe_memread(struct pccard_devinfo *devi, off_t offset, u_char *buf, int size)
uios.uio_rw = UIO_READ;
uios.uio_procp = 0;
#if 0 /* THIS IS BOGUS */
return cdevsw[CARD_MAJOR]->d_read(makedev(CARD_MAJOR, devi->slt->slotnum), &uios, 0);
#else
return (-1);
#endif
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
* $Id: cd9660_vfsops.c,v 1.54 1999/05/07 10:10:46 phk Exp $
* $Id: cd9660_vfsops.c,v 1.55 1999/05/08 06:39:32 phk Exp $
*/
#include <sys/param.h>
@ -225,8 +225,7 @@ cd9660_mount(mp, path, data, ndp, p)
vrele(devvp);
return ENOTBLK;
}
if (major(devvp->v_rdev) >= nblkdev ||
bdevsw(devvp->v_rdev) == NULL) {
if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return ENXIO;
}

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_fbsd.c,v 1.13 1999/01/28 00:57:46 dillon Exp $
* $Id: coda_fbsd.c,v 1.14 1999/05/30 16:51:10 phk Exp $
*
*/
@ -101,7 +101,6 @@ int vcdebug = 1;
static int
codadev_modevent(module_t mod, int type, void *data)
{
dev_t dev;
#ifdef DEVFS
int i;
#endif
@ -109,8 +108,7 @@ codadev_modevent(module_t mod, int type, void *data)
switch (type) {
case MOD_LOAD:
dev = makedev(VC_DEV_NO, 0);
cdevsw_add(&dev,&codadevsw, &oldcdevsw);
cdevsw_add(&codadevsw);
#ifdef DEVFS
/* tmp */
#undef NVCODA
@ -134,7 +132,7 @@ codadev_modevent(module_t mod, int type, void *data)
devfs_remove_dev(coda_devfs_token[i]);
}
#endif
cdevsw_add(&dev, oldcdevsw, NULL);
cdevsw_add(oldcdevsw);
break;
default:
break;

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_vfsops.c,v 1.12 1999/05/08 06:39:04 phk Exp $
* $Id: coda_vfsops.c,v 1.13 1999/05/09 13:11:37 phk Exp $
*
*/
@ -47,6 +47,9 @@
/*
* HISTORY
* $Log: coda_vfsops.c,v $
* Revision 1.13 1999/05/09 13:11:37 phk
* remove cast from dev_t to dev_t.
*
* Revision 1.12 1999/05/08 06:39:04 phk
* I got tired of seeing all the cdevsw[major(foo)] all over the place.
*
@ -341,10 +344,6 @@ coda_mount(vfsp, path, data, ndp, p)
}
dev = dvp->v_specinfo->si_rdev;
vrele(dvp);
if (major(dev) >= nchrdev || major(dev) < 0) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
return(ENXIO);
}
/*
* See if the device table matches our expectations.

View File

@ -35,7 +35,7 @@
*
* @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94
*
* $Id: fdesc_vnops.c,v 1.40 1998/12/14 05:00:57 dillon Exp $
* $Id: fdesc_vnops.c,v 1.41 1999/01/27 22:42:06 dillon Exp $
*/
/*
@ -105,7 +105,7 @@ fdesc_init(vfsp)
struct vfsconf *vfsp;
{
devctty = makedev(nchrdev, 0);
devctty = NODEV;
fdhashtbl = hashinit(NFDCACHE, M_CACHE, &fdhash);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $Id: msdosfs_vfsops.c,v 1.43 1999/05/07 10:11:10 phk Exp $ */
/* $Id: msdosfs_vfsops.c,v 1.44 1999/05/08 06:40:00 phk Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */
/*-
@ -298,8 +298,7 @@ msdosfs_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
if (major(devvp->v_rdev) >= nblkdev ||
bdevsw(devvp->v_rdev) == NULL) {
if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return (ENXIO);
}

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ntfs_vfsops.c,v 1.5 1999/05/11 19:54:52 phk Exp $
* $Id: ntfs_vfsops.c,v 1.6 1999/05/12 09:43:04 semenu Exp $
*/
@ -296,7 +296,7 @@ ntfs_mount (
err = ENOTBLK;
goto error_2;
}
if (major(devvp->v_rdev) >= nblkdev) {
if (bdevsw(devvp->v_rdev) == NULL) {
err = ENXIO;
goto error_2;
}

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
* $Id: spec_vnops.c,v 1.85 1999/05/08 06:39:55 phk Exp $
* $Id: spec_vnops.c,v 1.86 1999/05/11 19:54:38 phk Exp $
*/
#include <sys/param.h>
@ -176,8 +176,6 @@ spec_open(ap)
switch (vp->v_type) {
case VCHR:
if ((u_int)maj >= nchrdev)
return (ENXIO);
dsw = devsw(dev);
if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
@ -214,8 +212,6 @@ spec_open(ap)
return (error);
/* NOT REACHED */
case VBLK:
if ((u_int)maj >= nblkdev)
return (ENXIO);
dsw = bdevsw(dev);
if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;

View File

@ -276,8 +276,7 @@ ext2_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
if (major(devvp->v_rdev) >= nblkdev ||
bdevsw(devvp->v_rdev) == NULL) {
if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return (ENXIO);
}

View File

@ -276,8 +276,7 @@ ext2_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
if (major(devvp->v_rdev) >= nblkdev ||
bdevsw(devvp->v_rdev) == NULL) {
if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return (ENXIO);
}

View File

@ -1,5 +1,5 @@
/*-
* dgb.c $Id: dgb.c,v 1.48 1999/05/08 07:02:24 phk Exp $
* dgb.c $Id: dgb.c,v 1.49 1999/05/30 16:51:56 phk Exp $
*
* Digiboard driver.
*
@ -425,7 +425,10 @@ dgbprobe(dev)
int i, v;
u_long win_size; /* size of vizible memory window */
int unit=dev->id_unit;
static int once;
if (!once++)
cdevsw_add(&dgb_cdevsw);
sc->unit=dev->id_unit;
sc->port=dev->id_iobase;
@ -2301,21 +2304,4 @@ disc_optim(tp, t)
tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
}
static int dgb_devsw_installed;
static void
dgb_drvinit(void *unused)
{
dev_t dev;
if( ! dgb_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&dgb_cdevsw, NULL);
dgb_devsw_installed = 1;
}
}
SYSINIT(dgbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgb_drvinit,NULL)
#endif /* NDGB > 0 */

View File

@ -1,5 +1,5 @@
/*-
* $Id: dgm.c,v 1.13 1999/05/08 07:02:25 phk Exp $
* $Id: dgm.c,v 1.14 1999/05/30 16:51:58 phk Exp $
*
* This driver and the associated header files support the ISA PC/Xem
* Digiboards. Its evolutionary roots are described below.
@ -397,6 +397,10 @@ dgmprobe(dev)
struct dgm_softc *sc= &dgm_softc[dev->id_unit];
int i, v;
int unit=dev->id_unit;
static int once;
if (!once++)
cdevsw_add(&dgm_cdevsw);
sc->unit=dev->id_unit;
sc->port=dev->id_iobase;
@ -2105,21 +2109,4 @@ disc_optim(tp, t)
tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
}
static int dgm_devsw_installed;
static void
dgm_drvinit(void *unused)
{
dev_t dev;
if( ! dgm_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&dgm_cdevsw, NULL);
dgm_devsw_installed = 1;
}
}
SYSINIT(dgmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgm_drvinit,NULL)
#endif /* NDGM > 0 */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.122 1999/05/12 07:40:50 phk Exp $
* $Id: autoconf.c,v 1.123 1999/05/24 00:30:49 jb Exp $
*/
/*
@ -156,7 +156,7 @@ find_cdrom_root()
orootdev = rootdev;
for (i = 0 ; i < 2; i++)
for (j = 0 ; try_cdrom[j].name ; j++) {
if (try_cdrom[j].major >= nblkdev)
if (try_cdrom[j].major >= NUMCDEVSW)
continue;
rootdev = makedev(try_cdrom[j].major, i * 8);
bd = bdevsw(rootdev);
@ -382,7 +382,7 @@ setdumpdev(dev)
return (0);
}
maj = major(dev);
if (maj >= nblkdev || bdevsw(dev) == NULL)
if (bdevsw(dev) == NULL)
return (ENXIO); /* XXX is this right? */
if (bdevsw(dev)->d_psize == NULL)
return (ENXIO); /* XXX should be ENODEV ? */
@ -435,7 +435,7 @@ setroot()
return;
majdev = B_TYPE(bootdev);
dev = makedev(majdev, 0);
if (majdev >= nblkdev || bdevsw(dev) == NULL)
if (bdevsw(dev) == NULL)
return;
unit = B_UNIT(bootdev);
slice = B_SLICE(bootdev);
@ -523,7 +523,7 @@ setrootbyname(char *name)
}
unit = *cp - '0';
*cp++ = '\0';
for (bd = 0; bd < nblkdev; bd++) {
for (bd = 0; bd < NUMCDEVSW; bd++) {
dev = makedev(bd, 0);
if (bdevsw(dev) != NULL &&
strcmp(bdevsw(dev)->d_name, name) == 0)
@ -566,7 +566,7 @@ setconf()
return;
printf("use one of:\n");
for (i = 0; i < nblkdev; i++) {
for (i = 0; i < NUMCDEVSW; i++) {
dev = makedev(i, 0);
if (bdevsw(dev) != NULL)
printf(" %s", bdevsw(dev)->d_name);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
* $Id: cons.c,v 1.65 1999/05/08 06:39:20 phk Exp $
* $Id: cons.c,v 1.66 1999/05/30 16:52:03 phk Exp $
*/
#include "opt_devfs.h"
@ -433,11 +433,9 @@ static int cn_devsw_installed;
static void
cn_drvinit(void *unused)
{
dev_t dev;
if( ! cn_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&cn_cdevsw,NULL);
cdevsw_add(&cn_cdevsw);
cn_devsw_installed = 1;
#ifdef DEVFS
cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR,

View File

@ -38,7 +38,7 @@
*
* from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
* $Id: mem.c,v 1.61 1999/05/11 19:54:06 phk Exp $
* $Id: mem.c,v 1.62 1999/05/30 16:52:04 phk Exp $
*/
/*
@ -668,7 +668,6 @@ static int mem_devsw_installed;
static void
mem_drvinit(void *unused)
{
dev_t dev;
/* Initialise memory range handling */
if (mem_range_softc.mr_op != NULL)
@ -676,9 +675,7 @@ mem_drvinit(void *unused)
/* device registration */
if( ! mem_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&mem_cdevsw, NULL);
cdevsw_add(&mem_cdevsw);
mem_devsw_installed = 1;
#ifdef DEVFS
memdevfs_init();

View File

@ -34,7 +34,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* $Id: asc.c,v 1.36 1999/05/06 18:12:24 peter Exp $
* $Id: asc.c,v 1.37 1999/05/30 16:52:07 phk Exp $
*/
#include "asc.h"
@ -379,6 +379,10 @@ ascprobe (struct isa_device *isdp)
int unit = isdp->id_unit;
struct asc_unit *scu = unittab + unit;
int stb;
static int once;
if (!once++)
cdevsw_add(&asc_cdevsw);
scu->base = isdp->id_iobase; /*** needed by the following macros ***/
scu->flags = FLAG_DEBUG;
@ -899,22 +903,4 @@ ascpoll(dev_t dev, int events, struct proc *p)
return 0;
}
static int asc_devsw_installed;
static void
asc_drvinit(void *unused)
{
dev_t dev;
if( ! asc_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&asc_cdevsw,NULL);
asc_devsw_installed = 1;
}
}
SYSINIT(ascdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,asc_drvinit,NULL)
#endif /* NASC > 0 */

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: atapi-cd.c,v 1.18 1999/05/11 10:39:27 sos Exp $
* $Id: atapi-cd.c,v 1.19 1999/05/30 16:52:08 phk Exp $
*/
#include "wdc.h"
@ -1496,15 +1496,10 @@ atapi_dump(int ctrlr, int lun, char *label, void *data, int len)
printf ("\n");
}
static int acd_devsw_installed;
static void
acd_drvinit(void *unused)
{
if (!acd_devsw_installed) {
cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &acd_cdevsw);
acd_devsw_installed = 1;
}
cdevsw_add(&acd_cdevsw);
}
SYSINIT(acddev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE + CDEV_MAJOR, acd_drvinit, NULL)

View File

@ -8,7 +8,7 @@
* of this software, nor does the author assume any responsibility
* for damages incurred with its use.
*
* $Id: ctx.c,v 1.30 1999/04/28 10:52:19 dt Exp $
* $Id: ctx.c,v 1.31 1999/05/30 16:52:09 phk Exp $
*/
/*
@ -192,7 +192,10 @@ static int
ctxprobe(struct isa_device * devp)
{
int status;
static int once;
if (!once++)
cdevsw_add(&ctx_cdevsw);
if (inb(devp->id_iobase) == 0xff) /* 0xff only if board absent */
status = 0;
else {
@ -463,23 +466,4 @@ waitvb(int port)
return (0);
}
static int ctx_devsw_installed;
static void
ctx_drvinit(void *unused)
{
dev_t dev;
if( ! ctx_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&ctx_cdevsw,NULL);
ctx_devsw_installed = 1;
}
}
SYSINIT(ctxdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ctx_drvinit,NULL)
#endif /* NCTX > 0 */

View File

@ -981,13 +981,8 @@ void cxtimeout (void *a)
static int cx_devsw_installed;
static void cx_drvinit(void *unused)
{
dev_t dev;
if( ! cx_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&cx_cdevsw,NULL);
cx_devsw_installed = 1;
}
cdevsw_add(&cx_cdevsw);
}
SYSINIT(cxdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cx_drvinit,NULL)

View File

@ -27,7 +27,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: cy.c,v 1.88 1999/05/28 13:23:21 bde Exp $
* $Id: cy.c,v 1.89 1999/05/30 16:52:11 phk Exp $
*/
#include "opt_compat.h"
@ -541,7 +541,6 @@ cyattach_common(cy_iobase, cy_align)
{
int adapter;
int cyu;
dev_t dev;
u_char firmware_version;
cy_addr iobase;
int ncyu;
@ -633,8 +632,7 @@ cyattach_common(cy_iobase, cy_align)
splx(s);
if (!sio_registered) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &sio_cdevsw, NULL);
cdevsw_add(&sio_cdevsw);
register_swi(SWI_TTY, siopoll);
sio_registered = TRUE;
}

View File

@ -123,7 +123,10 @@ gpprobe(struct isa_device *dvp)
{
int status;
struct gpib_softc *sc = &gpib_sc;
static int once;
if (!once++)
cdevsw_add(&gp_cdevsw);
gpib_port = dvp->id_iobase;
status=1;
@ -1175,22 +1178,4 @@ outb(CDOR,95); /*untalk*/
}
static int gp_devsw_installed;
static void
gp_drvinit(void *unused)
{
dev_t dev;
if( ! gp_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&gp_cdevsw, NULL);
gp_devsw_installed = 1;
}
}
SYSINIT(gpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,gp_drvinit,NULL)
#endif /* NGPIB > 0 */

View File

@ -402,6 +402,10 @@ gscprobe (struct isa_device *isdp)
struct gsc_unit *scu = unittab + unit;
int stb;
struct gsc_geom geom = NEW_GEOM;
static int once;
if (!once++)
cdevsw_add(&gsc_cdevsw);
scu->flags = FLAG_DEBUG;
@ -849,22 +853,4 @@ gscioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
}
}
static int gsc_devsw_installed;
static void
gsc_drvinit(void *unused)
{
dev_t dev;
if( ! gsc_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&gsc_cdevsw, NULL);
gsc_devsw_installed = 1;
}
}
SYSINIT(gscdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,gsc_drvinit,NULL)
#endif /* NGSC > 0 */

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: ida.c,v 1.1 1999/05/25 19:45:17 julian Exp $
*
*/
@ -1733,7 +1733,7 @@ static void
id_drvinit(void *unused)
{
if( ! id_devsw_installed ) {
cdevsw_add_generic(ID_BDMAJ,ID_CDMAJ, &id_cdevsw);
cdevsw_add(&id_cdevsw);
id_devsw_installed = 1;
}
}

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: istallion.c,v 1.27 1999/05/08 07:02:29 phk Exp $
* $Id: istallion.c,v 1.28 1999/05/30 16:52:16 phk Exp $
*/
/*****************************************************************************/
@ -662,21 +662,6 @@ static struct cdevsw stli_cdevsw = {
/* bmaj */ -1
};
static int stli_devsw_installed;
static void stli_drvinit(void *unused)
{
dev_t dev;
if (! stli_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &stli_cdevsw, NULL);
stli_devsw_installed = 1;
}
}
SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,stli_drvinit,NULL)
#endif
/*****************************************************************************/
@ -835,6 +820,10 @@ static int stliprobe(struct isa_device *idp)
{
stlibrd_t *brdp;
int btype, bclass;
static int once;
if (!once++)
cdevsw_add(&stli_cdevsw);
#if DEBUG
printf("stliprobe(idp=%x): unit=%d iobase=%x flags=%x\n", (int) idp,

View File

@ -120,6 +120,10 @@ static int get_tick __P((void));
static int
joyprobe (struct isa_device *dev)
{
static int once;
if (!once++)
cdevsw_add(&joy_cdevsw);
#ifdef WANT_JOYSTICK_CONNECTED
outb (dev->id_iobase, 0xff);
DELAY (10000); /* 10 ms delay */
@ -251,22 +255,6 @@ get_tick ()
return (high << 8) | low;
}
static int joy_devsw_installed;
static void joy_drvinit(void *unused)
{
dev_t dev;
if( ! joy_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&joy_cdevsw,NULL);
joy_devsw_installed = 1;
}
}
SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL)
#ifdef JOY_MODULE
#include <sys/exec.h>

View File

@ -417,6 +417,7 @@ labpcinit(void)
bzero(labpcs, NLABPC * sizeof(struct ctlr *));
return 1;
}
cdevsw_add(&labpc_cdevsw);
return 0;
}
@ -1099,21 +1100,3 @@ labpcioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc *p)
return ENOTTY;
}
}
static int labpc_devsw_installed = 0;
static void labpc_drvinit(void *unused)
{
dev_t dev;
if( ! labpc_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&labpc_cdevsw,NULL);
labpc_devsw_installed = 1;
}
}
SYSINIT(labpcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,labpc_drvinit,NULL)

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: loran.c,v 1.18 1999/05/08 14:36:48 phk Exp $
* $Id: loran.c,v 1.19 1999/05/30 16:52:19 phk Exp $
*
* This device-driver helps the userland controlprogram for a LORAN-C
* receiver avoid monopolizing the CPU.
@ -196,6 +196,8 @@ struct datapoint {
/**********************************************************************/
extern struct cdevsw loran_cdevsw;
static dphead_t minors[NLORAN], working, holding;
static struct datapoint dummy[NDUMMY];
@ -233,6 +235,10 @@ extern struct timecounter loran_timecounter;
int
loranprobe(struct isa_device *dvp)
{
static int once;
if (!once++)
cdevsw_add(&loran_cdevsw);
/* We need to be a "fast-intr" */
dvp->id_ri_flags |= RI_FAST;
@ -657,20 +663,4 @@ static struct cdevsw loran_cdevsw = {
/* bmaj */ -1
};
static int loran_devsw_installed;
static void loran_drvinit(void *unused)
{
dev_t dev;
if(!loran_devsw_installed) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&loran_cdevsw, NULL);
loran_devsw_installed = 1;
}
}
SYSINIT(lorandev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,loran_drvinit,NULL)
#endif /* KERNEL */

View File

@ -337,7 +337,7 @@ static char MATCDVERSION[]="Version 1(26) 18-Oct-95";
static char MATCDCOPYRIGHT[] = "Matsushita CD-ROM driver, Copr. 1994,1995 Frank Durda IV";
/* The proceeding strings may not be changed*/
/* $Id: matcd.c,v 1.39 1999/05/07 07:03:36 phk Exp $ */
/* $Id: matcd.c,v 1.40 1999/05/30 16:52:35 phk Exp $ */
/*---------------------------------------------------------------------------
Include declarations
@ -1214,7 +1214,10 @@ matcd_probe(struct isa_device *dev)
int i,cdrive;
unsigned char y;
int port = dev->id_iobase; /*Take port hint from config file*/
static int once;
if (!once++)
cdevsw_add(&matcd_cdevsw);
cdrive=nextcontroller; /*Controller defined by pass for now*/
if (nextcontroller==NUMCTRLRS) {
printf("matcdc%d: - Too many interfaces specified in config\n",
@ -2737,21 +2740,5 @@ static int matcd_igot(struct ioc_capability * sqp)
audio are here*/
#endif /*FULLDRIVER*/
static int matcd_devsw_installed;
static void
matcd_drvinit(void *unused)
{
if( ! matcd_devsw_installed ) {
cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &matcd_cdevsw);
matcd_devsw_installed = 1;
}
}
SYSINIT(matcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,matcd_drvinit,NULL)
/*End of matcd.c*/

View File

@ -40,7 +40,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: mcd.c,v 1.106 1999/05/08 07:02:30 phk Exp $
* $Id: mcd.c,v 1.107 1999/05/30 16:52:19 phk Exp $
*/
static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@ -756,6 +756,10 @@ mcd_probe(struct isa_device *dev)
int unit = dev->id_unit;
int i, j;
unsigned char stbytes[3];
static int once;
if (!once++)
cdevsw_add(&mcd_cdevsw);
mcd_data[unit].flags = MCDPROBING;
@ -1856,19 +1860,4 @@ mcd_resume(int unit)
return mcd_play(unit, &cd->lastpb);
}
static int mcd_devsw_installed;
static void mcd_drvinit(void *unused)
{
if( ! mcd_devsw_installed ) {
cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &mcd_cdevsw);
mcd_devsw_installed = 1;
}
}
SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL)
#endif /* NMCD > 0 */

View File

@ -11,7 +11,7 @@
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* $Id: mse.c,v 1.42 1999/05/06 18:44:02 peter Exp $
* $Id: mse.c,v 1.43 1999/05/30 16:52:20 phk Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@ -248,7 +248,10 @@ mseprobe(idp)
{
register struct mse_softc *sc = &mse_sc[idp->id_unit];
register int i;
static int once;
if (!once++)
cdevsw_add(&mse_cdevsw);
/*
* Check for each mouse type in the table.
*/
@ -788,20 +791,4 @@ mse_getati(port, dx, dy, but)
outb(port + MSE_PORTB, MSE_INPORT_INTREN);
}
static int mse_devsw_installed;
static void mse_drvinit(void *unused)
{
dev_t dev;
if( ! mse_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&mse_cdevsw, NULL);
mse_devsw_installed = 1;
}
}
SYSINIT(msedev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mse_drvinit,NULL)
#endif /* NMSE */

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: pcaudio.c,v 1.48 1999/05/06 18:58:05 peter Exp $
* $Id: pcaudio.c,v 1.49 1999/05/30 16:52:21 phk Exp $
*/
#include "pca.h"
@ -204,6 +204,7 @@ pca_volume(int volume)
static void
pca_init(void)
{
cdevsw_add(&pca_cdevsw);
pca_status.open = 0;
pca_status.queries = 0;
pca_status.timer_on = 0;
@ -565,19 +566,4 @@ pcapoll(dev_t dev, int events, struct proc *p)
return (revents);
}
static int pca_devsw_installed;
static void pca_drvinit(void *unused)
{
dev_t dev;
if( ! pca_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&pca_cdevsw, NULL);
pca_devsw_installed = 1;
}
}
SYSINIT(pcadev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,pca_drvinit,NULL)
#endif

View File

@ -386,11 +386,7 @@ pcattach(struct isa_device *dev)
async_update(UPDATE_START); /* start asynchronous updates */
#if PCVT_FREEBSD > 205
{
dev_t dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &pc_cdevsw, NULL);
}
cdevsw_add(&pc_cdevsw);
#ifdef DEVFS
for(vt = 0; vt < MAXCONS; vt++) {

View File

@ -213,6 +213,10 @@ rcprobe(dvp)
{
int irq = ffs(dvp->id_irq) - 1;
register int nec = dvp->id_iobase;
static int once;
if (!once++)
cdevsw_add(&rc_cdevsw);
if (dvp->id_unit > NRC)
return 0;
@ -1510,20 +1514,4 @@ rc_wait0(nec, unit, chan, line)
unit, chan, line);
}
static int rc_devsw_installed;
static void rc_drvinit(void *unused)
{
dev_t dev;
if( ! rc_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&rc_cdevsw, NULL);
rc_devsw_installed = 1;
}
}
SYSINIT(rcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,rc_drvinit,NULL)
#endif /* NRC */

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: rp.c,v 1.26 1999/05/09 17:07:20 peter Exp $
* $Id: rp.c,v 1.27 1999/05/30 16:52:22 phk Exp $
*/
/*
@ -1085,7 +1085,6 @@ struct isa_device *dev;
static void
rp_pciattach(pcici_t tag, int unit)
{
dev_t rp_dev;
int success, oldspl;
u_short iobase;
int num_ports, num_chan, num_aiops;
@ -1140,8 +1139,7 @@ rp_pciattach(pcici_t tag, int unit)
rp_addr(unit) = rp;
splx(oldspl);
rp_dev = makedev(CDEV_MAJOR, unit);
cdevsw_add(&rp_dev, &rp_cdevsw, NULL);
cdevsw_add(&rp_cdevsw);
port = 0;
for(aiop=0; aiop < num_aiops; aiop++) {
@ -1196,7 +1194,6 @@ int
rpattach(dev)
struct isa_device *dev;
{
dev_t rp_dev;
int iobase, unit, /*rpmajor,*/ oldspl;
int num_ports, num_chan, num_aiops;
int aiop, chan, port;
@ -1252,8 +1249,7 @@ struct isa_device *dev;
rp_addr(unit) = rp;
splx(oldspl);
rp_dev = makedev(CDEV_MAJOR, unit);
cdevsw_add(&rp_dev, &rp_cdevsw, NULL);
cdevsw_add(&rp_cdevsw);
port = 0;
for(aiop=0; aiop < num_aiops; aiop++) {

View File

@ -41,7 +41,7 @@
*/
/* $Id: scd.c,v 1.45 1999/05/09 20:29:04 phk Exp $ */
/* $Id: scd.c,v 1.46 1999/05/30 16:52:24 phk Exp $ */
/* Please send any comments to micke@dynas.se */
@ -718,6 +718,10 @@ scd_probe(struct isa_device *dev)
static char namebuf[8+16+8+3];
char *s = namebuf;
int loop_count = 0;
static int once;
if (!once++)
cdevsw_add(&scd_cdevsw);
scd_data[unit].flags = SCDPROBING;
scd_data[unit].iobase = dev->id_iobase;
@ -1574,19 +1578,4 @@ scd_toc_entry (int unit, struct ioc_read_toc_single_entry *te)
return 0;
}
static int scd_devsw_installed;
static void scd_drvinit(void *unused)
{
if( ! scd_devsw_installed ) {
cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_cdevsw);
scd_devsw_installed = 1;
}
}
SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL)
#endif /* NSCD > 0 */

View File

@ -30,7 +30,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHORS BE LIABLE.
*
* $Id: si.c,v 1.85 1999/05/09 17:07:21 peter Exp $
* $Id: si.c,v 1.86 1999/05/30 16:52:25 phk Exp $
*/
#ifndef lint
@ -2832,13 +2832,8 @@ static int si_devsw_installed;
static void
si_drvinit(void *unused)
{
dev_t dev;
if (!si_devsw_installed) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&si_cdevsw, NULL);
si_devsw_installed = 1;
}
cdevsw_add(&si_cdevsw);
}
SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,si_drvinit,NULL)

View File

@ -340,10 +340,8 @@ pcminit(snddev_info *d, int unit)
#ifdef DEVFS
void *cookie;
#endif
dev_t isadev;
isadev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&isadev, &snd_cdevsw, NULL);
cdevsw_add(&snd_cdevsw);
/*
* initialize standard parameters for the device. This can be

View File

@ -507,12 +507,7 @@ sndattach(struct isa_device * dev)
sequencer_init();
}
{
dev_t dev;
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &snd_cdevsw, NULL);
}
cdevsw_add(&snd_cdevsw);
#ifdef DEVFS
#define GID_SND GID_GAMES
#define UID_SND UID_ROOT

View File

@ -131,6 +131,10 @@ spigot_probe(struct isa_device *devp)
{
int status;
struct spigot_softc *ss=(struct spigot_softc *)&spigot_softc[devp->id_unit];
static int once;
if (!once++)
cdevsw_add(&spigot_cdevsw);
ss->flags = 0;
ss->maddr = 0;
@ -291,21 +295,4 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[0];
return i386_btop(ss->maddr);
}
static int spigot_devsw_installed;
static void spigot_drvinit(void *unused)
{
dev_t dev;
if( ! spigot_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&spigot_cdevsw, NULL);
spigot_devsw_installed = 1;
}
}
SYSINIT(spigotdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spigot_drvinit,NULL)
#endif /* NSPIGOT */

View File

@ -4,7 +4,7 @@
* v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
* modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
*
* $Id: spkr.c,v 1.35 1998/08/24 02:28:16 bde Exp $
* $Id: spkr.c,v 1.36 1999/05/30 16:52:27 phk Exp $
*/
#include "speaker.h"
@ -601,24 +601,14 @@ spkrioctl(dev, cmd, cmdarg, flags, p)
return(EINVAL);
}
static int spkr_devsw_installed;
static void
spkr_drvinit(void *unused)
{
dev_t dev;
if( ! spkr_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&spkr_cdevsw, NULL);
spkr_devsw_installed = 1;
cdevsw_add(&spkr_cdevsw);
#ifdef DEVFS
devfs_token = devfs_add_devswf(&spkr_cdevsw, 0, DV_CHR,
UID_ROOT, GID_WHEEL, 0600,
"speaker");
devfs_token = devfs_add_devswf(&spkr_cdevsw, 0, DV_CHR,
UID_ROOT, GID_WHEEL, 0600, "speaker");
#endif
}
}
SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL)

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: stallion.c,v 1.31 1999/05/09 17:07:22 peter Exp $
* $Id: stallion.c,v 1.32 1999/05/30 16:52:27 phk Exp $
*/
/*****************************************************************************/
@ -561,13 +561,8 @@ static int stl_devsw_installed;
static void stl_drvinit(void *unused)
{
dev_t dev;
if (! stl_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &stl_cdevsw, NULL);
stl_devsw_installed = 1;
}
cdevsw_add(&stl_cdevsw);
}
SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,stl_drvinit,NULL)

View File

@ -359,7 +359,10 @@ static int twprobe(idp)
struct tw_sc sc;
int d;
int tries;
static int once;
if (!once++)
cdevsw_add(&tw_cdevsw);
sc.sc_port = idp->id_iobase;
/* Search for the zero crossing signal at ports, bit combinations. */
tw_zcport = tw_control;
@ -1168,21 +1171,4 @@ static int twchecktime(int target, int tol)
}
#endif /* HIRESTIME */
static int tw_devsw_installed;
static void tw_drvinit(void *unused)
{
dev_t dev;
if( ! tw_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&tw_cdevsw, NULL);
tw_devsw_installed = 1;
}
}
SYSINIT(twdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,tw_drvinit,NULL)
#endif /* NTW */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.197 1999/05/08 18:13:15 peter Exp $
* $Id: wd.c,v 1.198 1999/05/30 16:52:29 phk Exp $
*/
/* TODO:
@ -2386,17 +2386,12 @@ wdwait(struct disk *du, u_char bits_wanted, int timeout)
return (-1);
}
static int wd_devsw_installed;
static void wd_drvinit(void *unused)
{
if( ! wd_devsw_installed ) {
if (wd_cdevsw.d_maxio == 0)
wd_cdevsw.d_maxio = 248 * 512;
cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &wd_cdevsw);
wd_devsw_installed = 1;
}
if (wd_cdevsw.d_maxio == 0)
wd_cdevsw.d_maxio = 248 * 512;
cdevsw_add(&wd_cdevsw);
}
SYSINIT(wddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wd_drvinit,NULL)

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: atapi-cd.c,v 1.18 1999/05/11 10:39:27 sos Exp $
* $Id: atapi-cd.c,v 1.19 1999/05/30 16:52:08 phk Exp $
*/
#include "wdc.h"
@ -1496,15 +1496,10 @@ atapi_dump(int ctrlr, int lun, char *label, void *data, int len)
printf ("\n");
}
static int acd_devsw_installed;
static void
acd_drvinit(void *unused)
{
if (!acd_devsw_installed) {
cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &acd_cdevsw);
acd_devsw_installed = 1;
}
cdevsw_add(&acd_cdevsw);
}
SYSINIT(acddev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE + CDEV_MAJOR, acd_drvinit, NULL)

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: wfd.c,v 1.23 1999/05/07 07:03:31 phk Exp $
* $Id: wfd.c,v 1.24 1999/05/30 16:52:30 phk Exp $
*/
/*
@ -765,17 +765,11 @@ static int wfd_eject (struct wfd *t, int closeit)
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0);
}
static int wfd_devsw_installed;
static void wfd_drvinit(void *unused)
{
if( ! wfd_devsw_installed ) {
cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wfd_cdevsw);
wfd_devsw_installed = 1;
}
cdevsw_add(&wfd_cdevsw);
}
SYSINIT(wfddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wfd_drvinit,NULL)
#endif /* NWFD && NWDC */

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: wst.c,v 1.21 1999/05/07 07:03:32 phk Exp $
* $Id: wst.c,v 1.22 1999/05/30 16:52:30 phk Exp $
*/
#include "wdc.h"
@ -787,18 +787,10 @@ wst_reset(struct wst *t)
DELAY(30);
}
static int wst_devsw_installed;
static void
wst_drvinit(void *unused)
{
if (!wst_devsw_installed) {
dev_t dev;
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &wst_cdevsw, NULL);
wst_devsw_installed = 1;
}
cdevsw_add(&wst_cdevsw);
}
SYSINIT(wstdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wst_drvinit,NULL)

View File

@ -20,7 +20,7 @@
* the original CMU copyright notice.
*
* Version 1.3, Thu Nov 11 12:09:13 MSK 1993
* $Id: wt.c,v 1.50 1999/05/07 07:03:33 phk Exp $
* $Id: wt.c,v 1.51 1999/05/30 16:52:31 phk Exp $
*
*/
@ -223,6 +223,10 @@ static int
wtprobe (struct isa_device *id)
{
wtinfo_t *t = wttab + id->id_unit;
static int once;
if (!once++)
cdevsw_add(&wt_cdevsw);
t->unit = id->id_unit;
t->chan = id->id_drq;
@ -993,23 +997,4 @@ wtstatus (wtinfo_t *t)
return (1);
}
static int wt_devsw_installed;
static void
wt_drvinit(void *unused)
{
if( ! wt_devsw_installed ) {
dev_t dev;
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev, &wt_cdevsw, NULL);
wt_devsw_installed = 1;
}
}
SYSINIT(wtdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wt_drvinit,NULL)
#endif /* NWT */

View File

@ -120,6 +120,10 @@ static int get_tick __P((void));
static int
joyprobe (struct isa_device *dev)
{
static int once;
if (!once++)
cdevsw_add(&joy_cdevsw);
#ifdef WANT_JOYSTICK_CONNECTED
outb (dev->id_iobase, 0xff);
DELAY (10000); /* 10 ms delay */
@ -251,22 +255,6 @@ get_tick ()
return (high << 8) | low;
}
static int joy_devsw_installed;
static void joy_drvinit(void *unused)
{
dev_t dev;
if( ! joy_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&joy_cdevsw,NULL);
joy_devsw_installed = 1;
}
}
SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL)
#ifdef JOY_MODULE
#include <sys/exec.h>

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
* $Id: cd9660_vfsops.c,v 1.54 1999/05/07 10:10:46 phk Exp $
* $Id: cd9660_vfsops.c,v 1.55 1999/05/08 06:39:32 phk Exp $
*/
#include <sys/param.h>
@ -225,8 +225,7 @@ cd9660_mount(mp, path, data, ndp, p)
vrele(devvp);
return ENOTBLK;
}
if (major(devvp->v_rdev) >= nblkdev ||
bdevsw(devvp->v_rdev) == NULL) {
if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return ENXIO;
}

View File

@ -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.39 1999/05/12 13:06:34 phk Exp $
* $Id: kern_conf.c,v 1.40 1999/05/18 13:14:43 luoqi Exp $
*/
#include <sys/param.h>
@ -39,14 +39,11 @@
#include <sys/conf.h>
#include <sys/vnode.h>
#define NUMCDEV 256
#define cdevsw_ALLOCSTART (NUMCDEV/2)
#define cdevsw_ALLOCSTART (NUMCDEVSW/2)
struct cdevsw *cdevsw[NUMCDEV];
int nchrdev = NUMCDEV;
struct cdevsw *cdevsw[NUMCDEVSW];
int bmaj2cmaj[NUMCDEV];
int nblkdev = NUMCDEV;
int bmaj2cmaj[NUMCDEVSW];
/*
* Routine to convert from character to block device number.
@ -65,66 +62,64 @@ chrtoblk(dev_t dev)
return(NODEV);
}
struct cdevsw *
devsw(dev_t dev)
{
return(cdevsw[major(dev)]);
}
struct cdevsw *
bdevsw(dev_t dev)
{
struct cdevsw *c;
int i = major(dev);
if (bmaj2cmaj[i] == 254)
return 0;
c = cdevsw[bmaj2cmaj[major(dev)]];
if (!c) {
printf("bogus bdev dev_t %p, no cdev\n", (void *)dev);
Debugger("Bummer");
return 0;
}
/* CMAJ zero is the console, which has no strategy so this works */
if (c->d_strategy)
return (c);
return (0);
}
/*
* Add a cdevsw entry
*/
int
cdevsw_add(dev_t *descrip,
struct cdevsw *newentry,
struct cdevsw **oldentry)
cdevsw_add(struct cdevsw *newentry)
{
int i;
static int setup;
if (!setup) {
for (i = 0; i < NUMCDEV; i++)
for (i = 0; i < NUMCDEVSW; i++)
if (!bmaj2cmaj[i])
bmaj2cmaj[i] = 254;
setup++;
}
if ( *descrip == NODEV) { /* auto (0 is valid) */
/*
* Search the table looking for a slot...
*/
for (i = cdevsw_ALLOCSTART; i < nchrdev; i++)
if (cdevsw[i] == NULL)
break; /* found one! */
/* out of allocable slots? */
if (i >= nchrdev) {
return ENFILE;
}
} else { /* assign */
i = major(*descrip);
if (i < 0 || i >= nchrdev) {
return EINVAL;
}
if (newentry->d_maj < 0 || newentry->d_maj >= NUMCDEVSW) {
printf("%s: ERROR: driver has bogus cdevsw->d_maj = %d\n",
newentry->d_name, newentry->d_maj);
return EINVAL;
}
/* maybe save old */
if (oldentry) {
*oldentry = cdevsw[i];
}
if (newentry) {
newentry->d_bmaj = -1;
newentry->d_maj = i;
}
/* replace with new */
cdevsw[i] = newentry;
cdevsw[newentry->d_maj] = newentry;
if (newentry->d_bmaj >= 0 || newentry->d_bmaj < NUMCDEVSW)
bmaj2cmaj[newentry->d_bmaj] = newentry->d_maj;
/* done! let them know where we put it */
*descrip = makedev(i,0);
return 0;
}
void
cdevsw_add_generic(int bmaj, int cmaj, struct cdevsw *devsw)
{
dev_t dev;
dev = makedev(cmaj, 0);
cdevsw_add(&dev, devsw, NULL);
cdevsw[cmaj]->d_bmaj = bmaj;
bmaj2cmaj[bmaj] = cmaj;
}
int
devsw_module_handler(module_t mod, int what, void* arg)
{
@ -137,7 +132,7 @@ devsw_module_handler(module_t mod, int what, void* arg)
data->cdev = makedev(data->cmaj, 0);
switch (what) {
case MOD_LOAD:
error = cdevsw_add(&data->cdev, data->cdevsw, NULL);
error = cdevsw_add(data->cdevsw);
if (!error && data->cdevsw->d_strategy != nostrategy) {
if (data->bmaj == NOMAJ) {
data->bdev = data->cdev;
@ -160,7 +155,6 @@ devsw_module_handler(module_t mod, int what, void* arg)
}
if (data->cdevsw->d_strategy != nostrategy)
bmaj2cmaj[major(data->bdev)] = 0;
error = cdevsw_add(&data->cdev, NULL, NULL);
return error;
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
* $Id: kern_descrip.c,v 1.61 1999/05/11 19:54:28 phk Exp $
* $Id: kern_descrip.c,v 1.62 1999/05/30 16:52:54 phk Exp $
*/
#include "opt_compat.h"
@ -1294,14 +1294,12 @@ static void *devfs_token_fildesc[NUMFDESC];
static void fildesc_drvinit(void *unused)
{
dev_t dev;
#ifdef DEVFS
int fd;
#endif
if( ! fildesc_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&fildesc_cdevsw,NULL);
cdevsw_add(&fildesc_cdevsw);
fildesc_devsw_installed = 1;
#ifdef DEVFS
for (fd = 0; fd < NUMFDESC; fd++)

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)subr_log.c 8.1 (Berkeley) 6/10/93
* $Id: subr_log.c,v 1.34 1999/05/06 18:12:46 peter Exp $
* $Id: subr_log.c,v 1.35 1999/05/30 16:52:56 phk Exp $
*/
/*
@ -274,11 +274,9 @@ static void
log_drvinit(unused)
void *unused;
{
dev_t dev;
if( ! log_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&log_cdevsw,NULL);
cdevsw_add(&log_cdevsw);
log_devsw_installed = 1;
#ifdef DEVFS
log_devfs_token = devfs_add_devswf(&log_cdevsw, 0, DV_CHR,

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
* $Id: cons.c,v 1.65 1999/05/08 06:39:20 phk Exp $
* $Id: cons.c,v 1.66 1999/05/30 16:52:03 phk Exp $
*/
#include "opt_devfs.h"
@ -433,11 +433,9 @@ static int cn_devsw_installed;
static void
cn_drvinit(void *unused)
{
dev_t dev;
if( ! cn_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&cn_cdevsw,NULL);
cdevsw_add(&cn_cdevsw);
cn_devsw_installed = 1;
#ifdef DEVFS
cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR,

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
* $Id: tty_pty.c,v 1.59 1999/05/18 14:53:52 luoqi Exp $
* $Id: tty_pty.c,v 1.60 1999/05/30 16:52:57 phk Exp $
*/
/*
@ -843,13 +843,10 @@ ptc_drvinit(unused)
#ifdef DEVFS
int i,j,k;
#endif
dev_t dev;
if( ! ptc_devsw_installed ) {
dev = makedev(CDEV_MAJOR_S, 0);
cdevsw_add(&dev, &pts_cdevsw, NULL);
dev = makedev(CDEV_MAJOR_C, 0);
cdevsw_add(&dev, &ptc_cdevsw, NULL);
cdevsw_add(&pts_cdevsw);
cdevsw_add(&ptc_cdevsw);
ptc_devsw_installed = 1;
#ifdef DEVFS
for ( i = 0 ; i<NPTY ; i++ ) {

View File

@ -83,11 +83,7 @@ snpdevtotty (dev)
dev_t dev;
{
struct cdevsw *cdp;
int maj;
maj = major(dev);
if ((u_int)maj >= nchrdev)
return (NULL);
cdp = devsw(dev);
if (cdp == NULL)
return (NULL);
@ -533,14 +529,12 @@ static void
snp_drvinit(unused)
void *unused;
{
dev_t dev;
#ifdef DEVFS
int i;
#endif
if( ! snp_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&snp_cdevsw, NULL);
cdevsw_add(&snp_cdevsw);
snp_devsw_installed = 1;
#ifdef DEVFS
for ( i = 0 ; i < NSNP ; i++) {

Some files were not shown because too many files have changed in this diff Show More