From: Abel Vesa <abel.vesa@linaro.org>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
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: Sat, 9 Nov 2024 12:35:13 +0200 [thread overview]
Message-ID: <Zy864W7sysWZbCTd@linaro.org> (raw)
In-Reply-To: <20241106150605.1017744-1-heikki.krogerus@linux.intel.com>
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.
> if (ret < 0)
> goto err_reset;
>
[...]
next prev parent reply other threads:[~2024-11-09 10:35 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 [this message]
2024-11-11 9:09 ` Heikki Krogerus
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=Zy864W7sysWZbCTd@linaro.org \
--to=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=heikki.krogerus@linux.intel.com \
--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).