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.
This commit is contained in:
John Baldwin 2002-10-22 17:30:52 +00:00
parent f0ed8fc408
commit 8bbdb8e89f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=105730

View File

@ -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);