mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: typec: ucsi: displayport: Current CAM OOB index fixup
@ 2026-09-11 19:32 Jameson Thies
  2026-09-14 13:14 ` Heikki Krogerus
  2026-09-14 16:29 ` Benson Leung
  0 siblings, 2 replies; 3+ messages in thread
From: Jameson Thies @ 2026-09-11 19:32 UTC (permalink / raw)
  To: heikki.krogerus, linux-usb, linux-kernel
  Cc: bleung, gregkh, akuchynski, Jameson Thies

Update ucsi_displayport_enter() to return invalid error when the PPM
reports an current alternate mode greater than or equal to
UCSI_MAX_ALTMODES. While here, remove 0xff current cam assignment on
failed GET_CURRENT_CAM response.

Signed-off-by: Jameson Thies <jthies@google.com>
---
Original patch didn't incorporate reviewer feedback. This is a fixup
to be amended to:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=04cec690b1fd9d1c4c314b91a10d8c68a3acfe18

 drivers/usb/typec/ucsi/displayport.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/displayport.c
index 8d2032d0762c..572da7bbd29c 100644
--- a/drivers/usb/typec/ucsi/displayport.c
+++ b/drivers/usb/typec/ucsi/displayport.c
@@ -71,11 +71,14 @@ static int ucsi_displayport_enter(struct typec_altmode *alt, u32 *vdo)
 	if (ret < 0) {
 		if (ucsi->version > 0x0100)
 			goto err_unlock;
-		cur = 0xff;
 	}
 
-	if (cur < UCSI_MAX_ALTMODES) {
-		ret = dp->con->port_altmode[cur] == alt ? 0 : -EBUSY;
+	if (cur != 0xff) {
+		if (cur < UCSI_MAX_ALTMODES)
+			ret = dp->con->port_altmode[cur] == alt ? 0 : -EBUSY;
+		else
+			ret = -EINVAL;
+
 		goto err_unlock;
 	}
 

base-commit: ed2050bc671b44b2c948dbd4347cc534d44ccc9f
-- 
2.55.0.1007.g17ff1f9808-goog


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

* Re: [PATCH] usb: typec: ucsi: displayport: Current CAM OOB index fixup
  2026-09-11 19:32 [PATCH] usb: typec: ucsi: displayport: Current CAM OOB index fixup Jameson Thies
@ 2026-09-14 13:14 ` Heikki Krogerus
  2026-09-14 16:29 ` Benson Leung
  1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2026-09-14 13:14 UTC (permalink / raw)
  To: Jameson Thies; +Cc: linux-usb, linux-kernel, bleung, gregkh, akuchynski

On Fri, Sep 11, 2026 at 07:32:08PM +0000, Jameson Thies wrote:
> Update ucsi_displayport_enter() to return invalid error when the PPM
> reports an current alternate mode greater than or equal to
> UCSI_MAX_ALTMODES. While here, remove 0xff current cam assignment on
> failed GET_CURRENT_CAM response.
> 
> Signed-off-by: Jameson Thies <jthies@google.com>

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

> ---
> Original patch didn't incorporate reviewer feedback. This is a fixup
> to be amended to:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=04cec690b1fd9d1c4c314b91a10d8c68a3acfe18
> 
>  drivers/usb/typec/ucsi/displayport.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/displayport.c
> index 8d2032d0762c..572da7bbd29c 100644
> --- a/drivers/usb/typec/ucsi/displayport.c
> +++ b/drivers/usb/typec/ucsi/displayport.c
> @@ -71,11 +71,14 @@ static int ucsi_displayport_enter(struct typec_altmode *alt, u32 *vdo)
>  	if (ret < 0) {
>  		if (ucsi->version > 0x0100)
>  			goto err_unlock;
> -		cur = 0xff;
>  	}
>  
> -	if (cur < UCSI_MAX_ALTMODES) {
> -		ret = dp->con->port_altmode[cur] == alt ? 0 : -EBUSY;
> +	if (cur != 0xff) {
> +		if (cur < UCSI_MAX_ALTMODES)
> +			ret = dp->con->port_altmode[cur] == alt ? 0 : -EBUSY;
> +		else
> +			ret = -EINVAL;
> +
>  		goto err_unlock;
>  	}
>  
> 
> base-commit: ed2050bc671b44b2c948dbd4347cc534d44ccc9f
> -- 
> 2.55.0.1007.g17ff1f9808-goog

-- 
heikki

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

* Re: [PATCH] usb: typec: ucsi: displayport: Current CAM OOB index fixup
  2026-09-11 19:32 [PATCH] usb: typec: ucsi: displayport: Current CAM OOB index fixup Jameson Thies
  2026-09-14 13:14 ` Heikki Krogerus
@ 2026-09-14 16:29 ` Benson Leung
  1 sibling, 0 replies; 3+ messages in thread
From: Benson Leung @ 2026-09-14 16:29 UTC (permalink / raw)
  To: Jameson Thies
  Cc: heikki.krogerus, linux-usb, linux-kernel, bleung, gregkh, akuchynski

[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]

On Fri, Sep 11, 2026 at 07:32:08PM +0000, Jameson Thies wrote:
> Update ucsi_displayport_enter() to return invalid error when the PPM
> reports an current alternate mode greater than or equal to
> UCSI_MAX_ALTMODES. While here, remove 0xff current cam assignment on
> failed GET_CURRENT_CAM response.
> 
> Signed-off-by: Jameson Thies <jthies@google.com>

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


> ---
> Original patch didn't incorporate reviewer feedback. This is a fixup
> to be amended to:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=04cec690b1fd9d1c4c314b91a10d8c68a3acfe18

You should edit the commit message to use the appropriate "Fixes:" tag.
Follow the instructions here: https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#describe-changes

> 
>  drivers/usb/typec/ucsi/displayport.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/displayport.c
> index 8d2032d0762c..572da7bbd29c 100644
> --- a/drivers/usb/typec/ucsi/displayport.c
> +++ b/drivers/usb/typec/ucsi/displayport.c
> @@ -71,11 +71,14 @@ static int ucsi_displayport_enter(struct typec_altmode *alt, u32 *vdo)
>  	if (ret < 0) {
>  		if (ucsi->version > 0x0100)
>  			goto err_unlock;
> -		cur = 0xff;
>  	}
>  
> -	if (cur < UCSI_MAX_ALTMODES) {
> -		ret = dp->con->port_altmode[cur] == alt ? 0 : -EBUSY;
> +	if (cur != 0xff) {
> +		if (cur < UCSI_MAX_ALTMODES)
> +			ret = dp->con->port_altmode[cur] == alt ? 0 : -EBUSY;
> +		else
> +			ret = -EINVAL;
> +
>  		goto err_unlock;
>  	}
>  
> 
> base-commit: ed2050bc671b44b2c948dbd4347cc534d44ccc9f
> -- 
> 2.55.0.1007.g17ff1f9808-goog
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2026-09-14 16:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 19:32 [PATCH] usb: typec: ucsi: displayport: Current CAM OOB index fixup Jameson Thies
2026-09-14 13:14 ` Heikki Krogerus
2026-09-14 16:29 ` Benson Leung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®