Skip to content

Commit bcf0595

Browse files
jwrdegoededtor
authored andcommitted
Input: soc_button_array - partial revert of support for newer surface devices
Commit c394159 ("Input: soc_button_array - add support for newer surface devices") not only added support for the MSHW0040 ACPI HID, but for some reason it also makes changes to the error handling of the soc_button_lookup_gpio() call in soc_button_device_create(). Note ideally this seamingly unrelated change would have been made in a separate commit, with a message explaining the what and why of this change. I guess this change may have been added to deal with -EPROBE_DEFER errors, but in case of the existing support for PNP0C40 devices, treating -EPROBE_DEFER as any other error is deliberate, see the comment this commit adds for why. The actual returning of -EPROBE_DEFER to the caller of soc_button_probe() introduced by the new error checking causes a serious regression: On devices with so called virtual GPIOs soc_button_lookup_gpio() will always return -EPROBE_DEFER for these fake GPIOs, when this happens during the second call of soc_button_device_create() we already have successfully registered our first child. This causes the kernel to think we are making progress with probing things even though we unregister the child before again before we return the -EPROBE_DEFER. Since we are making progress the kernel will retry deferred-probes again immediately ending up stuck in a loop with the following showing in dmesg: [ 124.022697] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6537 [ 124.040764] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6538 [ 124.056967] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6539 [ 124.072143] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6540 [ 124.092373] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6541 [ 124.108065] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6542 [ 124.128483] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6543 [ 124.147141] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6544 [ 124.165070] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6545 [ 124.179775] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6546 [ 124.202726] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6547 <continues on and on and on> And 1 CPU core being stuck at 100% and udev hanging since it is waiting for the modprobe of soc_button_array to return. This patch reverts the soc_button_lookup_gpio() error handling changes, fixing this regression. Fixes: c394159 ("Input: soc_button_array - add support for newer surface devices") BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205031 Signed-off-by: Hans de Goede <[email protected]> Tested-by: Maximilian Luz <[email protected]> Acked-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent bd3b848 commit bcf0595

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/input/misc/soc_button_array.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,18 @@ soc_button_device_create(struct platform_device *pdev,
9292
continue;
9393

9494
gpio = soc_button_lookup_gpio(&pdev->dev, info->acpi_index);
95-
if (gpio < 0 && gpio != -ENOENT) {
96-
error = gpio;
97-
goto err_free_mem;
98-
} else if (!gpio_is_valid(gpio)) {
99-
/* Skip GPIO if not present */
95+
if (!gpio_is_valid(gpio)) {
96+
/*
97+
* Skip GPIO if not present. Note we deliberately
98+
* ignore -EPROBE_DEFER errors here. On some devices
99+
* Intel is using so called virtual GPIOs which are not
100+
* GPIOs at all but some way for AML code to check some
101+
* random status bits without need a custom opregion.
102+
* In some cases the resources table we parse points to
103+
* such a virtual GPIO, since these are not real GPIOs
104+
* we do not have a driver for these so they will never
105+
* show up, therefore we ignore -EPROBE_DEFER.
106+
*/
100107
continue;
101108
}
102109

0 commit comments

Comments
 (0)