linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Abel Vesa <abel.vesa@linaro.org>
Cc: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Jameson Thies <jthies@google.com>,
	Benson Leung <bleung@chromium.org>,
	Bartosz Szpila <bszpila@google.com>,
	"Katiyar, Pooja" <pooja.katiyar@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH v2] usb: typec: ucsi: Convert connector specific commands to bitmaps
Date: Mon, 11 Nov 2024 11:09:04 +0200	[thread overview]
Message-ID: <ZzHJsAco2VQw3R1i@kuha.fi.intel.com> (raw)
In-Reply-To: <Zy864W7sysWZbCTd@linaro.org>

On Sat, Nov 09, 2024 at 12:35:13PM +0200, Abel Vesa wrote:
> On 24-11-06 17:06:05, Heikki Krogerus wrote:
> > That allows the fields in those command data structures to
> > be easily validated. If an unsupported field is accessed, a
> > warning is generated.
> > 
> > This will not force UCSI version checks to be made in every
> > place where these data structures are accessed, but it will
> > make it easier to pinpoint issues that are caused by the
> > unconditional accesses to those fields, and perhaps more
> > importantly, allow those issues to be noticed immediately.
> > 
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > ---
> > 
> > Changed since v1:
> > - The CONCAP macro now reads the correct member.
> > 
> > I added the version to all the field definitions that need it instead
> > of adding a complete macro for each of those fields. I think that
> > should be enough to make the version clear to everybody during use as
> > well as review.
> > 
> > ---
> >  drivers/usb/typec/ucsi/psy.c       |  28 ++--
> >  drivers/usb/typec/ucsi/trace.h     |  28 ++--
> >  drivers/usb/typec/ucsi/ucsi.c      | 121 +++++++-------
> >  drivers/usb/typec/ucsi/ucsi.h      | 252 +++++++++++++++++------------
> >  drivers/usb/typec/ucsi/ucsi_acpi.c |   7 +-
> >  5 files changed, 240 insertions(+), 196 deletions(-)
> > 
> 
> [...]
> 
> > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> > index e430a0ca4a2b..974a441155e1 100644
> > --- a/drivers/usb/typec/ucsi/ucsi.c
> > +++ b/drivers/usb/typec/ucsi/ucsi.c
> 
> [...]
> 
> > @@ -1778,7 +1775,7 @@ static int ucsi_init(struct ucsi *ucsi)
> >  
> >  	/* Get PPM capabilities */
> >  	command = UCSI_GET_CAPABILITY;
> > -	ret = ucsi_send_command(ucsi, command, &ucsi->cap, sizeof(ucsi->cap));
> > +	ret = ucsi_send_command(ucsi, command, &ucsi->cap, UCSI_GET_CAPABILITY_SIZE);
> 
> This fails for version < UCSI_VERSION_2_0. Size is wrong.

Thanks for catching that. I'll send the fix.

-- 
heikki

      reply	other threads:[~2024-11-11  9:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 15:06 [PATCH v2] usb: typec: ucsi: Convert connector specific commands to bitmaps Heikki Krogerus
2024-11-07 19:19 ` Abhishek Pandit-Subedi
2024-11-09 10:35 ` Abel Vesa
2024-11-11  9:09   ` 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=ZzHJsAco2VQw3R1i@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=abel.vesa@linaro.org \
    --cc=abhishekpandit@chromium.org \
    --cc=bleung@chromium.org \
    --cc=bszpila@google.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jthies@google.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=pooja.katiyar@intel.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;
as well as URLs for NNTP newsgroup(s).