lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210201123853.GA2465@kuha.fi.intel.com>
Date:   Mon, 1 Feb 2021 14:38:53 +0200
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     Benson Leung <bleung@...omium.org>
Cc:     enric.balletbo@...labora.com, pmalani@...omium.org,
        gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org, groeck@...omium.org,
        bleung@...gle.com
Subject: Re: [PATCH 1/6] usb: typec: Standardize PD Revision format with
 Type-C Revision

On Thu, Jan 28, 2021 at 10:14:01PM -0800, Benson Leung wrote:
> The Type-C Revision was in a specific BCD format "0120H" for 1.2.
> USB PD revision numbers follow a similar pattern with "0300H" for 3.0.
> 
> Standardizes the sysfs format for usb_power_delivery_revision
> to align with the BCD format used for usb_typec_revision.
> 
> Example values:
> - "2.0": USB Power Delivery Release 2.0
> - "3.0": USB Power Delivery Release 3.0
> - "3.1": USB Power Delivery Release 3.1
> 
> Signed-off-by: Benson Leung <bleung@...omium.org>

I guess it's OK to modify the ABI like this.

Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>

> ---
>  Documentation/ABI/testing/sysfs-class-typec | 7 ++++++-
>  drivers/usb/typec/class.c                   | 3 ++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/ABI/testing/sysfs-class-typec b/Documentation/ABI/testing/sysfs-class-typec
> index 8eab41e79ce6..b61480535fdc 100644
> --- a/Documentation/ABI/testing/sysfs-class-typec
> +++ b/Documentation/ABI/testing/sysfs-class-typec
> @@ -105,7 +105,12 @@ Date:		April 2017
>  Contact:	Heikki Krogerus <heikki.krogerus@...ux.intel.com>
>  Description:
>  		Revision number of the supported USB Power Delivery
> -		specification, or 0 when USB Power Delivery is not supported.
> +		specification, or 0.0 when USB Power Delivery is not supported.
> +
> +		Example values:
> +		- "2.0": USB Power Delivery Release 2.0
> +		- "3.0": USB Power Delivery Release 3.0
> +		- "3.1": USB Power Delivery Release 3.1
>  
>  What:		/sys/class/typec/<port>/usb_typec_revision
>  Date:		April 2017
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 8f77669f9cf4..4f60ee7ba76a 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -1500,8 +1500,9 @@ static ssize_t usb_power_delivery_revision_show(struct device *dev,
>  						char *buf)
>  {
>  	struct typec_port *p = to_typec_port(dev);
> +	u16 rev = p->cap->pd_revision;
>  
> -	return sprintf(buf, "%d\n", (p->cap->pd_revision >> 8) & 0xff);
> +	return sprintf(buf, "%d.%d\n", (rev >> 8) & 0xff, (rev >> 4) & 0xf);
>  }
>  static DEVICE_ATTR_RO(usb_power_delivery_revision);
>  
> -- 
> 2.30.0.365.g02bc693789-goog

thanks,

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