* [PATCH] spi: ppc4xx: use of_property_read_u32 for clock frequency
@ 2026-07-28 20:29 Rosen Penev
2026-07-30 18:44 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-07-28 20:29 UTC (permalink / raw)
To: linux-spi; +Cc: Mark Brown, open list
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 <rosenp@gmail.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] spi: ppc4xx: use of_property_read_u32 for clock frequency
2026-07-28 20:29 [PATCH] spi: ppc4xx: use of_property_read_u32 for clock frequency Rosen Penev
@ 2026-07-30 18:44 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-07-30 18:44 UTC (permalink / raw)
To: linux-spi, Rosen Penev; +Cc: linux-kernel
On Tue, 28 Jul 2026 13:29:32 -0700, Rosen Penev wrote:
> spi: ppc4xx: use of_property_read_u32 for clock frequency
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.3
Thanks!
[1/1] spi: ppc4xx: use of_property_read_u32 for clock frequency
https://git.kernel.org/broonie/spi/c/26bbeaa8b3b9
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 23:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-28 20:29 [PATCH] spi: ppc4xx: use of_property_read_u32 for clock frequency Rosen Penev
2026-07-30 18:44 ` 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®