[PATCH 1/4] usb: typec: ucsi: Clean up UCSI_CABLE_PROP macros

Jameson Thies posted 4 patches 1 year, 11 months ago
There is a newer version of this series
[PATCH 1/4] usb: typec: ucsi: Clean up UCSI_CABLE_PROP macros
Posted by Jameson Thies 1 year, 11 months ago
Clean up UCSI_CABLE_PROP macros by fixing a bitmask shifting error for
plug type and updating the modal support macro for consistent naming.

Fixes: 3cf657f07918 ("usb: typec: ucsi: Remove all bit-fields")
Signed-off-by: Jameson Thies <jthies@google.com>
---
Tested by building v6.6 kernel.

 drivers/usb/typec/ucsi/ucsi.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index 7e35ffbe0a6f..469a2baf472e 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -259,12 +259,12 @@ struct ucsi_cable_property {
 #define UCSI_CABLE_PROP_FLAG_VBUS_IN_CABLE	BIT(0)
 #define UCSI_CABLE_PROP_FLAG_ACTIVE_CABLE	BIT(1)
 #define UCSI_CABLE_PROP_FLAG_DIRECTIONALITY	BIT(2)
-#define UCSI_CABLE_PROP_FLAG_PLUG_TYPE(_f_)	((_f_) & GENMASK(3, 0))
+#define UCSI_CABLE_PROP_FLAG_PLUG_TYPE(_f_)	(((_f_) & GENMASK(4, 3)) >> 3)
 #define   UCSI_CABLE_PROPERTY_PLUG_TYPE_A	0
 #define   UCSI_CABLE_PROPERTY_PLUG_TYPE_B	1
 #define   UCSI_CABLE_PROPERTY_PLUG_TYPE_C	2
 #define   UCSI_CABLE_PROPERTY_PLUG_OTHER	3
-#define UCSI_CABLE_PROP_MODE_SUPPORT		BIT(5)
+#define UCSI_CABLE_PROP_FLAG_MODE_SUPPORT	BIT(5)
 	u8 latency;
 } __packed;
 
-- 
2.44.0.rc0.258.g7320e95886-goog
Re: [PATCH 1/4] usb: typec: ucsi: Clean up UCSI_CABLE_PROP macros
Posted by Heikki Krogerus 1 year, 11 months ago
On Fri, Feb 23, 2024 at 01:03:25AM +0000, Jameson Thies wrote:
> Clean up UCSI_CABLE_PROP macros by fixing a bitmask shifting error for
> plug type and updating the modal support macro for consistent naming.
> 
> Fixes: 3cf657f07918 ("usb: typec: ucsi: Remove all bit-fields")
> Signed-off-by: Jameson Thies <jthies@google.com>

This is missing CC stable.

> ---
> Tested by building v6.6 kernel.
> 
>  drivers/usb/typec/ucsi/ucsi.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> index 7e35ffbe0a6f..469a2baf472e 100644
> --- a/drivers/usb/typec/ucsi/ucsi.h
> +++ b/drivers/usb/typec/ucsi/ucsi.h
> @@ -259,12 +259,12 @@ struct ucsi_cable_property {
>  #define UCSI_CABLE_PROP_FLAG_VBUS_IN_CABLE	BIT(0)
>  #define UCSI_CABLE_PROP_FLAG_ACTIVE_CABLE	BIT(1)
>  #define UCSI_CABLE_PROP_FLAG_DIRECTIONALITY	BIT(2)
> -#define UCSI_CABLE_PROP_FLAG_PLUG_TYPE(_f_)	((_f_) & GENMASK(3, 0))
> +#define UCSI_CABLE_PROP_FLAG_PLUG_TYPE(_f_)	(((_f_) & GENMASK(4, 3)) >> 3)
>  #define   UCSI_CABLE_PROPERTY_PLUG_TYPE_A	0
>  #define   UCSI_CABLE_PROPERTY_PLUG_TYPE_B	1
>  #define   UCSI_CABLE_PROPERTY_PLUG_TYPE_C	2
>  #define   UCSI_CABLE_PROPERTY_PLUG_OTHER	3
> -#define UCSI_CABLE_PROP_MODE_SUPPORT		BIT(5)
> +#define UCSI_CABLE_PROP_FLAG_MODE_SUPPORT	BIT(5)
>  	u8 latency;
>  } __packed;
>  
> -- 
> 2.44.0.rc0.258.g7320e95886-goog

