linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: typec: Fix fast_role_swap_current show function
@ 2023-06-05 20:40 Pavan Holla
  2023-06-06  0:48 ` Benson Leung
  2023-06-06  6:47 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 8+ messages in thread
From: Pavan Holla @ 2023-06-05 20:40 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman
  Cc: bleung, pmalani, Pavan Holla, linux-usb, linux-kernel

The current implementation mistakenly performs a & operation on
the output of sysfs_emit. This patch performs the & operation before
calling sysfs_emit.

Series-to: LKML <linux-kernel@vger.kernel.org>
Signed-off-by: Pavan Holla <pholla@chromium.org>
---
 drivers/usb/typec/pd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
index 0bcde1ff4d39..8cc66e4467c4 100644
--- a/drivers/usb/typec/pd.c
+++ b/drivers/usb/typec/pd.c
@@ -95,7 +95,7 @@ peak_current_show(struct device *dev, struct device_attribute *attr, char *buf)
 static ssize_t
 fast_role_swap_current_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	return sysfs_emit(buf, "%u\n", to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3;
+	return sysfs_emit(buf, "%u\n", (to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3);
 }
 static DEVICE_ATTR_RO(fast_role_swap_current);
 
-- 
2.41.0.rc0.172.g3f132b7071-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] usb: typec: Fix fast_role_swap_current show function
  2023-06-05 20:40 [PATCH] usb: typec: Fix fast_role_swap_current show function Pavan Holla
@ 2023-06-06  0:48 ` Benson Leung
  2023-06-06  6:47 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 8+ messages in thread
From: Benson Leung @ 2023-06-06  0:48 UTC (permalink / raw)
  To: Pavan Holla
  Cc: Heikki Krogerus, Greg Kroah-Hartman, pmalani, linux-usb, linux-kernel

Hi Pavan,


On Mon, Jun 5, 2023 at 1:40 PM Pavan Holla <pholla@chromium.org> wrote:
>
> The current implementation mistakenly performs a & operation on
> the output of sysfs_emit. This patch performs the & operation before
> calling sysfs_emit.
>
> Series-to: LKML <linux-kernel@vger.kernel.org>
> Signed-off-by: Pavan Holla <pholla@chromium.org>

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

Thanks!
Benson

> ---
>  drivers/usb/typec/pd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
> index 0bcde1ff4d39..8cc66e4467c4 100644
> --- a/drivers/usb/typec/pd.c
> +++ b/drivers/usb/typec/pd.c
> @@ -95,7 +95,7 @@ peak_current_show(struct device *dev, struct device_attribute *attr, char *buf)
>  static ssize_t
>  fast_role_swap_current_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
> -       return sysfs_emit(buf, "%u\n", to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3;
> +       return sysfs_emit(buf, "%u\n", (to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3);
>  }
>  static DEVICE_ATTR_RO(fast_role_swap_current);
>
> --
> 2.41.0.rc0.172.g3f132b7071-goog
>


-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] usb: typec: Fix fast_role_swap_current show function
  2023-06-05 20:40 [PATCH] usb: typec: Fix fast_role_swap_current show function Pavan Holla
  2023-06-06  0:48 ` Benson Leung
@ 2023-06-06  6:47 ` Greg Kroah-Hartman
  2023-06-07 19:32   ` Pavan Holla
  2023-06-07 19:33   ` [PATCH v2] " Pavan Holla
  1 sibling, 2 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2023-06-06  6:47 UTC (permalink / raw)
  To: Pavan Holla; +Cc: Heikki Krogerus, bleung, pmalani, linux-usb, linux-kernel

On Mon, Jun 05, 2023 at 08:40:09PM +0000, Pavan Holla wrote:
> The current implementation mistakenly performs a & operation on
> the output of sysfs_emit. This patch performs the & operation before
> calling sysfs_emit.
> 
> Series-to: LKML <linux-kernel@vger.kernel.org>

What is this line for?

