Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157952996
D56810.id177201.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D56810.id177201.diff
View Options
diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -333,10 +333,7 @@
static int
acpi_spmc_probe(device_t dev)
{
- char *name;
- ACPI_HANDLE handle;
- struct acpi_spmc_softc *sc;
- char buf[32];
+ char *name;
/* Check that this is an enabled device. */
if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("spmc"))
@@ -350,42 +347,43 @@
return (ENXIO);
}
- handle = acpi_get_handle(dev);
- /* ACPI_ID_PROBE() above cannot succeed without a handle. */
- MPASS(handle != NULL);
+ device_set_desc(dev, "System Power Management Controller");
- sc = device_get_softc(dev);
- sc->dev = dev;
-
- /* Check which sets of DSMs are supported. */
- sc->supported_dsms = 0;
-
- for (u_int i = 0; i < nitems(dsms); ++i)
- acpi_spmc_check_dsm(sc, handle, dsms[i]);
-
- if (sc->supported_dsms == 0)
- return (ENXIO);
-
- print_bit_field(buf, nitems(buf), sc->supported_dsms, "DSM",
- pbf_dsm_name, NULL);
- device_set_descf(dev, "System Power Management Controller "
- "(DSM sets %#x%s)", sc->supported_dsms, buf);
-
- return (0);
+ return (BUS_PROBE_DEFAULT);
}
static int
acpi_spmc_attach(device_t dev)
{
- struct acpi_spmc_softc *sc = device_get_softc(dev);
+ struct acpi_spmc_softc *const sc = device_get_softc(dev);
+ const ACPI_HANDLE handle = acpi_get_handle(dev);
+ char buf[32];
- sc->handle = acpi_get_handle(dev);
- if (sc->handle == NULL)
+ /*
+ * ACPI_ID_PROBE() in acpi_spmc_probe() cannot succeed without a handle.
+ */
+ MPASS(handle != NULL);
+
+ sc->dev = dev;
+ sc->handle = handle;
+
+ for (u_int i = 0; i < nitems(dsms); ++i) {
+ KASSERT(dsms[i] != NULL, ("%s: Sparse dsms[]!", __func__));
+ KASSERT(dsms[i]->index == i,
+ ("%s: Inconsistent indices for DSM %s", __func__,
+ dsms[i]->name));
+
+ acpi_spmc_check_dsm(sc, handle, dsms[i]);
+ }
+
+ print_bit_field(buf, nitems(buf), sc->supported_dsms, "DSM",
+ pbf_dsm_name, NULL);
+ device_printf(dev, "DSMs supported: %#x%s", sc->supported_dsms, buf);
+
+ if (sc->supported_dsms == 0) {
+ device_printf(dev, "No DSM supported!");
return (ENXIO);
-
- sc->constraints_populated = false;
- sc->constraint_count = 0;
- sc->constraints = NULL;
+ }
/* Get device constraints. We can only call this once so do this now. */
acpi_spmc_get_constraints(dev);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, May 27, 9:06 PM (10 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32707804
Default Alt Text
D56810.id177201.diff (2 KB)
Attached To
Mode
D56810: acpi_spmc(4): Check DSMs only on attach, do not return 0 on probe
Attached
Detach File
Event Timeline
Log In to Comment