Skip to content

Commit 10809bb

Browse files
jwrdegoederafaeljw
authored andcommitted
ACPI / bus: Leave modalias empty for devices which are not present
Most Bay and Cherry Trail devices use a generic DSDT with all possible peripheral devices present in the DSDT, with their _STA returning 0x00 or 0x0f based on AML variables which describe what is actually present on the board. Since ACPI device objects with a 0x00 status (not present) still get an entry under /sys/bus/acpi/devices, and those entry had an acpi:PNPID modalias, userspace would end up loading modules for non present hardware. This commit fixes this by leaving the modalias empty for non present devices. This results in 10 modules less being loaded with a generic distro kernel config on my Cherry Trail test-device (a GPD pocket). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 190b103 commit 10809bb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/acpi/device_sysfs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias,
146146
int count;
147147
struct acpi_hardware_id *id;
148148

149+
/* Avoid unnecessarily loading modules for non present devices. */
150+
if (!acpi_device_is_present(acpi_dev))
151+
return 0;
152+
149153
/*
150154
* Since we skip ACPI_DT_NAMESPACE_HID from the modalias below, 0 should
151155
* be returned if ACPI_DT_NAMESPACE_HID is the only ACPI/PNP ID in the

0 commit comments

Comments
 (0)