Re: [RFC PATCH v2 10/12] spi: core: convert spi_master to use gpio_desc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chris,

On Fri, Jul 28, 2017 at 12:03 AM, Chris Packham
<chris.packham@xxxxxxxxxxxxxxxxxxx> wrote:
> Instead of numeric gpios make struct spi_master hold an array of struct
> gpio_desc. For now struct spi_device still maintains a numeric gpio
> which will be updated in a subsequent change.
>
> Signed-off-by: Chris Packham <chris.packham@xxxxxxxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -40,6 +40,7 @@
>  #include <linux/ioport.h>
>  #include <linux/acpi.h>
>  #include <linux/highmem.h>
> +#include <linux/gpio/consumer.h>
>
>  #define CREATE_TRACE_POINTS
>  #include <trace/events/spi.h>
> @@ -531,7 +532,9 @@ int spi_add_device(struct spi_device *spi)
>         }
>
>         if (ctlr->cs_gpios)

As desc_to_gpio() crashes when passed a NULL pointer, the above check should
be changed to:

        if (ctlr->cs_gpios && ctlr->cs_gpios[spi->chip_select])

> -               spi->cs_gpio = ctlr->cs_gpios[spi->chip_select];
> +               spi->cs_gpio = desc_to_gpio(ctlr->cs_gpios[spi->chip_select]);
> +       else
> +               spi->cs_gpio = -ENOENT;

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux