Skip to contentSkip to conversation

spi: spi-mpc52xx: use platform_get_irq_optional for IRQ lookup

PATCH In review Rosen Penev 2 participants 2 messages Jul 27 – Jul 30 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: spi-mpc52xx: use platform_get_irq_optional for IRQ lookup

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.

---
 drivers/spi/spi-mpc52xx.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/spi/spi-mpc52xx.c +14 -2
index 70d8e17e8c43..563b1f627be9 100644
@@ -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);
Signature · 1 line
2.55.0
maintainer
#1 lore raw
Quoted 1 line · Rosen Penev

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