sc: Use devclass_find to lookup the sc devclass.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D35007
This commit is contained in:
John Baldwin 2022-04-21 10:29:14 -07:00
parent 108adb2ff5
commit 6b06f746db

View File

@ -97,7 +97,7 @@ int
sc_max_unit(void)
{
return (devclass_get_maxunit(sc_devclass));
return (devclass_get_maxunit(devclass_find("sc")));
}
sc_softc_t
@ -111,7 +111,8 @@ sc_softc_t
/* FIXME: clear if it is wired to another unit! */
sc = &main_softc;
} else {
sc = device_get_softc(devclass_get_device(sc_devclass, unit));
sc = device_get_softc(devclass_get_device(devclass_find("sc"),
unit));
if (sc == NULL)
return (NULL);
}
@ -127,6 +128,7 @@ sc_softc_t
sc_softc_t
*sc_find_softc(struct video_adapter *adp, struct keyboard *kbd)
{
devclass_t dc;
sc_softc_t *sc;
int i;
int units;
@ -135,9 +137,10 @@ sc_softc_t
if ((adp == NULL || adp == sc->adp) &&
(kbd == NULL || kbd == sc->kbd))
return (sc);
units = devclass_get_maxunit(sc_devclass);
dc = devclass_find("sc");
units = devclass_get_maxunit(dc);
for (i = 0; i < units; ++i) {
sc = device_get_softc(devclass_get_device(sc_devclass, i));
sc = device_get_softc(devclass_get_device(dc, i));
if (sc == NULL)
continue;
if ((adp == NULL || adp == sc->adp) &&