smbios/vpd: Use devclass_find to lookup devclass in module event handler.

While here, use a modern function declaration for smbios_modevent and
vpd_modevent.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34996
This commit is contained in:
John Baldwin 2022-04-21 10:29:14 -07:00
parent 82496a256f
commit 489e8f24a5
2 changed files with 4 additions and 10 deletions

View File

@ -209,10 +209,7 @@ smbios_detach (device_t dev)
}
static int
smbios_modevent (mod, what, arg)
module_t mod;
int what;
void * arg;
smbios_modevent (module_t mod, int what, void *arg)
{
device_t * devs;
int count;
@ -222,7 +219,7 @@ smbios_modevent (mod, what, arg)
case MOD_LOAD:
break;
case MOD_UNLOAD:
devclass_get_devices(smbios_devclass, &devs, &count);
devclass_get_devices(devclass_find("smbios"), &devs, &count);
for (i = 0; i < count; i++) {
device_delete_child(device_get_parent(devs[i]), devs[i]);
}

View File

@ -252,10 +252,7 @@ vpd_detach (device_t dev)
}
static int
vpd_modevent (mod, what, arg)
module_t mod;
int what;
void * arg;
vpd_modevent (module_t mod, int what, void *arg)
{
device_t * devs;
int count;
@ -265,7 +262,7 @@ vpd_modevent (mod, what, arg)
case MOD_LOAD:
break;
case MOD_UNLOAD:
devclass_get_devices(vpd_devclass, &devs, &count);
devclass_get_devices(devclass_find("vpd"), &devs, &count);
for (i = 0; i < count; i++) {
device_delete_child(device_get_parent(devs[i]), devs[i]);
}