linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: fix cs_change for last transfer
Date: Mon, 16 Mar 2020 12:17:50 +0000	[thread overview]
Message-ID: <20200316121750.GD5010@sirena.org.uk> (raw)
In-Reply-To: <45912ba25c34a63b8098f471c3c8ebf8857a4716.1584292056.git.mirq-linux@rere.qmqm.pl>

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

On Sun, Mar 15, 2020 at 06:08:53PM +0100, Michał Mirosław wrote:

> Generic spi_transfer_one_message() implementation introduced in
> commit b158935f70b9 has a bug in cs_change handling: it keeps CS
> asserted when cs_change is set. Fix it.

>  	struct spi_transfer *xfer;
> -	bool keep_cs = false;
> +	bool keep_cs = true;
>  	int ret = 0;
>  	struct spi_statistics *statm = &ctlr->statistics;
>  	struct spi_statistics *stats = &msg->spi->statistics;
> @@ -1268,7 +1268,7 @@ static int spi_transfer_one_message(struct spi_controller *ctlr,
>  		if (xfer->cs_change) {
>  			if (list_is_last(&xfer->transfer_list,
>  					 &msg->transfers)) {
> -				keep_cs = true;
> +				keep_cs = false;
>  			} else {

This is the opposite of the intended behaviour - we want to deassert
chip select at the end of the message unless cs_change is set on the
last transfer.  If this were broken I would expect to see widespread
problems being reported.

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

  reply	other threads:[~2020-03-16 12:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-15 17:08 [PATCH] spi: fix cs_change for last transfer Michał Mirosław
2020-03-16 12:17 ` Mark Brown [this message]
2020-03-16 14:34   ` Michał Mirosław
2020-03-16 15:13     ` 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=20200316121750.GD5010@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    /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).