Re: [PATCH v2 1/6] usb: typec: ucsi: Remove unused fields from struct ucsi_connector_status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux