All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jameson Thies <jthies@google.com>,
	Benson Leung <bleung@chromium.org>,
	Prashant Malani <pmalani@chromium.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	linux-usb@vger.kernel.org, "Pilla,
	Siva sai kumar" <siva.sai.kumar.pilla@intel.com>,
	Abhishek Pandit-Subedi <abhishekpandit@google.com>,
	Bartosz Szpila <bszpila@google.com>
Subject: Re: [PATCH v2 1/6] usb: typec: ucsi: Remove unused fields from struct ucsi_connector_status
Date: Thu, 22 Aug 2024 14:24:12 +0300	[thread overview]
Message-ID: <Zscf3IXZuepUqqv6@kuha.fi.intel.com> (raw)
In-Reply-To: <CANFp7mUB4oiyEfh4P5cOucvdaWaC5N=OwcVdZ0Wm8EKBf=Ss9w@mail.gmail.com>

Hi Abhishek,

I'm sorry to keep you waiting.

> You have me convinced on the "failing loudly" part but I'm still
> confused about the "how".
> 
> Making sure we always check versions to access the bits makes me think
> we need wrappers on casting to the rightly versioned connector status.
> Should we be versioning access for everything that's not in UCSI 1.2
> then?
> 
> Example:
> 
> struct ucsi_connector_status_raw {
>   u8 bytes[19];
> };
> 
> struct ucsi_connector_status_v1 {
>   ...
> };
> 
> struct ucsi_connector_status_v2 {
>   ...
> };
> 
> struct ucsi_connector_status_v1* get_connector_status_v1(struct
> ucsi_connector *con) {
>   return (struct ucsi_connector_status_v1 *)con->raw_status;
> }
> 
> struct ucsi_connector_status_v2* get_connector_status_v2(struct
> ucsi_connector *con) {
>   return con->ucsi->version >= UCSI_VERSION_2_0 ? (struct
> ucsi_connector_status_v2 *)&con->raw_status : NULL;
> }
> 
> /* Read all bits supported by the current version. */
> int ucsi_read_connector_status(struct ucsi_connector *con, struct
> ucsi_connector_status_raw *raw_conn_status);

I'll take a look at this next week. Right now I have to focus on
other tasks.

Br,

-- 
heikki

  reply	other threads:[~2024-08-22 11:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-16 13:58 [PATCH v2 0/6] usb: typec: ucsi: Minor improvements Heikki Krogerus
2024-08-16 13:58 ` [PATCH v2 1/6] usb: typec: ucsi: Remove unused fields from struct ucsi_connector_status Heikki Krogerus
2024-08-19  0:02   ` Abhishek Pandit-Subedi
2024-08-19 11:11     ` Heikki Krogerus
2024-08-19 23:23       ` Abhishek Pandit-Subedi
2024-08-20 13:12         ` Heikki Krogerus
2024-08-20 16:48           ` Abhishek Pandit-Subedi
2024-08-22 11:24             ` Heikki Krogerus [this message]
2024-08-27 15:23               ` Heikki Krogerus
2024-08-16 13:58 ` [PATCH v2 2/6] usb: typec: ucsi: Don't truncate the reads Heikki Krogerus
2024-08-18 23:59   ` Abhishek Pandit-Subedi
2024-08-16 13:58 ` [PATCH v2 3/6] usb: typec: ucsi: Only assign the identity structure if the PPM supports it Heikki Krogerus
2024-08-19  0:04   ` Abhishek Pandit-Subedi
2024-08-16 13:58 ` [PATCH v2 4/6] usb: typec: ucsi: Common function for the GET_PD_MESSAGE command Heikki Krogerus
2024-08-16 13:58 ` [PATCH v2 5/6] usb: typec: ucsi: Call CANCEL from single location Heikki Krogerus
2024-08-16 13:58 ` [PATCH v2 6/6] usb: typec: ucsi: Remove useless error check from ucsi_read_error() 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=Zscf3IXZuepUqqv6@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=abhishekpandit@chromium.org \
    --cc=abhishekpandit@google.com \
    --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=pmalani@chromium.org \
    --cc=siva.sai.kumar.pilla@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.