On Tue, Jan 31, 2012 at 8:54 AM, Tobias Klauser <tklau...@distanz.ch> wrote:
> From: Frederic Lambert <frdr...@gmail.com>
>
> Until now we let the code in spi.c assign us the bus number if the platform
> device didn't specify its id. This patch adds the possibility to explicitely
> specify the bus number via device tree.
>
> Signed-off-by: Frederic Lambert <frdr...@gmail.com>
> Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
> ---
> diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
> index 4813a63..d5bf52b 100644
> --- a/drivers/spi/spi-altera.c
> +++ b/drivers/spi/spi-altera.c
> @@ -226,6 +226,15 @@ static int __devinit altera_spi_probe(struct 
> platform_device *pdev)
>        if (!master)
>                return err;
>
> +       /* bus_num is dynamically assigned when undefined (see spi.c)  */
> +       /* look for a DTS entry to override this */
> +       if (pdev->id == -1 && pdev->dev.of_node != 0) {
> +               u32 tmp;
> +
> +               if (of_property_read_u32(pdev->dev.of_node, "bus-number", 
> &tmp) == 0)
> +                       pdev->id = tmp;

BTW, it is absolutely illegal for device drivers to modify the
pdev->id field.  Once a device is registered, the id and name cannot
be changed.

g.

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to