]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.8/acpi-scan-do-not-increase-dep_unmet-for-already-met-dependencies.patch
6.8-stable patches
[thirdparty/kernel/stable-queue.git] / queue-6.8 / acpi-scan-do-not-increase-dep_unmet-for-already-met-dependencies.patch
1 From d730192ff0246356a2d7e63ff5bd501060670eec Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Sat, 6 Apr 2024 13:40:52 +0200
4 Subject: ACPI: scan: Do not increase dep_unmet for already met dependencies
5
6 From: Hans de Goede <hdegoede@redhat.com>
7
8 commit d730192ff0246356a2d7e63ff5bd501060670eec upstream.
9
10 On the Toshiba Encore WT10-A tablet the BATC battery ACPI device depends
11 on 3 other devices:
12
13 Name (_DEP, Package (0x03) // _DEP: Dependencies
14 {
15 I2C1,
16 GPO2,
17 GPO0
18 })
19
20 acpi_scan_check_dep() adds all 3 of these to the acpi_dep_list and then
21 before an acpi_device is created for the BATC handle (and thus before
22 acpi_scan_dep_init() runs) acpi_scan_clear_dep() gets called for both
23 GPIO depenencies, with free_when_met not set for the dependencies.
24
25 Since there is no adev for BATC yet, there also is no dep_unmet to
26 decrement. The only result of acpi_scan_clear_dep() in this case is
27 dep->met getting set.
28
29 Soon after acpi_scan_clear_dep() has been called for the GPIO dependencies
30 the acpi_device gets created for the BATC handle and acpi_scan_dep_init()
31 runs, this sees 3 dependencies on the acpi_dep_list and initializes
32 unmet_dep to 3. Later when the dependency for I2C1 is met unmet_dep
33 becomes 2, but since the 2 GPIO deps where already met it never becomes 0
34 causing battery monitoring to not work.
35
36 Fix this by modifying acpi_scan_dep_init() to not increase dep_met for
37 dependencies which have already been marked as being met.
38
39 Fixes: 3ba12d8de3fa ("ACPI: scan: Reduce overhead related to devices with dependencies")
40 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
41 Cc: 6.5+ <stable@vger.kernel.org> # 6.5+
42 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
43 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
44 ---
45 drivers/acpi/scan.c | 3 ++-
46 1 file changed, 2 insertions(+), 1 deletion(-)
47
48 --- a/drivers/acpi/scan.c
49 +++ b/drivers/acpi/scan.c
50 @@ -1802,7 +1802,8 @@ static void acpi_scan_dep_init(struct ac
51 if (dep->honor_dep)
52 adev->flags.honor_deps = 1;
53
54 - adev->dep_unmet++;
55 + if (!dep->met)
56 + adev->dep_unmet++;
57 }
58 }
59 }