stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: Try to get ACPI GPIO IRQ earlier
@ 2025-11-02 19:09 Hans de Goede
  2025-11-03  9:35 ` Andy Shevchenko
  2025-11-06 11:34 ` Mark Brown
  0 siblings, 2 replies; 11+ messages in thread
From: Hans de Goede @ 2025-11-02 19:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: Hans de Goede, Andy Shevchenko, linux-spi, linux-acpi, stable

Since commit d24cfee7f63d ("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: d24cfee7f63d ("spi: Fix acpi deferred irq probe")
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hansg@kernel.org>
---
 drivers/spi/spi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 2e0647a06890..8588e8562220 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2851,6 +2851,16 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
 	acpi_set_modalias(adev, acpi_device_hid(adev), spi->modalias,
 			  sizeof(spi->modalias));
 
+	/*
+	 * This gets re-tried in spi_probe() for -EPROBE_DEFER handling in case
+	 * the GPIO controller does not have a driver yet. This needs to be done
+	 * here too, because this call sets the GPIO direction and/or bias.
+	 * Setting these needs to be done even if there is no driver, in which
+	 * case spi_probe() will never get called.
+	 */
+	if (spi->irq < 0)
+		spi->irq = acpi_dev_gpio_irq_get(adev, 0);
+
 	acpi_device_set_enumerated(adev);
 
 	adev->power.flags.ignore_parent = true;
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-11-06 13:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-02 19:09 [PATCH] spi: Try to get ACPI GPIO IRQ earlier Hans de Goede
2025-11-03  9:35 ` Andy Shevchenko
2025-11-03  9:57   ` Hans de Goede
2025-11-03 10:13     ` Andy Shevchenko
2025-11-03 10:20       ` Hans de Goede
2025-11-03 13:15         ` Andy Shevchenko
2025-11-06 10:16           ` Andy Shevchenko
2025-11-06 11:34 ` Mark Brown
2025-11-06 12:23   ` Hans de Goede
2025-11-06 13:05     ` Mark Brown
2025-11-06 13:09     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).