From fe4ee75f221068445d562107382dae05426b1a08 Mon Sep 17 00:00:00 2001 From: rik Date: Tue, 2 Mar 2004 16:39:40 +0000 Subject: 1. Renames NCT constant to NCTAU. This will help while MFC to 4 branch. 2. Fix compilation and panic while system boot problem after makedev was changed to unde2dev. Approved by: imp (mentor) --- sys/dev/ctau/if_ct.c | 65 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 25 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/ctau/if_ct.c b/sys/dev/ctau/if_ct.c index b0c82c8..bd66f3d 100644 --- a/sys/dev/ctau/if_ct.c +++ b/sys/dev/ctau/if_ct.c @@ -18,7 +18,7 @@ * as long as this message is kept with the software, all derivative * works or modified versions. * - * Cronyx Id: if_ct.c,v 1.1.2.20.2.1 2004/02/13 14:48:24 rik Exp $ + * Cronyx Id: if_ct.c,v 1.1.2.22 2004/02/26 19:06:51 rik Exp $ */ #include __FBSDID("$FreeBSD$"); @@ -26,12 +26,12 @@ __FBSDID("$FreeBSD$"); #include #if __FreeBSD_version >= 500000 -# define NCT 1 +# define NCTAU 1 #else -# include "ct.h" +# include "ctau.h" #endif -#if NCT > 0 +#if NCTAU > 0 #include #include #include @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); # if __FreeBSD_version < 500000 # include "sppp.h" # if NSPPP <= 0 -# error The device ct requires sppp or netgraph. +# error The device ctau requires sppp or netgraph. # endif # endif # include @@ -188,9 +188,9 @@ static int ct_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data); static void ct_initialize (void *softc); #endif -static ct_board_t *adapter [NCT]; -static drv_t *channel [NCT*NCHAN]; -static struct callout_handle led_timo [NCT]; +static ct_board_t *adapter [NCTAU]; +static drv_t *channel [NCTAU*NCHAN]; +static struct callout_handle led_timo [NCTAU]; static struct callout_handle timeout_handle; /* @@ -234,7 +234,7 @@ static void ct_timeout (void *arg) drv_t *d; int s, i; - for (i=0; inum, irq, mask, busy); */ ct_probe_irq (b, 0); return 0; @@ -372,7 +372,7 @@ static void ct_identify (driver_t *driver, device_t dev) bus_set_resource (child, SYS_RES_IOPORT, 0, iobase, NPORT); - if (devcount >= NCT) + if (devcount >= NCTAU) break; } } else { @@ -1260,7 +1260,7 @@ static int ct_open (dev_t dev, int oflags, int devtype, struct thread *td) { drv_t *d; - if (minor(dev) >= NCT*NCHAN || ! (d = channel[minor(dev)])) + if (minor(dev) >= NCTAU*NCHAN || ! (d = channel[minor(dev)])) return ENXIO; CT_DEBUG2 (d, ("ct_open\n")); @@ -1325,7 +1325,7 @@ static int ct_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa switch (cmd) { case SERIAL_GETREGISTERED: bzero (mask, sizeof(mask)); - for (s=0; s 501000 */ +#elif __FreeBSD_version < 502103 +static struct cdevsw ct_cdevsw = { + .d_open = ct_open, + .d_close = ct_close, + .d_ioctl = ct_ioctl, + .d_name = "ct", + .d_maj = CDEV_MAJOR, + .d_flags = D_NAGGED, +}; +#else /* __FreeBSD_version >= 502103 */ static struct cdevsw ct_cdevsw = { .d_version = D_VERSION, .d_open = ct_open, @@ -1893,7 +1902,7 @@ static struct cdevsw ct_cdevsw = { .d_ioctl = ct_ioctl, .d_name = "ct", .d_maj = CDEV_MAJOR, - .d_flags = D_NAGGED | D_NEEDGIANT, + .d_flags = D_NEEDGIANT, }; #endif /* __FreeBSD_version > 501000 */ @@ -2438,7 +2447,7 @@ static int ct_load (void) { int i; - for (i=0;iport) @@ -2496,7 +2505,7 @@ static int ct_unload (void) ct_close_board (b); } - for (i=0; iport) @@ -2506,7 +2515,7 @@ static int ct_unload (void) untimeout (ct_led_off, b, led_timo[i]); } - for (i=0; iport) @@ -2520,7 +2529,7 @@ static int ct_unload (void) } /* Detach the interfaces, free buffer memory. */ - for (i=0; i= 502103 dev = udev2dev (makeudev(CDEV_MAJOR, 0)); +#else + dev = makedev (CDEV_MAJOR, 0); +#endif switch (type) { case MOD_LOAD: - if ((cdsw = devsw (dev)) && cdsw->d_maj == CDEV_MAJOR) { + if (dev != NODEV && + (cdsw = devsw (dev)) && + cdsw->d_maj == CDEV_MAJOR) { printf ("Tau-ISA driver is already in system\n"); return (ENXIO); } @@ -2734,4 +2749,4 @@ static void ct_drvinit (void *unused) SYSINIT (ctdev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+CDEV_MAJOR, ct_drvinit, 0) #endif /* KLD_MODULE */ #endif /* __FreeBSD_version < 400000 */ -#endif /* NCT */ +#endif /* NCTAU */ -- cgit v1.1