aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJisheng Zhang <jszhang@kernel.org>2023-08-06 17:20:56 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-22 15:29:29 +0200
commit22130dae0533c474e4e0db930a88caa9b397d083 (patch)
treefa0cda6f33617266e24fa448369ee235ea5cd776
parentdt-bindings: serial: snps-dw-apb-uart: make interrupt optional (diff)
downloadlinux-rng-22130dae0533c474e4e0db930a88caa9b397d083.tar.xz
linux-rng-22130dae0533c474e4e0db930a88caa9b397d083.zip
serial: 8250_dw: fall back to poll if there's no interrupt
When there's no irq(this can be due to various reasons, for example, no irq from HW support, or we just want to use poll solution, and so on), falling back to poll is still better than no support at all. Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Link: https://lore.kernel.org/r/20230806092056.2467-3-jszhang@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/8250/8250_dw.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 7db51781289e..f4cafca1a7da 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -523,7 +523,10 @@ static int dw8250_probe(struct platform_device *pdev)
if (!regs)
return dev_err_probe(dev, -EINVAL, "no registers defined\n");
- irq = platform_get_irq(pdev, 0);
+ irq = platform_get_irq_optional(pdev, 0);
+ /* no interrupt -> fall back to polling */
+ if (irq == -ENXIO)
+ irq = 0;
if (irq < 0)
return irq;