Skip to contentSkip to conversation

serial: arc_uart: Use platform IRQ helper

PATCH Superseded Rosen Penev 3 participants 6 messages Sep 25 – Oct 2

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: arc_uart: Use platform IRQ helper

Avoid calling irq_dispose_mapping() by letting the platform_device machinery handle it. Also enable possibility of handling -EPROBE_DEFER and other errors. Handle as early as possible to avoid doing unnecessary work.

---
 drivers/tty/serial/arc_uart.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/tty/serial/arc_uart.c +6 -2
index 3988e5958896..b46b057a181b 100644
@@ -30,7 +30,6 @@
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
 #include <linux/io.h>
-#include <linux/of_irq.h>
 #include <linux/of_address.h>
 
 /*************************************
@@ -571,12 +570,17 @@ static int arc_serial_probe(struct platform_device *pdev)
 	struct arc_uart_port *uart;
 	struct uart_port *port;
 	int dev_id;
+	int irq;
 	u32 val;
 
 	/* no device tree device */
 	if (!np)
 		return -ENODEV;
 
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
 	dev_id = of_alias_get_id(np, "serial");
 	if (dev_id < 0)
 		dev_id = 0;
@@ -607,7 +611,7 @@ static int arc_serial_probe(struct platform_device *pdev)
 		return PTR_ERR(port->membase);
 	}
 
-	port->irq = irq_of_parse_and_map(np, 0);
+	port->irq = irq;
 
 	port->dev = &pdev->dev;
 	port->iotype = UPIO_MEM;
Signature · 1 line
2.55.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines

Avoid calling irq_dispose_mapping() by letting the platform_device machinery handle it. Also enable possibility of handling -EPROBE_DEFER and other errors. Handle as early as possible to avoid doing unnecessary work.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Rosen Penev
Quoted 53 lines · Rosen Penev

Avoid calling irq_dispose_mapping() by letting the platform_device machinery handle it. Also enable possibility of handling -EPROBE_DEFER and other errors. Handle as early as possible to avoid doing unnecessary work.

---
 drivers/tty/serial/arc_uart.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/tty/serial/arc_uart.c +6 -2
index 3988e5958896..b46b057a181b 100644
@@ -30,7 +30,6 @@
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
 #include <linux/io.h>
-#include <linux/of_irq.h>
 #include <linux/of_address.h>
 
 /*************************************
@@ -571,12 +570,17 @@ static int arc_serial_probe(struct platform_device *pdev)
 	struct arc_uart_port *uart;
 	struct uart_port *port;
 	int dev_id;
+	int irq;
 	u32 val;
 
 	/* no device tree device */
 	if (!np)
 		return -ENODEV;
 
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
 	dev_id = of_alias_get_id(np, "serial");
 	if (dev_id < 0)
 		dev_id = 0;
@@ -607,7 +611,7 @@ static int arc_serial_probe(struct platform_device *pdev)
 		return PTR_ERR(port->membase);
 	}
 
-	port->irq = irq_of_parse_and_map(np, 0);
+	port->irq = irq;
 
 	port->dev = &pdev->dev;
 	port->iotype = UPIO_MEM;
Signature · 1 line
2.55.0

You forgot an Assisted-by: tag here :(

#3 lore raw
Quoted 49 lines · Greg Kroah-Hartman
Quoted 47 lines · Rosen Penev

Avoid calling irq_dispose_mapping() by letting the platform_device machinery handle it. Also enable possibility of handling -EPROBE_DEFER and other errors. Handle as early as possible to avoid doing unnecessary work.

---
 drivers/tty/serial/arc_uart.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/tty/serial/arc_uart.c +6 -2
index 3988e5958896..b46b057a181b 100644
@@ -30,7 +30,6 @@
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
 #include <linux/io.h>
-#include <linux/of_irq.h>
 #include <linux/of_address.h>
 
 /*************************************
@@ -571,12 +570,17 @@ static int arc_serial_probe(struct platform_device *pdev)
      struct arc_uart_port *uart;
      struct uart_port *port;
      int dev_id;
+     int irq;
      u32 val;
 
      /* no device tree device */
      if (!np)
              return -ENODEV;
 
+     irq = platform_get_irq(pdev, 0);
+     if (irq < 0)
+             return irq;
+
      dev_id = of_alias_get_id(np, "serial");
      if (dev_id < 0)
              dev_id = 0;
@@ -607,7 +611,7 @@ static int arc_serial_probe(struct platform_device *pdev)
              return PTR_ERR(port->membase);
      }
 
