Re: [PATCH 1/1] spi: Re-do correctly function name and 'ret' return value

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

 



Hi Hiep-san,

On Fri, Apr 24, 2015 at 8:40 AM, Cao Minh Hiep <cm-hiep@xxxxxxxxxxx> wrote:
> From: Hiep Cao Minh <cm-hiep@xxxxxxxxxxx>
>
> qspi_trigger_transfer_out_int function should be qspi_trigger_transfer_out_in
> without "t". "ret" value in rspi_dma_check_then_transfer should be returned
> insteeds of returning zero. It just returns qspi_trigger_transfer_out_in() value
> in qspi_transfer_out_in().

Thanks for your patch!

I guess Mark will want you to split this in 3 separate patches, as it does 3
different things...

> Signed-off-by: Hiep Cao Minh <cm-hiep@xxxxxxxxxxx>
> ---
>  drivers/spi/spi-rspi.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
> index 186924a..9304a6d 100644
> --- a/drivers/spi/spi-rspi.c
> +++ b/drivers/spi/spi-rspi.c
> @@ -670,7 +670,7 @@ static int rspi_dma_check_then_transfer(struct rspi_data *rspi,
>                 int ret = rspi_dma_transfer(rspi, &xfer->tx_sg,
>                                         xfer->rx_buf ? &xfer->rx_sg : NULL);
>                 if (ret != -EAGAIN)
> -                       return 0;
> +                       return ret;
>         }
>
>         return -EAGAIN;

Upon closer look, you can just drop the "if" check, and return "ret"
unconditionally. Or better, drop "ret", and just use

        return rspi_dma_transfer(...);

To reduce indentation, the function can be rewritten like:

static int rspi_dma_check_then_transfer(struct rspi_data *rspi,
                                         struct spi_transfer *xfer)
{
        if (!rspi->master->can_dma || !__rspi_can_dma(rspi, xfer))
                return -EAGAIN;

        /* rx_buf can be NULL on RSPI on SH in TX-only Mode */
        return rspi_dma_transfer(rspi, &xfer->tx_sg,
                                        xfer->rx_buf ? &xfer->rx_sg : NULL);
}

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