[PATCH 3/4] ata: pata_mpc52xx: convert to platform_get_irq()

From: Rosen Penev

Date: Mon Jun 08 2026 - 17:54:03 EST


Replace irq_of_parse_and_map() with platform_get_irq(), which returns
a negative errno on failure and integrates with the platform device
model. Since platform_get_irq() does not create a separately managed
mapping, the corresponding irq_dispose_mapping() calls in the probe
error path and remove function are no longer needed.

Remove most gotos from probe. Simpler to return directly.

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/ata/pata_mpc52xx.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index 1246b705a411..d27390eda98e 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -21,7 +21,6 @@
#include <linux/libata.h>
#include <linux/of.h>
#include <linux/of_address.h>
-#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/types.h>

@@ -730,18 +729,14 @@ static int mpc52xx_ata_probe(struct platform_device *op)
if ((prop) && (proplen >= 4))
udma_mask = ATA_UDMA2 & ((1 << (*prop + 1)) - 1);

- ata_irq = irq_of_parse_and_map(op->dev.of_node, 0);
- if (!ata_irq) {
- dev_err(&op->dev, "error mapping irq\n");
- return -EINVAL;
- }
+ ata_irq = platform_get_irq(op, 0);
+ if (ata_irq < 0)
+ return ata_irq;

/* Prepare our private structure */
priv = devm_kzalloc(&op->dev, sizeof(*priv), GFP_KERNEL);
- if (!priv) {
- rv = -ENOMEM;
- goto err1;
- }
+ if (!priv)
+ return -ENOMEM;

priv->ipb_period = 1000000000 / (ipb_freq / 1000);
priv->ata_regs = ata_regs;
@@ -762,8 +757,7 @@ static int mpc52xx_ata_probe(struct platform_device *op)
dmatsk = bcom_ata_init(MAX_DMA_BUFFERS, MAX_DMA_BUFFER_SIZE);
if (!dmatsk) {
dev_err(&op->dev, "bestcomm initialization failed\n");
- rv = -ENOMEM;
- goto err1;
+ return -ENOMEM;
}

task_irq = bcom_get_task_irq(dmatsk);
@@ -796,8 +790,6 @@ static int mpc52xx_ata_probe(struct platform_device *op)
free_irq(task_irq, priv);
err_free_task:
bcom_ata_release(dmatsk);
- err1:
- irq_dispose_mapping(ata_irq);
return rv;
}

@@ -814,7 +806,6 @@ static void mpc52xx_ata_remove(struct platform_device *op)
task_irq = bcom_get_task_irq(priv->dmatsk);
free_irq(task_irq, priv);
bcom_ata_release(priv->dmatsk);
- irq_dispose_mapping(priv->ata_irq);
}

#ifdef CONFIG_PM_SLEEP
--
2.54.0