]>
Commit | Line | Data |
---|---|---|
24aa310b GKH |
1 | From foo@baz Thu Feb 1 13:45:42 CET 2018 |
2 | From: Hans de Goede <hdegoede@redhat.com> | |
3 | Date: Sun, 15 Oct 2017 21:24:49 +0200 | |
4 | Subject: ACPI / bus: Leave modalias empty for devices which are not present | |
5 | ||
6 | From: Hans de Goede <hdegoede@redhat.com> | |
7 | ||
8 | ||
9 | [ Upstream commit 10809bb976648ac58194a629e3d7af99e7400297 ] | |
10 | ||
11 | Most Bay and Cherry Trail devices use a generic DSDT with all possible | |
12 | peripheral devices present in the DSDT, with their _STA returning 0x00 or | |
13 | 0x0f based on AML variables which describe what is actually present on | |
14 | the board. | |
15 | ||
16 | Since ACPI device objects with a 0x00 status (not present) still get an | |
17 | entry under /sys/bus/acpi/devices, and those entry had an acpi:PNPID | |
18 | modalias, userspace would end up loading modules for non present hardware. | |
19 | ||
20 | This commit fixes this by leaving the modalias empty for non present | |
21 | devices. This results in 10 modules less being loaded with a generic | |
22 | distro kernel config on my Cherry Trail test-device (a GPD pocket). | |
23 | ||
24 | Signed-off-by: Hans de Goede <hdegoede@redhat.com> | |
25 | Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | |
26 | Signed-off-by: Sasha Levin <alexander.levin@verizon.com> | |
27 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
28 | --- | |
29 | drivers/acpi/device_sysfs.c | 4 ++++ | |
30 | 1 file changed, 4 insertions(+) | |
31 | ||
32 | --- a/drivers/acpi/device_sysfs.c | |
33 | +++ b/drivers/acpi/device_sysfs.c | |
34 | @@ -146,6 +146,10 @@ static int create_pnp_modalias(struct ac | |
35 | int count; | |
36 | struct acpi_hardware_id *id; | |
37 | ||
38 | + /* Avoid unnecessarily loading modules for non present devices. */ | |
39 | + if (!acpi_device_is_present(acpi_dev)) | |
40 | + return 0; | |
41 | + | |
42 | /* | |
43 | * Since we skip ACPI_DT_NAMESPACE_HID from the modalias below, 0 should | |
44 | * be returned if ACPI_DT_NAMESPACE_HID is the only ACPI/PNP ID in the |