mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linuxarm@huawei.com, fengsheng <fengsheng5@huawei.com>
Subject: Re: [PATCH] spi: dw: use "smp_mb()" to avoid sending spi data error
Date: Fri, 27 Dec 2019 00:22:40 +0000	[thread overview]
Message-ID: <20191227002239.GH27497@sirena.org.uk> (raw)
In-Reply-To: <1577352088-35856-1-git-send-email-kong.kongxinwei@hisilicon.com>

[-- Attachment #1: Type: text/plain, Size: 911 bytes --]

On Thu, Dec 26, 2019 at 05:21:28PM +0800, Xinwei Kong wrote:
> this patch will add memory barrier to ensure this "struct dw_spi *dws"
> to complete data setting before enabling this SPI hardware interrupt.
> eg:
> it will fix to this following low possibility error in testing environment
> which using SPI control to connect TPM Modules

> --- a/drivers/spi/spi-dw.c
> +++ b/drivers/spi/spi-dw.c
> @@ -288,6 +288,8 @@ static int dw_spi_transfer_one(struct spi_controller *master,
>  	dws->rx_end = dws->rx + transfer->len;
>  	dws->len = transfer->len;
>  
> +	smp_mb();
> +
>  	spi_enable_chip(dws, 0);

I'd be much more comfortable here if I understood what this was
supposed to be syncing - what exactly gets flushed here and why
is a memory barrier enough to ensure it's synced?  A comment in
the code would be especially good so anyone modifying the code
understands this in future.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-12-27  0:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-26  9:21 Xinwei Kong
2019-12-27  0:22 ` Mark Brown [this message]
2019-12-28  8:31   ` kongxinwei
2020-01-03  1:04     ` Mark Brown
2020-01-03  1:34       ` kongxinwei

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=20191227002239.GH27497@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=fengsheng5@huawei.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    /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

all inboxes | Powered by JetHome®