diff options
Diffstat (limited to 'sys/dev/ppbus')
-rw-r--r-- | sys/dev/ppbus/if_plip.c | 8 | ||||
-rw-r--r-- | sys/dev/ppbus/lpbb.c | 6 | ||||
-rw-r--r-- | sys/dev/ppbus/lpt.c | 17 | ||||
-rw-r--r-- | sys/dev/ppbus/pcfclock.c | 4 | ||||
-rw-r--r-- | sys/dev/ppbus/ppb_msq.c | 2 | ||||
-rw-r--r-- | sys/dev/ppbus/ppbconf.c | 21 | ||||
-rw-r--r-- | sys/dev/ppbus/ppbconf.h | 2 | ||||
-rw-r--r-- | sys/dev/ppbus/ppi.c | 4 | ||||
-rw-r--r-- | sys/dev/ppbus/pps.c | 4 |
9 files changed, 22 insertions, 46 deletions
diff --git a/sys/dev/ppbus/if_plip.c b/sys/dev/ppbus/if_plip.c index a9ef8dc016b7..16139139c0e7 100644 --- a/sys/dev/ppbus/if_plip.c +++ b/sys/dev/ppbus/if_plip.c @@ -214,9 +214,9 @@ lp_identify(driver_t *driver, device_t parent) { device_t dev; - dev = device_find_child(parent, "plip", -1); + dev = device_find_child(parent, "plip", DEVICE_UNIT_ANY); if (!dev) - BUS_ADD_CHILD(parent, 0, "plip", -1); + BUS_ADD_CHILD(parent, 0, "plip", DEVICE_UNIT_ANY); } static int @@ -249,10 +249,6 @@ lp_attach(device_t dev) } ifp = lp->sc_ifp = if_alloc(IFT_PARA); - if (ifp == NULL) { - return (ENOSPC); - } - if_setsoftc(ifp, lp); if_initname(ifp, device_get_name(dev), device_get_unit(dev)); if_setmtu(ifp, LPMTU); diff --git a/sys/dev/ppbus/lpbb.c b/sys/dev/ppbus/lpbb.c index 560c7009b370..3d2253ed9378 100644 --- a/sys/dev/ppbus/lpbb.c +++ b/sys/dev/ppbus/lpbb.c @@ -61,9 +61,9 @@ lpbb_identify(driver_t *driver, device_t parent) device_t dev; - dev = device_find_child(parent, "lpbb", -1); + dev = device_find_child(parent, "lpbb", DEVICE_UNIT_ANY); if (!dev) - BUS_ADD_CHILD(parent, 0, "lpbb", -1); + BUS_ADD_CHILD(parent, 0, "lpbb", DEVICE_UNIT_ANY); } static int @@ -85,7 +85,7 @@ lpbb_attach(device_t dev) device_t bitbang; /* add generic bit-banging code */ - bitbang = device_add_child(dev, "iicbb", -1); + bitbang = device_add_child(dev, "iicbb", DEVICE_UNIT_ANY); device_probe_and_attach(bitbang); return (0); diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 644e0f08008b..401e94d25727 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -100,7 +100,7 @@ static int volatile lptflag = 1; #define LPINITRDY 4 /* wait up to 4 seconds for a ready */ #define LPTOUTINITIAL 10 /* initial timeout to wait for ready 1/10 s */ #define LPTOUTMAX 1 /* maximal timeout 1 s */ -#define LPPRI (PZERO+8) +#define LPPRI (PWAIT) #define BUFSIZE 1024 #define BUFSTATSIZE 32 @@ -238,8 +238,7 @@ lpt_port_test(device_t ppbus, u_char data, u_char mask) do { DELAY(10); temp = ppb_rdtr(ppbus) & mask; - } - while (temp != data && --timeout); + } while (temp != data && --timeout); lprintf(("out=%x\tin=%x\ttout=%d\n", data, temp, timeout)); return (temp == data); } @@ -337,9 +336,9 @@ lpt_identify(driver_t *driver, device_t parent) device_t dev; - dev = device_find_child(parent, LPT_NAME, -1); + dev = device_find_child(parent, LPT_NAME, DEVICE_UNIT_ANY); if (!dev) - BUS_ADD_CHILD(parent, 0, LPT_NAME, -1); + BUS_ADD_CHILD(parent, 0, LPT_NAME, DEVICE_UNIT_ANY); } /* @@ -560,9 +559,7 @@ lptopen(struct cdev *dev, int flags, int fmt, struct thread *td) } /* is printer online and ready for output */ - } while ((ppb_rstr(ppbus) & - (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != - (LPS_SEL|LPS_NBSY|LPS_NERR)); + } while ((ppb_rstr(ppbus) & RDY_MASK) != LP_READY); sc->sc_control = LPC_SEL|LPC_NINIT; if (sc->sc_flags & LP_AUTOLF) @@ -619,9 +616,7 @@ lptclose(struct cdev *dev, int flags, int fmt, struct thread *td) /* if the last write was interrupted, don't complete it */ if ((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ)) - while ((ppb_rstr(ppbus) & - (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != - (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) + while ((ppb_rstr(ppbus) & RDY_MASK) != LP_READY || sc->sc_xfercnt) /* wait 1 second, give up if we get a signal */ if (ppb_sleep(ppbus, lptdev, LPPRI | PCATCH, "lpclose", hz) != EWOULDBLOCK) diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c index e0d2e71b49e5..47a1a010a311 100644 --- a/sys/dev/ppbus/pcfclock.c +++ b/sys/dev/ppbus/pcfclock.c @@ -111,9 +111,9 @@ pcfclock_identify(driver_t *driver, device_t parent) device_t dev; - dev = device_find_child(parent, PCFCLOCK_NAME, -1); + dev = device_find_child(parent, PCFCLOCK_NAME, DEVICE_UNIT_ANY); if (!dev) - BUS_ADD_CHILD(parent, 0, PCFCLOCK_NAME, -1); + BUS_ADD_CHILD(parent, 0, PCFCLOCK_NAME, DEVICE_UNIT_ANY); } static int diff --git a/sys/dev/ppbus/ppb_msq.c b/sys/dev/ppbus/ppb_msq.c index 1e2cb17640a2..d43f30374170 100644 --- a/sys/dev/ppbus/ppb_msq.c +++ b/sys/dev/ppbus/ppb_msq.c @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -#include <machine/stdarg.h> +#include <sys/stdarg.h> #include <sys/param.h> #include <sys/lock.h> diff --git a/sys/dev/ppbus/ppbconf.c b/sys/dev/ppbus/ppbconf.c index 469b2ecd045f..2c3f17318747 100644 --- a/sys/dev/ppbus/ppbconf.c +++ b/sys/dev/ppbus/ppbconf.c @@ -404,7 +404,7 @@ ppbus_attach(device_t dev) } /* Locate our children */ - bus_generic_probe(dev); + bus_identify_children(dev); #ifndef DONTPROBE_1284 /* detect IEEE1284 compliant devices */ @@ -414,22 +414,7 @@ ppbus_attach(device_t dev) #endif /* !DONTPROBE_1284 */ /* launch attachment of the added children */ - bus_generic_attach(dev); - - return (0); -} - -static int -ppbus_detach(device_t dev) -{ - int error; - - error = bus_generic_detach(dev); - if (error) - return (error); - - /* detach & delete all children */ - device_delete_children(dev); + bus_attach_children(dev); return (0); } @@ -578,7 +563,7 @@ static device_method_t ppbus_methods[] = { /* device interface */ DEVMETHOD(device_probe, ppbus_probe), DEVMETHOD(device_attach, ppbus_attach), - DEVMETHOD(device_detach, ppbus_detach), + DEVMETHOD(device_detach, bus_generic_detach), /* bus interface */ DEVMETHOD(bus_add_child, ppbus_add_child), diff --git a/sys/dev/ppbus/ppbconf.h b/sys/dev/ppbus/ppbconf.h index 0f6395121fba..66f45634ea6d 100644 --- a/sys/dev/ppbus/ppbconf.h +++ b/sys/dev/ppbus/ppbconf.h @@ -63,7 +63,7 @@ /* * Parallel Port Bus sleep/wakeup queue. */ -#define PPBPRI (PZERO+8) +#define PPBPRI (PWAIT) /* * Parallel Port Chipset mode masks. diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c index 3789da6fbed5..3fd5f43a4a3a 100644 --- a/sys/dev/ppbus/ppi.c +++ b/sys/dev/ppbus/ppi.c @@ -135,9 +135,9 @@ ppi_identify(driver_t *driver, device_t parent) device_t dev; - dev = device_find_child(parent, "ppi", -1); + dev = device_find_child(parent, "ppi", DEVICE_UNIT_ANY); if (!dev) - BUS_ADD_CHILD(parent, 0, "ppi", -1); + BUS_ADD_CHILD(parent, 0, "ppi", DEVICE_UNIT_ANY); } /* diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c index a5c0a56d4f94..80581e3beae7 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -76,9 +76,9 @@ ppsidentify(driver_t *driver, device_t parent) device_t dev; - dev = device_find_child(parent, PPS_NAME, -1); + dev = device_find_child(parent, PPS_NAME, DEVICE_UNIT_ANY); if (!dev) - BUS_ADD_CHILD(parent, 0, PPS_NAME, -1); + BUS_ADD_CHILD(parent, 0, PPS_NAME, DEVICE_UNIT_ANY); } static int |