From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH] spi: Fix acpi deferred irq probe
Date: Fri, 22 Nov 2024 10:42:24 +0100 [thread overview]
Message-ID: <20241122094224.226773-1-stanislaw.gruszka@linux.intel.com> (raw)
When probing spi device take care of deferred probe of ACPI irq gpio
similar like for OF/DT case.
From practical standpoint this fixes issue with vsc-tp driver on
Dell XP 9340 laptop, which try to request interrupt with spi->irq
equal to -EPROBE_DEFER and fail to probe with the following error:
vsc-tp spi-INTC10D0:00: probe with driver vsc-tp failed with error -22
Suggested-by: Hans de Goede <hdegoede@redhat.com>
Fixes: 33ada67da352 ("ACPI / spi: attach GPIO IRQ from ACPI description to SPI device")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
---
drivers/spi/spi.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index c1dad30a4528..0f3e6e2c2474 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -424,6 +424,16 @@ static int spi_probe(struct device *dev)
spi->irq = 0;
}
+ if (has_acpi_companion(dev) && spi->irq < 0) {
+ struct acpi_device *adev = to_acpi_device_node(dev->fwnode);
+
+ spi->irq = acpi_dev_gpio_irq_get(adev, 0);
+ if (spi->irq == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ if (spi->irq < 0)
+ spi->irq = 0;
+ }
+
ret = dev_pm_domain_attach(dev, true);
if (ret)
return ret;
@@ -2869,9 +2879,6 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
acpi_set_modalias(adev, acpi_device_hid(adev), spi->modalias,
sizeof(spi->modalias));
- 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.34.1
next reply other threads:[~2024-11-22 9:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 9:42 Stanislaw Gruszka [this message]
2024-11-23 17:24 ` [PATCH] spi: Fix acpi deferred irq probe Hans de Goede
2024-11-24 19:23 ` Alexis Lothoré
2024-11-25 10:05 ` Hans de Goede
2024-11-25 12:34 ` Alexis Lothoré
2024-11-25 12:44 ` intel_vsc probe issues on XPS 9320 (was Re: [PATCH] spi: Fix acpi deferred irq probe) Hans de Goede
2024-11-25 13:40 ` Alexis Lothoré
2024-11-25 17:33 ` [PATCH] spi: Fix acpi deferred irq probe Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241122094224.226773-1-stanislaw.gruszka@linux.intel.com \
--to=stanislaw.gruszka@linux.intel.com \
--cc=broonie@kernel.org \
--cc=hdegoede@redhat.com \
--cc=linux-spi@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox