On Thu, Feb 07, 2013 at 02:12:11PM +0100, Andreas Larsson wrote:
> This relies upon of_spi_register_master to find out which gpios to use.
> 
> Signed-off-by: Andreas Larsson <andr...@gaisler.com>
> ---
>  drivers/spi/spi-fsl-lib.h |    1 +
>  drivers/spi/spi-fsl-spi.c |   53 +++++++++++++++++++++++++++++++++++++++-----
>  2 files changed, 48 insertions(+), 6 deletions(-)

Just a couple of minor nits...

> diff --git a/drivers/spi/spi-fsl-lib.h b/drivers/spi/spi-fsl-lib.h
> index d5c788b..52db693 100644
> --- a/drivers/spi/spi-fsl-lib.h
> +++ b/drivers/spi/spi-fsl-lib.h
> @@ -71,6 +71,7 @@ struct mpc8xxx_spi {
>  
>  #ifdef CONFIG_SPI_FSL_SPI
>       int type;
> +     int native_chipselects;
>       u8 max_bits_per_word;
>  
>       void (*set_shifts)(u32 *rx_shift, u32 *tx_shift,
> diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
> index 55652e6..2befe16 100644
> --- a/drivers/spi/spi-fsl-spi.c
> +++ b/drivers/spi/spi-fsl-spi.c
> @@ -418,7 +418,7 @@ static int fsl_spi_setup(struct spi_device *spi)
>  {
>       struct mpc8xxx_spi *mpc8xxx_spi;
>       struct fsl_spi_reg *reg_base;
> -     int retval;
> +     int retval, desel;

We don't usually place variable declarations on the same line, unless the
variables are closely related.

>       u32 hw_mode;
>       struct spi_mpc8xxx_cs   *cs = spi->controller_state;
>  
> @@ -456,12 +456,45 @@ static int fsl_spi_setup(struct spi_device *spi)
>               return retval;
>       }
>  
> +     if (mpc8xxx_spi->type == TYPE_GRLIB) {
> +             if (gpio_is_valid(spi->cs_gpio)) {

<- You can place the 'int desel;' here, limiting the visibility for it.

> +                     retval = gpio_request(spi->cs_gpio,
> +                                           dev_name(&spi->dev));
> +                     if (retval)
> +                             return retval;
> +
> +                     desel = !(spi->mode & SPI_CS_HIGH);
> +                     desel ^= !!(spi->cs_gpio_flags & OF_GPIO_ACTIVE_LOW);
> +                     retval = gpio_direction_output(spi->cs_gpio, desel);
> +                     if (retval) {
> +                             gpio_free(spi->cs_gpio);
> +                             return retval;
> +                     }

Thanks,
Anton

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to