* [PATCH] spi: spi-mpc52xx: use platform_get_irq_optional for IRQ lookup
@ 2026-07-27 19:47 Rosen Penev
2026-07-30 11:54 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-07-27 19:47 UTC (permalink / raw)
To: linux-spi; +Cc: Mark Brown, open list
Replace irq_of_parse_and_map() calls with platform_get_irq_optional()
to fetch both IRQs in the probe function. This is a more portable
approach that works with both DT and non-DT platforms and follows
modern platform API conventions.
The -EPROBE_DEFER case is handled properly so deferred probe works
as expected, and invalid IRQ numbers are normalized to 0.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/spi/spi-mpc52xx.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index 70d8e17e8c43..563b1f627be9 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -392,6 +392,18 @@ static int mpc52xx_spi_probe(struct platform_device *op)
void __iomem *regs;
u8 ctrl1;
int rc, i = 0;
+ int irq0;
+ int irq1;
+
+ irq0 = platform_get_irq_optional(op, 0);
+ if (irq0 == -EPROBE_DEFER)
+ return irq0;
+ irq0 = max(irq0, 0);
+
+ irq1 = platform_get_irq_optional(op, 1);
+ if (irq1 == -EPROBE_DEFER)
+ return irq1;
+ irq1 = max(irq1, 0);
/* MMIO registers */
dev_dbg(&op->dev, "probing mpc5200 SPI device\n");
@@ -436,8 +448,8 @@ static int mpc52xx_spi_probe(struct platform_device *op)
ms = spi_controller_get_devdata(host);
ms->host = host;
ms->regs = regs;
- ms->irq0 = irq_of_parse_and_map(op->dev.of_node, 0);
- ms->irq1 = irq_of_parse_and_map(op->dev.of_node, 1);
+ ms->irq0 = irq0;
+ ms->irq1 = irq1;
ms->state = mpc52xx_spi_fsmstate_idle;
ms->ipb_freq = mpc5xxx_get_bus_frequency(&op->dev);
ms->gpio_cs_count = gpiod_count(&op->dev, NULL);
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] spi: spi-mpc52xx: use platform_get_irq_optional for IRQ lookup
2026-07-27 19:47 [PATCH] spi: spi-mpc52xx: use platform_get_irq_optional for IRQ lookup Rosen Penev
@ 2026-07-30 11:54 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-07-30 11:54 UTC (permalink / raw)
To: linux-spi, Rosen Penev; +Cc: linux-kernel
On Mon, 27 Jul 2026 12:47:14 -0700, Rosen Penev wrote:
> spi: spi-mpc52xx: use platform_get_irq_optional for IRQ lookup
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.3
Thanks!
[1/1] spi: spi-mpc52xx: use platform_get_irq_optional for IRQ lookup
https://git.kernel.org/broonie/spi/c/09d083d6757a
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-30 15:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-27 19:47 [PATCH] spi: spi-mpc52xx: use platform_get_irq_optional for IRQ lookup Rosen Penev
2026-07-30 11:54 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®