All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] usb: typec: tcpm: Return ENOTSUPP for power supply prop writes
@ 2022-08-16 19:11 Badhri Jagan Sridharan
  2022-08-17  1:54 ` kernel test robot
  2022-08-17  6:00 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Badhri Jagan Sridharan @ 2022-08-16 19:11 UTC (permalink / raw)
  To: Guenter Roeck, Heikki Krogerus, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Kyle Tso, stable, Badhri Jagan Sridharan

When the port does not support USB PD, prevent transition to PD
only states when power supply property is written. In this case,
TCPM transitions to SNK_NEGOTIATE_CAPABILITIES
which should not be the case given that the port is not pd_capable.

[   84.308251] state change SNK_READY -> SNK_NEGOTIATE_CAPABILITIES [rev3 NONE_AMS]
[   84.308335] Setting usb_comm capable false
[   84.323367] set_auto_vbus_discharge_threshold mode:3 pps_active:n vbus:5000 ret:0
[   84.323376] state change SNK_NEGOTIATE_CAPABILITIES -> SNK_WAIT_CAPABILITIES [rev3 NONE_AMS]

Fixes: e9e6e164ed8f6 ("usb: typec: tcpm: Support non-PD mode")
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
---
Changes since v1:
- Add Fixes tag.
---
 drivers/usb/typec/tcpm/tcpm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index ea5a917c51b1..904c7b4ce2f0 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -6320,6 +6320,13 @@ static int tcpm_psy_set_prop(struct power_supply *psy,
 	struct tcpm_port *port = power_supply_get_drvdata(psy);
 	int ret;
 
+	/*
+	 * All the properties below are related to USB PD. The check needs to be
+	 * property specific when a non-pd related property is added.
+	 */
+	if (!port->pd_supported)
+		return -EOPNOTSUPP;
+
 	switch (psp) {
 	case POWER_SUPPLY_PROP_ONLINE:
 		ret = tcpm_psy_set_online(port, val);
-- 
2.37.1.595.g718a3a8f04-goog


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

* Re: [PATCH v2] usb: typec: tcpm: Return ENOTSUPP for power supply prop writes
  2022-08-16 19:11 [PATCH v2] usb: typec: tcpm: Return ENOTSUPP for power supply prop writes Badhri Jagan Sridharan
@ 2022-08-17  1:54 ` kernel test robot
  2022-08-17  6:00 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-08-17  1:54 UTC (permalink / raw)
  To: Badhri Jagan Sridharan; +Cc: stable

Hi,

Thanks for your patch.

FYI: kernel test robot notices the stable kernel rule is not satisfied.

Rule: 'Cc: stable@vger.kernel.org' or 'commit <sha1> upstream.'
Subject: [PATCH v2] usb: typec: tcpm: Return ENOTSUPP for power supply prop writes
Link: https://lore.kernel.org/stable/20220816191150.1432166-1-badhri%40google.com

The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH v2] usb: typec: tcpm: Return ENOTSUPP for power supply prop writes
  2022-08-16 19:11 [PATCH v2] usb: typec: tcpm: Return ENOTSUPP for power supply prop writes Badhri Jagan Sridharan
  2022-08-17  1:54 ` kernel test robot
@ 2022-08-17  6:00 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-08-17  6:00 UTC (permalink / raw)
  To: Badhri Jagan Sridharan
  Cc: Guenter Roeck, Heikki Krogerus, linux-usb, linux-kernel,
	Kyle Tso, stable

On Tue, Aug 16, 2022 at 12:11:50PM -0700, Badhri Jagan Sridharan wrote:
> When the port does not support USB PD, prevent transition to PD
> only states when power supply property is written. In this case,
> TCPM transitions to SNK_NEGOTIATE_CAPABILITIES
> which should not be the case given that the port is not pd_capable.
> 
> [   84.308251] state change SNK_READY -> SNK_NEGOTIATE_CAPABILITIES [rev3 NONE_AMS]
> [   84.308335] Setting usb_comm capable false
> [   84.323367] set_auto_vbus_discharge_threshold mode:3 pps_active:n vbus:5000 ret:0
> [   84.323376] state change SNK_NEGOTIATE_CAPABILITIES -> SNK_WAIT_CAPABILITIES [rev3 NONE_AMS]
> 
> Fixes: e9e6e164ed8f6 ("usb: typec: tcpm: Support non-PD mode")
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> ---
> Changes since v1:
> - Add Fixes tag.
> ---
>  drivers/usb/typec/tcpm/tcpm.c | 7 +++++++
>  1 file changed, 7 insertions(+)


<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

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

end of thread, other threads:[~2022-08-17  6:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16 19:11 [PATCH v2] usb: typec: tcpm: Return ENOTSUPP for power supply prop writes Badhri Jagan Sridharan
2022-08-17  1:54 ` kernel test robot
2022-08-17  6:00 ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.