Skip to contentSkip to conversation

spi: ppc4xx: use of_property_read_u32 for clock frequency

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: ppc4xx: use of_property_read_u32 for clock frequency

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
---
 drivers/spi/spi-ppc4xx.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/spi/spi-ppc4xx.c +7 -9
index 95c034cf2336..8a7d5aec12c1 100644
@@ -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);
 
Signature · 1 line
2.55.0
maintainer
#1 lore raw
Quoted 1 line · Rosen Penev

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