linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emil Renner Berthing <kernel@esmil.dk>
To: Jon Lin <jon.lin@rock-chips.com>
Cc: Mark Brown <broonie@kernel.org>, Heiko Stuebner <heiko@sntech.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-spi@vger.kernel.org,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 3/3] spi: rockchip: Fix error in SPI slave pio read
Date: Wed, 22 Jul 2020 14:11:03 +0200	[thread overview]
Message-ID: <CANBLGczKsvrOb-AnB3MGi2RJOuFDoSY=S8enLtJZVAV2baGUgg@mail.gmail.com> (raw)
In-Reply-To: <20200722083737.8820-3-jon.lin@rock-chips.com>

On Wed, 22 Jul 2020 at 10:38, Jon Lin <jon.lin@rock-chips.com> wrote:
>
> The RXFLR is possible larger than rx_left in Rockchip SPI, fix it.
>
> Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>

In addition to my review and test you should probably also add
Fixes: 01b59ce5dac8 ("spi: rockchip: use irq rather than polling")
..so this will be picked up in the stable trees

/Emil

> ---
>  drivers/spi/spi-rockchip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
> index a451dacab5cf..75a8a9428ff8 100644
> --- a/drivers/spi/spi-rockchip.c
> +++ b/drivers/spi/spi-rockchip.c
> @@ -291,7 +291,7 @@ static void rockchip_spi_pio_writer(struct rockchip_spi *rs)
>  static void rockchip_spi_pio_reader(struct rockchip_spi *rs)
>  {
>         u32 words = readl_relaxed(rs->regs + ROCKCHIP_SPI_RXFLR);
> -       u32 rx_left = rs->rx_left - words;
> +       u32 rx_left = (rs->rx_left > words) ? rs->rx_left - words : 0;
>
>         /* the hardware doesn't allow us to change fifo threshold
>          * level while spi is enabled, so instead make sure to leave
> --
> 2.17.1
>
>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2020-07-22 12:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  8:37 [PATCH v2 1/3] spi: rockchip: Config spi rx dma burst size depend on xfer length Jon Lin
2020-07-22  8:37 ` [PATCH v2 2/3] spi: rockchip: Support 64-location deep FIFOs Jon Lin
2020-07-22  8:37 ` [PATCH v2 3/3] spi: rockchip: Fix error in SPI slave pio read Jon Lin
2020-07-22 12:11   ` Emil Renner Berthing [this message]
2020-07-22 12:08 ` [PATCH v2 1/3] spi: rockchip: Config spi rx dma burst size depend on xfer length Emil Renner Berthing
2020-07-30 22:28 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANBLGczKsvrOb-AnB3MGi2RJOuFDoSY=S8enLtJZVAV2baGUgg@mail.gmail.com' \
    --to=kernel@esmil.dk \
    --cc=broonie@kernel.org \
    --cc=heiko@sntech.de \
    --cc=jon.lin@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).