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

Arnd Bergmann arnd at arndb.de
Mon Mar 5 07:29:59 EST 2012


On Sunday 04 March 2012, Michael Walle wrote:
> > @@ -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


More information about the devicetree-discuss mailing list