What commit id does this fix?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] usb: typec: Fix fast_role_swap_current show function
  2023-06-06  6:47 ` Greg Kroah-Hartman
@ 2023-06-07 19:32   ` Pavan Holla
  2023-06-07 19:33   ` [PATCH v2] " Pavan Holla
  1 sibling, 0 replies; 8+ messages in thread
From: Pavan Holla @ 2023-06-07 19:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Heikki Krogerus, bleung, pmalani, linux-usb, linux-kernel

On Mon, Jun 5, 2023 at 11:47 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Mon, Jun 05, 2023 at 08:40:09PM +0000, Pavan Holla wrote:
> > The current implementation mistakenly performs a & operation on
> > the output of sysfs_emit. This patch performs the & operation before
> > calling sysfs_emit.
> >
> > Series-to: LKML <linux-kernel@vger.kernel.org>
>
> What is this line for?
>

Sorry, this was intended for a tool that simplifies git send-email. I
ended up not using the tool, but forgot to delete the tag.

> What commit id does this fix?
>

Fixes: 662a60102c12 ("usb: typec: Separate USB Power Delivery from USB Type-C")

> thanks,
>
> greg k-h

Please look out for V2 of this patch.

Thanks,
Pavan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] usb: typec: Fix fast_role_swap_current show function
  2023-06-06  6:47 ` Greg Kroah-Hartman
  2023-06-07 19:32   ` Pavan Holla
@ 2023-06-07 19:33   ` Pavan Holla
  2023-06-08  7:25     ` Heikki Krogerus
                       ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Pavan Holla @ 2023-06-07 19:33 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman
  Cc: bleung, pmalani, Pavan Holla, linux-usb, linux-kernel

The current implementation mistakenly performs a & operation on
the output of sysfs_emit. This patch performs the & operation before
calling sysfs_emit.

Fixes: 662a60102c12 ("usb: typec: Separate USB Power Delivery from USB Type-C")
Reported-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Pavan Holla <pholla@chromium.org>
---
 drivers/usb/typec/pd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
index 0bcde1ff4d39..8cc66e4467c4 100644
--- a/drivers/usb/typec/pd.c
+++ b/drivers/usb/typec/pd.c
@@ -95,7 +95,7 @@ peak_current_show(struct device *dev, struct device_attribute *attr, char *buf)
 static ssize_t
 fast_role_swap_current_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	return sysfs_emit(buf, "%u\n", to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3;
+	return sysfs_emit(buf, "%u\n", (to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3);
 }
 static DEVICE_ATTR_RO(fast_role_swap_current);
 
-- 
2.41.0.rc0.172.g3f132b7071-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] usb: typec: Fix fast_role_swap_current show function
  2023-06-07 19:33   ` [PATCH v2] " Pavan Holla
