[PATCH] spi: ppc4xx: use of_property_read_u32 for clock frequency
Rosen Penev <[email protected]> Tue, 28 Jul 2026 13:29:32 -0700
| Newsgroups | org.kernel.vger.linux-spi,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Replace of_get_property with of_property_read_u32 for the "clock-frequency" property, which is the modern typed DT accessor that returns an error code directly and avoids the raw const unsigned int * pointer dance. Also drop the dev_err_probe wrapper on devm_request_irq failure, returning ret directly since the core already logs probe errors. Get rid of irqnum in the private struct. It's only used in _probe. Was used in _remove before devm to free the irq. Assisted-by: opencode:big-pickle Signed-off-by: Rosen Penev <[email protected]> --- drivers/spi/spi-ppc4xx.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c index 95c034cf2336..8a7d5aec12c1 100644 --- a/drivers/spi/spi-ppc4xx.c +++ b/drivers/spi/spi-ppc4xx.c @@ -112,7 +112,6 @@ struct ppc4xx_spi { struct spi_bitbang bitbang; struct completion done; - int irqnum; /* need this to set the SPI clock */ unsigned int opb_freq; @@ -339,7 +338,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) struct device *dev = &op->dev; struct device_node *opbnp; int ret; - const unsigned int *clk; + unsigned int opb_freq; void __iomem *regs; int irqnum; @@ -390,22 +389,21 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) return -ENODEV; } /* Get the clock (Hz) for the OPB */ - clk = of_get_property(opbnp, "clock-frequency", NULL); + ret = of_property_read_u32(opbnp, "clock-frequency", &opb_freq); of_node_put(opbnp); - if (clk == NULL) { + if (ret) { dev_err(dev, "OPB: no clock-frequency property set\n"); return -ENODEV; } - hw->opb_freq = *clk; - hw->opb_freq >>= 2; + hw->opb_freq = opb_freq; + hw->opb_freq >>= 2; hw->regs = regs; - hw->irqnum = irqnum; - ret = devm_request_irq(&op->dev, hw->irqnum, spi_ppc4xx_int, + ret = devm_request_irq(&op->dev, irqnum, spi_ppc4xx_int, 0, "spi_ppc4xx_of", hw); if (ret) - return dev_err_probe(dev, ret, "unable to allocate interrupt\n"); + return ret; spi_ppc4xx_enable(hw); -- 2.55.0