Thread (1 message) 1 message, 1 author, 2012-03-04

[PATCH 1/5 v2] ARM: kirkwood: covert orion-spi to fdt.

From: arnd@arndb.de (Arnd Bergmann)
Date: 2012-03-04 20:29:59
Also in: linux-devicetree

On Sunday 04 March 2012, Michael Walle wrote:
quoted
@@ -481,8 +485,26 @@ static int __init orion_spi_probe(struct
platform_device *pdev) spi->master = master;
      spi->spi_info = spi_info;

-     spi->max_speed = DIV_ROUND_UP(spi_info->tclk, 4);
-     spi->min_speed = DIV_ROUND_UP(spi_info->tclk, 30);
+     if (spi_info)
+             spi->tclk = spi_info->tclk;
+
+     of_property_read_u32(master->dev.of_node,
+                             "clock-frequency", &spi->tclk);
+
+     if (!spi->tclk) {
+             dev_err(&pdev->dev, "cannot set clock rate\n");
shouldn't you check the return value of of_property_read_u32 instead? and 
report a more meaningful error message, eg no valid clock-frequency property 
in the OF case?
I suggested this version, because it keeps the code very simple. Checking
the return value would of course be correct, but I don't think we
need any extra information here: there are only a few ways how this can
go wrong and it will be pretty obvious from the device tree when you
see the message.

	Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help