diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c --- a/sys/i386/bios/smapi.c +++ b/sys/i386/bios/smapi.c @@ -278,6 +278,21 @@ return (0); } +static device_method_t smapi_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, smapi_identify), + DEVMETHOD(device_probe, smapi_probe), + DEVMETHOD(device_attach, smapi_attach), + DEVMETHOD(device_detach, smapi_detach), + { 0, 0 } +}; + +static driver_t smapi_driver = { + "smapi", + smapi_methods, + sizeof(struct smapi_softc), +}; + static int smapi_modevent (module_t mod, int what, void *arg) { @@ -289,7 +304,8 @@ case MOD_LOAD: break; case MOD_UNLOAD: - devclass_get_devices(smapi_devclass, &devs, &count); + devclass_get_devices(devclass_find(smapi_driver.name), &devs, + &count); for (i = 0; i < count; i++) { device_delete_child(device_get_parent(devs[i]), devs[i]); } @@ -302,20 +318,5 @@ return (0); } -static device_method_t smapi_methods[] = { - /* Device interface */ - DEVMETHOD(device_identify, smapi_identify), - DEVMETHOD(device_probe, smapi_probe), - DEVMETHOD(device_attach, smapi_attach), - DEVMETHOD(device_detach, smapi_detach), - { 0, 0 } -}; - -static driver_t smapi_driver = { - "smapi", - smapi_methods, - sizeof(struct smapi_softc), -}; - DRIVER_MODULE(smapi, nexus, smapi_driver, smapi_devclass, smapi_modevent, 0); MODULE_VERSION(smapi, 1);