Re: [PATCH 2/2] spi: sh-msiof: Use DMA if possible

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

 



Hi Hoan-san,

On Fri, Jan 11, 2019 at 9:59 AM Nguyen An Hoan <na-hoan@xxxxxxxxxxx> wrote:
> From: Hoan Nguyen An <na-hoan@xxxxxxxxxxx>
>
> Currently, this driver only supports feature for DMA 32-bits.
> In this case, only if the data length is divisible by 4 to use
> DMA, otherwise PIO will be used. This patch will suggest use
> the DMA 32-bits with 4bytes of words, then the remaining data
> will be transmitted by PIO mode.
>
> Signed-off-by: Hoan Nguyen An <na-hoan@xxxxxxxxxxx>

Thanks for your patch, that's a great idea!

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
with a small suggestion below.

> --- a/drivers/spi/spi-sh-msiof.c
> +++ b/drivers/spi/spi-sh-msiof.c
> @@ -937,17 +937,13 @@ static int sh_msiof_transfer_one(struct spi_master *master,
>                 unsigned int l = 0;
>
>                 if (tx_buf)
> -                       l = min(len, p->tx_fifo_size * 4);
> +                       l = min(len - len % 4, p->tx_fifo_size * 4);

I think this would be easier to read when written as:

    l = min(round_down(len, 4), p->tx_fifo_size * 4);

>                 if (rx_buf)
> -                       l = min(len, p->rx_fifo_size * 4);
> +                       l = min(len - len % 4, p->rx_fifo_size * 4);

Likewise,

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



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux