git: 1ac10fa42937 - main - acpi_toshiba: Use device_get_softc in attach.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 21 Apr 2022 17:30:19 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=1ac10fa429370731be57dee76b19896e01764b76
commit 1ac10fa429370731be57dee76b19896e01764b76
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-04-21 17:29:15 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-04-21 17:29:15 +0000
acpi_toshiba: Use device_get_softc in attach.
Rather than a detour via the devclass and hardcoding unit 0.
While here, remove a check for sc being NULL. It will never be NULL
when attach is called.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D35010
---
sys/dev/acpi_support/acpi_toshiba.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sys/dev/acpi_support/acpi_toshiba.c b/sys/dev/acpi_support/acpi_toshiba.c
index c5233579d560..208cc36c9a59 100644
--- a/sys/dev/acpi_support/acpi_toshiba.c
+++ b/sys/dev/acpi_support/acpi_toshiba.c
@@ -562,9 +562,7 @@ acpi_toshiba_video_attach(device_t dev)
{
struct acpi_toshiba_softc *sc;
- sc = devclass_get_softc(acpi_toshiba_devclass, 0);
- if (sc == NULL)
- return (ENXIO);
+ sc = device_get_softc(dev);
sc->video_handle = acpi_get_handle(dev);
return (0);
}