Skip to content

Commit d24cfee

Browse files
sgruszkabroonie
authored andcommitted
spi: Fix acpi deferred irq probe
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 <[email protected]> Fixes: 33ada67 ("ACPI / spi: attach GPIO IRQ from ACPI description to SPI device") Cc: [email protected] Signed-off-by: Stanislaw Gruszka <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Tested-by: Alexis Lothoré <[email protected]> # Dell XPS9320, ov01a10 Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 2ac40e6 commit d24cfee

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/spi/spi.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,16 @@ static int spi_probe(struct device *dev)
424424
spi->irq = 0;
425425
}
426426

427+
if (has_acpi_companion(dev) && spi->irq < 0) {
428+
struct acpi_device *adev = to_acpi_device_node(dev->fwnode);
429+
430+
spi->irq = acpi_dev_gpio_irq_get(adev, 0);
431+
if (spi->irq == -EPROBE_DEFER)
432+
return -EPROBE_DEFER;
433+
if (spi->irq < 0)
434+
spi->irq = 0;
435+
}
436+
427437
ret = dev_pm_domain_attach(dev, true);
428438
if (ret)
429439
return ret;
@@ -2866,9 +2876,6 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
28662876
acpi_set_modalias(adev, acpi_device_hid(adev), spi->modalias,
28672877
sizeof(spi->modalias));
28682878

2869-
if (spi->irq < 0)
2870-
spi->irq = acpi_dev_gpio_irq_get(adev, 0);
2871-
28722879
acpi_device_set_enumerated(adev);
28732880

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

0 commit comments

Comments
 (0)