-- 
heikki
Re: [PATCH 1/4] usb: typec: ucsi: Clean up UCSI_CABLE_PROP macros
Posted by Jameson Thies 1 year, 11 months ago
> This is missing CC stable.

Ack. I'm planning a v2 version of this series to address the other
comments and will CC stable there.
Re: [PATCH 1/4] usb: typec: ucsi: Clean up UCSI_CABLE_PROP macros
Posted by Dmitry Baryshkov 1 year, 11 months ago
On Fri, 23 Feb 2024 at 03:04, Jameson Thies <jthies@google.com> wrote:
>
> Clean up UCSI_CABLE_PROP macros by fixing a bitmask shifting error for
> plug type and updating the modal support macro for consistent naming.
>
> Fixes: 3cf657f07918 ("usb: typec: ucsi: Remove all bit-fields")
> Signed-off-by: Jameson Thies <jthies@google.com>
> ---
> Tested by building v6.6 kernel.
>
>  drivers/usb/typec/ucsi/ucsi.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

-- 
With best wishes
Dmitry
Re: [PATCH 1/4] usb: typec: ucsi: Clean up UCSI_CABLE_PROP macros
Posted by Prashant Malani 1 year, 11 months ago
On Thu, Feb 22, 2024 at 5:04 PM Jameson Thies <jthies@google.com> wrote:
>
> Clean up UCSI_CABLE_PROP macros by fixing a bitmask shifting error for
> plug type and updating the modal support macro for consistent naming.
>
> Fixes: 3cf657f07918 ("usb: typec: ucsi: Remove all bit-fields")
> Signed-off-by: Jameson Thies <jthies@google.com>
 I think you should CC stable@ for this patch.

That apart:
Reviewed-by: Prashant Malani <pmalani@chromium.org>
Re: [PATCH 1/4] usb: typec: ucsi: Clean up UCSI_CABLE_PROP macros
Posted by Benson Leung 1 year, 11 months ago
Hi Jameson,

On Fri, Feb 23, 2024 at 01:03:25AM +0000, Jameson Thies wrote:
> Clean up UCSI_CABLE_PROP macros by fixing a bitmask shifting error for
> plug type and updating the modal support macro for consistent naming.
> 
> Fixes: 3cf657f07918 ("usb: typec: ucsi: Remove all bit-fields")
> Signed-off-by: Jameson Thies <jthies@google.com>

Reviewed-by: Benson Leung <bleung@chromium.org>

> ---
> Tested by building v6.6 kernel.
> 
>  drivers/usb/typec/ucsi/ucsi.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> index 7e35ffbe0a6f..469a2baf472e 100644
> --- a/drivers/usb/typec/ucsi/ucsi.h
> +++ b/drivers/usb/typec/ucsi/ucsi.h
> @@ -259,12 +259,12 @@ struct ucsi_cable_property {
>  #define UCSI_CABLE_PROP_FLAG_VBUS_IN_CABLE	BIT(0)
>  #define UCSI_CABLE_PROP_FLAG_ACTIVE_CABLE	BIT(1)
>  #define UCSI_CABLE_PROP_FLAG_DIRECTIONALITY	BIT(2)
> -#define UCSI_CABLE_PROP_FLAG_PLUG_TYPE(_f_)	((_f_) & GENMASK(3, 0))
> +#define UCSI_CABLE_PROP_FLAG_PLUG_TYPE(_f_)	(((_f_) & GENMASK(4, 3)) >> 3)
>  #define   UCSI_CABLE_PROPERTY_PLUG_TYPE_A	0
>  #define   UCSI_CABLE_PROPERTY_PLUG_TYPE_B	1
>  #define   UCSI_CABLE_PROPERTY_PLUG_TYPE_C	2
>  #define   UCSI_CABLE_PROPERTY_PLUG_OTHER	3
> -#define UCSI_CABLE_PROP_MODE_SUPPORT		BIT(5)
> +#define UCSI_CABLE_PROP_FLAG_MODE_SUPPORT	BIT(5)
>  	u8 latency;
>  } __packed;
>  
> -- 
> 2.44.0.rc0.258.g7320e95886-goog
>