Skip to contentSkip to conversation

serial: ucc_uart: Use platform IRQ helper

PATCH In review Rosen Penev 3 participants 4 messages Sep 27 – Oct 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 serial: ucc_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 before any allocation or anything to avoid dealing with gotos.

Assisted-by LLM

---
v2: move platform_get_irq() earlier.

 drivers/tty/serial/ucc_uart.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/tty/serial/ucc_uart.c +6 -8
index 6b7dcbbacd13..96e3c9534de7 100644
@@ -26,7 +26,6 @@
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
-#include <linux/of_irq.h>
 #include <linux/dma-mapping.h>
 
 #include <soc/fsl/qe/ucc_slow.h>
@@ -1238,8 +1237,13 @@ static int ucc_uart_probe(struct platform_device *ofdev)
 	struct uart_qe_port *qe_port = NULL;
 	struct resource res;
 	u32 val;
+	int irq;
 	int ret;
 
+	irq = platform_get_irq(ofdev, 0);
+	if (irq < 0)
+		return irq;
+
 	/*
 	 * Determine if we need Soft-UART mode
 	 */
@@ -1338,13 +1342,7 @@ static int ucc_uart_probe(struct platform_device *ofdev)
 		goto out_free;
 	}
 
-	qe_port->port.irq = irq_of_parse_and_map(np, 0);
-	if (qe_port->port.irq == 0) {
-		dev_err(&ofdev->dev, "could not map IRQ for UCC%u\n",
-		       qe_port->ucc_num + 1);
-		ret = -EINVAL;
-		goto out_free;
-	}
+	qe_port->port.irq = irq;
 
 	/*
 	 * Newer device trees have an "fsl,qe" compatible property for the QE
Signature · 1 line
2.55.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 7 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 before any allocation or anything to avoid dealing with gotos.

Assisted-by LLM

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 4 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 before any allocation or anything to avoid dealing with gotos.

I can't really parse this, what is the bug here that you are fixing?

Quoted 4 lines
Assisted-by LLM

---
v2: move platform_get_irq() earlier.

Why?

thanks,

greg k-h

#3 lore raw
Quoted 7 lines · Greg Kroah-Hartman
Quoted 4 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 before any allocation or anything to avoid dealing with gotos.

Quoted 8 lines

I can't really parse this, what is the bug here that you are fixing?

Quoted 4 lines
Assisted-by LLM

---
v2: move platform_get_irq() earlier.

Why?

this was reported by sashiko in v1:

[Severity: High]
If platform_get_irq() returns -EPROBE_DEFER here, does this leak the asynchronous firmware load initiated by the preceding call to soft_uart_init()?

Quoted 4 lines

thanks,

greg k-h