Skip to content

Commit 68fea3e

Browse files
Hans de Goedegregkh
authored andcommitted
spi: Try to get ACPI GPIO IRQ earlier
commit 3cd2018 upstream. Since commit d24cfee ("spi: Fix acpi deferred irq probe"), the acpi_dev_gpio_irq_get() call gets delayed till spi_probe() is called on the SPI device. If there is no driver for the SPI device then the move to spi_probe() results in acpi_dev_gpio_irq_get() never getting called. This may cause problems by leaving the GPIO pin floating because this call is responsible for setting up the GPIO pin direction and/or bias according to the values from the ACPI tables. Re-add the removed acpi_dev_gpio_irq_get() in acpi_register_spi_device() to ensure the GPIO pin is always correctly setup, while keeping the acpi_dev_gpio_irq_get() call added to spi_probe() to deal with -EPROBE_DEFER returns caused by the GPIO controller not having a driver yet. Link: https://bbs.archlinux.org/viewtopic.php?id=302348 Fixes: d24cfee ("spi: Fix acpi deferred irq probe") Cc: [email protected] Signed-off-by: Hans de Goede <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 71b42c2 commit 68fea3e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/spi/spi.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,6 +2866,16 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
28662866
acpi_set_modalias(adev, acpi_device_hid(adev), spi->modalias,
28672867
sizeof(spi->modalias));
28682868

2869+
/*
2870+
* This gets re-tried in spi_probe() for -EPROBE_DEFER handling in case
2871+
* the GPIO controller does not have a driver yet. This needs to be done
2872+
* here too, because this call sets the GPIO direction and/or bias.
2873+
* Setting these needs to be done even if there is no driver, in which
2874+
* case spi_probe() will never get called.
2875+
*/
2876+
if (spi->irq < 0)
2877+
spi->irq = acpi_dev_gpio_irq_get(adev, 0);
2878+
28692879
acpi_device_set_enumerated(adev);
28702880

28712881
adev->power.flags.ignore_parent = true;

0 commit comments

Comments
 (0)