]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.17/acpi-bus-leave-modalias-empty-for-devices-which-are-not-present.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.14.17 / acpi-bus-leave-modalias-empty-for-devices-which-are-not-present.patch
CommitLineData
24aa310b
GKH
1From foo@baz Thu Feb 1 13:45:42 CET 2018
2From: Hans de Goede <hdegoede@redhat.com>
3Date: Sun, 15 Oct 2017 21:24:49 +0200
4Subject: ACPI / bus: Leave modalias empty for devices which are not present
5
6From: Hans de Goede <hdegoede@redhat.com>
7
8
9[ Upstream commit 10809bb976648ac58194a629e3d7af99e7400297 ]
10
11Most Bay and Cherry Trail devices use a generic DSDT with all possible
12peripheral devices present in the DSDT, with their _STA returning 0x00 or
130x0f based on AML variables which describe what is actually present on
14the board.
15
16Since ACPI device objects with a 0x00 status (not present) still get an
17entry under /sys/bus/acpi/devices, and those entry had an acpi:PNPID
18modalias, userspace would end up loading modules for non present hardware.
19
20This commit fixes this by leaving the modalias empty for non present
21devices. This results in 10 modules less being loaded with a generic
22distro kernel config on my Cherry Trail test-device (a GPD pocket).
23
24Signed-off-by: Hans de Goede <hdegoede@redhat.com>
25Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
26Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
27Signed-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