-     port->irq = irq_of_parse_and_map(np, 0);
+     port->irq = irq;
 
Quoted 8 lines
Quoted 6 lines
drivers/tty/serial/arc_uart.c +0 -1
      port->dev = &pdev->dev;
      port->iotype = UPIO_MEM;
--

2.55.0

You forgot an Assisted-by: tag here :(

No LLM used here.

#4 lore raw
Quoted 59 lines · Rosen Penev
Quoted 49 lines · Greg Kroah-Hartman
Quoted 47 lines · Rosen Penev

Avoid calling irq_dispose_mapping() by letting the platform_device machinery handle it. Also enable possibility of handling -EPROBE_DEFER and other errors. Handle as early as possible to avoid doing unnecessary work.

---
 drivers/tty/serial/arc_uart.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/tty/serial/arc_uart.c +6 -2
index 3988e5958896..b46b057a181b 100644
@@ -30,7 +30,6 @@
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
 #include <linux/io.h>
-#include <linux/of_irq.h>
 #include <linux/of_address.h>
 
 /*************************************
@@ -571,12 +570,17 @@ static int arc_serial_probe(struct platform_device *pdev)
      struct arc_uart_port *uart;
      struct uart_port *port;
      int dev_id;
+     int irq;
      u32 val;
 
      /* no device tree device */
      if (!np)
              return -ENODEV;
 
+     irq = platform_get_irq(pdev, 0);
+     if (irq < 0)
+             return irq;
+
      dev_id = of_alias_get_id(np, "serial");
      if (dev_id < 0)
              dev_id = 0;
@@ -607,7 +611,7 @@ static int arc_serial_probe(struct platform_device *pdev)
              return PTR_ERR(port->membase);
      }
 
-     port->irq = irq_of_parse_and_map(np, 0);
+     port->irq = irq;
 
Quoted 8 lines
Quoted 6 lines
drivers/tty/serial/arc_uart.c +0 -1
      port->dev = &pdev->dev;
      port->iotype = UPIO_MEM;
--

2.55.0

You forgot an Assisted-by: tag here :(

Quoted 1 line

No LLM used here.

Then what tool was used to find this issue?

#5 lore raw
Quoted 61 lines · Greg Kroah-Hartman
Quoted 59 lines · Rosen Penev
Quoted 57 lines · Greg Kroah-Hartman
Quoted 50 lines · Rosen Penev

Avoid calling irq_dispose_mapping() by letting the platform_device machinery handle it. Also enable possibility of handling -EPROBE_DEFER and other errors. Handle as early as possible to avoid doing unnecessary work.

---
 drivers/tty/serial/arc_uart.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/tty/serial/arc_uart.c +6 -3
index 3988e5958896..b46b057a181b 100644
@@ -30,7 +30,6 @@
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
 #include <linux/io.h>
-#include <linux/of_irq.h>
 #include <linux/of_address.h>
 
 /*************************************
@@ -571,12 +570,17 @@ static int arc_serial_probe(struct platform_device *pdev)
      struct arc_uart_port *uart;
      struct uart_port *port;
      int dev_id;
+     int irq;
      u32 val;
 
      /* no device tree device */
      if (!np)
              return -ENODEV;
 
+     irq = platform_get_irq(pdev, 0);
+     if (irq < 0)
+             return irq;
+
      dev_id = of_alias_get_id(np, "serial");
      if (dev_id < 0)
              dev_id = 0;
@@ -607,7 +611,7 @@ static int arc_serial_probe(struct platform_device *pdev)
              return PTR_ERR(port->membase);
      }
 
-     port->irq = irq_of_parse_and_map(np, 0);
+     port->irq = irq;
 
      port->dev = &pdev->dev;
      port->iotype = UPIO_MEM;
--
Quoted 3 lines

2.55.0

You forgot an Assisted-by: tag here :(

Quoted 3 lines
Quoted 1 line

No LLM used here.

Then what tool was used to find this issue?

git grep irq_of_parse_and_map