public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: linux-i2c@vger.kernel.org,
	Conor Dooley <conor.dooley@microchip.com>,
	Daire McNamara <daire.mcnamara@microchip.com>,
	Wolfram Sang <wsa@kernel.org>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] i2c: microchip-core: actually use repeated sends
Date: Tue, 1 Oct 2024 14:02:18 +0100	[thread overview]
Message-ID: <20241001-boring-livestock-0158ccc3fa88@spud> (raw)
In-Reply-To: <jzkzcnd5rdprxpw734ppcr5ti23qkppfxs55nse36wcqxff7e3@4ea2lyl7feoo>

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

On Tue, Oct 01, 2024 at 02:45:20PM +0200, Andi Shyti wrote:
> Hi Conor,
> 
> On Mon, Sep 30, 2024 at 02:38:27PM GMT, Conor Dooley wrote:
> > From: Conor Dooley <conor.dooley@microchip.com>
> > 
> > At present, where repeated sends are intended to be used, the
> > i2c-microchip-core driver sends a stop followed by a start. Lots of i2c
> > devices must not malfunction in the face of this behaviour, because the
> > driver has operated like this for years! Try to keep track of whether or
> > not a repeated send is required, and suppress sending a stop in these
> > cases.
> > 
> > Fixes: 64a6f1c4987e ("i2c: add support for microchip fpga i2c controllers")
> 
> I don't think the Fixes tag is needed here if everything worked
> until now, unless you got some other device that requires this
> change and you need to explain it.

I think the fixes tag is accurate, because it only happened to work on
the limited set of devices I and others tried. This patch came about cos
I got reports of it being broken in 6.6

> If this is more an improvement (because it has worked), then we
> shouldn't add the Fixes tag.
> 
> In any case, when patches are going to stable, we need to Cc
> stable too.
> 
> Cc: <stable@vger.kernel.org> # v6.0+
> 
> (This is specified in the
> Documentation/process/stable-kernel-rules.rst and I'm starting to
> enforce it here).

Yah, some maintainers want to add the tags themselves, so got into a
(bad?) habit of leaving them out. I can add it if there's a v2.

> 
> > Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> 
> ...
> 
> > +	/*
> > +	 * If there's been an error, the isr needs to return control
> > +	 * to the "main" part of the driver, so as not to keep sending
> > +	 * messages once it completes and clears the SI bit.
> > +	 */
> > +	if (idev->msg_err) {
> > +		complete(&idev->msg_complete);
> > +		return;
> > +	}
> > +
> > +	this_msg = (idev->msg_queue)++;
> 
> do we need parenthesis here?

I suppose not, do you want a v2 if that's the only change?

> 
> ...
> 
> > +	/*
> > +	 * The isr controls the flow of a transfer, this info needs to be saved
> > +	 * to a location that it can access the queue information from.
> > +	 */
> > +	idev->restart_needed = false;
> > +	idev->msg_queue = msgs;
> > +	idev->total_num = num;
> > +	idev->current_num = 0;
> > +
> > +	/*
> > +	 * But the first entry to the isr is triggered by the start in this
> > +	 * function, so the first message needs to be "dequeued".
> > +	 */
> > +	idev->addr = i2c_8bit_addr_from_msg(this_msg);
> > +	idev->msg_len = this_msg->len;
> > +	idev->buf = this_msg->buf;
> > +	idev->msg_err = 0;
> > +
> > +	if (idev->total_num > 1) {
> > +		struct i2c_msg *next_msg = msgs + 1;
> > +
> > +		idev->restart_needed = next_msg->flags & I2C_M_RD;
> > +	}
> > +
> > +	idev->current_num++;
> > +	idev->msg_queue++;
> 
> Can we initialize only once? This part is just adding extra code.

I don't agree that it is extra code, I think it is clearer like this as
I intentionally wrote it this way.

> The rest looks good. I just need to know if Wolfram has some more
> observations here.
> 
> Thanks,
> Andi

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

  reply	other threads:[~2024-10-01 13:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 13:38 [PATCH v1] i2c: microchip-core: actually use repeated sends Conor Dooley
2024-10-01  8:50 ` Wolfram Sang
2024-10-01 10:16   ` Conor Dooley
2024-10-24  9:36     ` Conor Dooley
2024-12-06 11:48       ` Conor Dooley
2024-12-17 18:35         ` Conor Dooley
2024-10-01 12:45 ` Andi Shyti
2024-10-01 13:02   ` Conor Dooley [this message]
2024-10-02  8:42     ` Andi Shyti

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=20241001-boring-livestock-0158ccc3fa88@spud \
    --to=conor@kernel.org \
    --cc=andi.shyti@kernel.org \
    --cc=conor.dooley@microchip.com \
    --cc=daire.mcnamara@microchip.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=wsa@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