diff options
author | jhb <jhb@FreeBSD.org> | 2002-10-22 17:30:52 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-10-22 17:30:52 +0000 |
commit | 5dc5449f4bd3fd3af01ac5c9d4c03fd9ced1b6ae (patch) | |
tree | 1bc8b553c6e88426ddd011a4521005d17af4c810 | |
parent | 7b35ce62ba875845f29910158e53beeab5c1c889 (diff) | |
download | FreeBSD-src-5dc5449f4bd3fd3af01ac5c9d4c03fd9ced1b6ae.zip FreeBSD-src-5dc5449f4bd3fd3af01ac5c9d4c03fd9ced1b6ae.tar.gz |
Add an identify method that creates a pmtimer0 device if it doesn't alreedy
exist. Hints are no longer needed to instantiate a pmtimer(4) device.
-rw-r--r-- | sys/i386/isa/pmtimer.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/i386/isa/pmtimer.c b/sys/i386/isa/pmtimer.c index 35448e4..fcb6f49 100644 --- a/sys/i386/isa/pmtimer.c +++ b/sys/i386/isa/pmtimer.c @@ -40,11 +40,29 @@ #include <isa/isavar.h> +static devclass_t pmtimer_devclass; + /* reject any PnP devices for now */ static struct isa_pnp_id pmtimer_ids[] = { {0} }; +static void +pmtimer_identify(driver_t *driver, device_t parent) +{ + device_t child; + + /* + * Only add a child if one doesn't exist already. + */ + child = devclass_get_device(pmtimer_devclass, 0); + if (child == NULL) { + child = BUS_ADD_CHILD(parent, 0, "pmtimer", 0); + if (child == NULL) + panic("pmtimer_identify"); + } +} + static int pmtimer_probe(device_t dev) { @@ -121,6 +139,7 @@ pmtimer_resume(device_t dev) static device_method_t pmtimer_methods[] = { /* Device interface */ + DEVMETHOD(device_identify, pmtimer_identify), DEVMETHOD(device_probe, pmtimer_probe), DEVMETHOD(device_attach, bus_generic_attach), DEVMETHOD(device_suspend, pmtimer_suspend), @@ -134,6 +153,4 @@ static driver_t pmtimer_driver = { 1, /* no softc */ }; -static devclass_t pmtimer_devclass; - DRIVER_MODULE(pmtimer, isa, pmtimer_driver, pmtimer_devclass, 0, 0); |