From 2447bec8293649f281b5f9926a7cd4097ccaf4bf Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 31 May 1999 11:29:30 +0000 Subject: 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. --- sys/dev/joy/joy.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'sys/dev/joy') diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c index 6847f43d41222..a2edbd5f0690f 100644 --- a/sys/dev/joy/joy.c +++ b/sys/dev/joy/joy.c @@ -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 -- cgit v1.2.3