From: Rosen Penev <rosenp@gmail.com>
To: linux-spi@vger.kernel.org
Cc: Mark Brown <broonie@kernel.org>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] spi: ppc4xx: use of_property_read_u32 for clock frequency
Date: Tue, 28 Jul 2026 13:29:32 -0700 [thread overview]
Message-ID: <20260728202932.16207-1-rosenp@gmail.com> (raw)
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
next reply other threads:[~2026-07-28 20:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 20:29 Rosen Penev [this message]
2026-07-30 18:44 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260728202932.16207-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®