@ 2023-06-08  7:25     ` Heikki Krogerus
  2023-06-08 17:17     ` Benson Leung
  2023-06-15 17:22     ` Prashant Malani
  2 siblings, 0 replies; 8+ messages in thread
From: Heikki Krogerus @ 2023-06-08  7:25 UTC (permalink / raw)
  To: Pavan Holla; +Cc: Greg Kroah-Hartman, bleung, pmalani, linux-usb, linux-kernel

On Wed, Jun 07, 2023 at 07:33:26PM +0000, Pavan Holla wrote:
> The current implementation mistakenly performs a & operation on
> the output of sysfs_emit. This patch performs the & operation before
> calling sysfs_emit.
> 
> Fixes: 662a60102c12 ("usb: typec: Separate USB Power Delivery from USB Type-C")
> Reported-by: Benson Leung <bleung@chromium.org>
> Signed-off-by: Pavan Holla <pholla@chromium.org>

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

> ---
>  drivers/usb/typec/pd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
> index 0bcde1ff4d39..8cc66e4467c4 100644
> --- a/drivers/usb/typec/pd.c
> +++ b/drivers/usb/typec/pd.c
> @@ -95,7 +95,7 @@ peak_current_show(struct device *dev, struct device_attribute *attr, char *buf)
>  static ssize_t
>  fast_role_swap_current_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
> -	return sysfs_emit(buf, "%u\n", to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3;
> +	return sysfs_emit(buf, "%u\n", (to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3);
>  }
>  static DEVICE_ATTR_RO(fast_role_swap_current);
>  
> -- 
> 2.41.0.rc0.172.g3f132b7071-goog

-- 
heikki

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] usb: typec: Fix fast_role_swap_current show function
  2023-06-07 19:33   ` [PATCH v2] " Pavan Holla
  2023-06-08  7:25     ` Heikki Krogerus
@ 2023-06-08 17:17     ` Benson Leung
  2023-06-15 17:22     ` Prashant Malani
  2 siblings, 0 replies; 8+ messages in thread
From: Benson Leung @ 2023-06-08 17:17 UTC (permalink / raw)
  To: Pavan Holla
  Cc: Heikki Krogerus, Greg Kroah-Hartman, pmalani, linux-usb, linux-kernel

Hi Pavan,

On Wed, Jun 7, 2023 at 12:33 PM Pavan Holla <pholla@chromium.org> wrote:
>
> The current implementation mistakenly performs a & operation on
> the output of sysfs_emit. This patch performs the & operation before
> calling sysfs_emit.
>
> Fixes: 662a60102c12 ("usb: typec: Separate USB Power Delivery from USB Type-C")
> Reported-by: Benson Leung <bleung@chromium.org>
> Signed-off-by: Pavan Holla <pholla@chromium.org>

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

> ---
>  drivers/usb/typec/pd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
> index 0bcde1ff4d39..8cc66e4467c4 100644
> --- a/drivers/usb/typec/pd.c
> +++ b/drivers/usb/typec/pd.c
> @@ -95,7 +95,7 @@ peak_current_show(struct device *dev, struct device_attribute *attr, char *buf)
>  static ssize_t
>  fast_role_swap_current_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
> -       return sysfs_emit(buf, "%u\n", to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3;
> +       return sysfs_emit(buf, "%u\n", (to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3);
>  }
>  static DEVICE_ATTR_RO(fast_role_swap_current);
>
> --
> 2.41.0.rc0.172.g3f132b7071-goog
>


-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] usb: typec: Fix fast_role_swap_current show function
  2023-06-07 19:33   ` [PATCH v2] " Pavan Holla
  2023-06-08  7:25     ` Heikki Krogerus
  2023-06-08 17:17     ` Benson Leung
@ 2023-06-15 17:22     ` Prashant Malani
  2 siblings, 0 replies; 8+ messages in thread
From: Prashant Malani @ 2023-06-15 17:22 UTC (permalink / raw)
  To: Pavan Holla
  Cc: Heikki Krogerus, Greg Kroah-Hartman, bleung, linux-usb, linux-kernel

On Wed, Jun 7, 2023 at 12:33 PM Pavan Holla <pholla@chromium.org> wrote:
>
> The current implementation mistakenly performs a & operation on
> the output of sysfs_emit. This patch performs the & operation before
> calling sysfs_emit.
>
> Fixes: 662a60102c12 ("usb: typec: Separate USB Power Delivery from USB Type-C")
> Reported-by: Benson Leung <bleung@chromium.org>
> Signed-off-by: Pavan Holla <pholla@chromium.org>
Reviewed-by: Prashant Malani <pmalani@chromium.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-15 17:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05 20:40 [PATCH] usb: typec: Fix fast_role_swap_current show function Pavan Holla
2023-06-06  0:48 ` Benson Leung
2023-06-06  6:47 ` Greg Kroah-Hartman
2023-06-07 19:32   ` Pavan Holla
2023-06-07 19:33   ` [PATCH v2] " Pavan Holla
2023-06-08  7:25     ` Heikki Krogerus
2023-06-08 17:17     ` Benson Leung
2023-06-15 17:22     ` Prashant Malani

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).