[RFC PATCH v2 07/21] serial: 8250_pnp: Add support for deferred probe
Sunil V L
sunilvl at ventanamicro.com
Wed Oct 25 13:23:30 PDT 2023
With pnp_irq() able to return error code, enhance the serial pnp driver
to support deferred probing. Return -EPROBE_DEFER when pnp_irq() returns
the same so that the driver probe is deferred.
Signed-off-by: Sunil V L <sunilvl at ventanamicro.com>
---
drivers/tty/serial/8250/8250_pnp.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index 1974bbadc975..dcb3daf7c816 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -8,6 +8,7 @@
*
* Ported to the Linux PnP Layer - (C) Adam Belay.
*/
+#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/pnp.h>
@@ -443,8 +444,21 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
}
memset(&uart, 0, sizeof(uart));
- if (pnp_irq_valid(dev, 0))
- uart.port.irq = pnp_irq(dev, 0);
+ if (pnp_irq_valid(dev, 0)) {
+ ret = pnp_irq(dev, 0);
+ if (ret == -EPROBE_DEFER) {
+ struct resource r;
+
+ ret = acpi_irq_get(ACPI_HANDLE(&dev->dev), 0, &r);
+ if (!ret)
+ uart.port.irq = r.start;
+ else
+ return ret;
+ } else {
+ uart.port.irq = ret;
+ }
+ }
+
if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) {
uart.port.iobase = pnp_port_start(dev, 2);
uart.port.iotype = UPIO_PORT;
--
2.39.2
More information about the linux-riscv
mailing list