From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Peter Korsgaard <peter@korsgaard.com>,
javier.carrasco@wolfvision.net, neal@gompa.dev,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: tipd: drop double register read in tps6598x_interrupt
Date: Mon, 10 Nov 2025 10:16:03 +0200 [thread overview]
Message-ID: <aRGebbVWwNV0cK1x@kuha.fi.intel.com> (raw)
In-Reply-To: <2025110840-varnish-exhale-c362@gregkh>
Sat, Nov 08, 2025 at 09:43:14AM +0900, Greg KH kirjoitti:
> On Fri, Nov 07, 2025 at 04:03:36PM +0100, Peter Korsgaard wrote:
> > >>>>> "Greg" == Greg KH <gregkh@linuxfoundation.org> writes:
> >
> > > On Thu, Nov 06, 2025 at 05:48:49PM +0100, Peter Korsgaard wrote:
> > >> Commit 409c1cfb5a80 ("usb: typec: tipd: fix event checking for tps6598x")
> > >> added (by accident?) a double read of the TPS_REG_INT_EVENT1 register. Drop
> > >> that.
> >
> > > Are you sure? Sometimes 2 reads are required. How was this tested?
> >
> > Hard to be 100% sure, but the code did not have a double read before the
> > above commit and sticking a printk in the driver like this:
> >
> > diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> > index 01db27cbf1d1..6687d192dbd4 100644
> > --- a/drivers/usb/typec/tipd/core.c
> > +++ b/drivers/usb/typec/tipd/core.c
> > @@ -536,8 +536,9 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
> > intev_len = TPS_65987_8_INTEVENT_LEN;
> >
> > ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
> > -
> > + printk(KERN_ERR "1st: %llx %llx\n", event1[0], event1[1]);
> > ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
> > + printk(KERN_ERR "2nd: %llx %llx\n", event1[0], event1[1]);
> > if (ret) {
> > dev_err(tps->dev, "%s: failed to read event1\n", __func__);
> > goto err_unlock;
> >
> >
> > and (un)plugging the USB cable I see:
> >
> > [ 3267.257341] 1st: 3000008 0
> > [ 3267.262097] 2nd: 3000008 0
> >
> > [ 3267.345179] 1st: 1000000 0
> > [ 3267.350512] 2nd: 1000000 0
> >
> > [ 3267.388947] 1st: 1000000 0
> > [ 3267.393707] 2nd: 1000000 0
> >
> > [ 3267.912112] 1st: 1000000 0
> > [ 3267.916872] 2nd: 1000000 0
> >
> > [ 3268.049505] 1st: 1000000 0
> > [ 3268.054773] 2nd: 1000000 0
> >
> > [ 3269.105173] 1st: 1000000 0
> > [ 3269.109970] 2nd: 1000000 0
> >
> > [ 3280.049111] 1st: 3000008 0
> > [ 3280.053865] 2nd: 3000008 0
> >
> > So I am fairly sure it is not needed.
>
> Sometimes hardware requires it, even if it is not noticed by the actual
> read value, so I would like to get an ack from the original author on
> this before accepting it.
The hardware should not require it. Javier, can you comment on this?
If there really is need to do double read, then there needs to be a
comment explaining why IMO.
thanks,
--
heikki
prev parent reply other threads:[~2025-11-10 8:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 16:48 [PATCH] usb: typec: tipd: drop double register read in tps6598x_interrupt Peter Korsgaard
2025-11-07 8:36 ` Greg KH
2025-11-07 15:03 ` Peter Korsgaard
2025-11-08 0:43 ` Greg KH
2025-11-10 8:16 ` Heikki Krogerus [this message]
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=aRGebbVWwNV0cK1x@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=javier.carrasco@wolfvision.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=neal@gompa.dev \
--cc=peter@korsgaard.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