Type-C Port Manager
Subsystems (2)
RFC PATCH 3/4 usb: typec: USB Type-C Port Manager (tcpm)
In reply to Guenter RoeckThis driver implements the USB Type-C Power Delivery state machine for both source and sink ports. Alternate mode support is not fully implemented.
The driver attaches to the USB Type-C class code implemented in the following patches.
usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHY
usb: USB Type-C connector class
This driver only implements the state machine. Lower level drivers are responsible for
- Reporting VBUS status and activating VBUS
- Setting CC lines and providing CC line status
- Setting line polarity
- Activating and deactivating VCONN
- Setting the current limit
- Activating and deactivating PD message transfers
- Sending and receiving PD messages
The driver provides both a functional API as well as callbacks for lower level drivers.
--- drivers/usb/typec/Kconfig | 7 + drivers/usb/typec/Makefile | 1 + drivers/usb/typec/tcpm.c | 3014 ++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/typec/tcpm.h | 138 ++ include/linux/usb/pd.h | 269 ++++ include/linux/usb/pd_bdo.h | 31 + include/linux/usb/pd_vdo.h | 412 ++++++ 7 files changed, 3872 insertions(+) create mode 100644 drivers/usb/typec/tcpm.c create mode 100644 drivers/usb/typec/tcpm.h create mode 100644 include/linux/usb/pd.h create mode 100644 include/linux/usb/pd_bdo.h create mode 100644 include/linux/usb/pd_vdo.h
drivers/usb/typec/Kconfig +7 -0
@@ -18,4 +18,11 @@ config TYPEC_WCOVE To compile this driver as module, choose M here: the module will be called typec_wcove +config TYPEC_TCPM + tristate "USB Type-C Port Controller Manager" + select TYPEC + help + The Type-C Port Controller Manager provides a USB PD and USB Type-C + state machine for use with Type-C Port Controllers. + endmenu
drivers/usb/typec/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_TYPEC) += typec.o obj-$(CONFIG_TYPEC_WCOVE) += typec_wcove.o +obj-$(CONFIG_TYPEC_TCPM) += tcpm.o
drivers/usb/typec/tcpm.c new file +3014 -0
2,986 lines not on this page · raw message
drivers/usb/typec/tcpm.h new file +138 -0
138 lines not on this page · raw message
include/linux/usb/pd.h new file +269 -0
269 lines not on this page · raw message
include/linux/usb/pd_vdo.h new file +412 -0
412 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.6.6
Part of the diff is not shown here. View the raw message.
RFC PATCH 4/4 usb: typec: Type-C Port Controller Interface driver (tcpci)
In reply to Guenter RoeckThe port controller interface driver interconnects the Type-C Port Manager with a Type-C Port Controller Interface (TCPCI) compliant port controller.
--- drivers/usb/typec/Kconfig | 9 + drivers/usb/typec/Makefile | 1 + drivers/usb/typec/tcpci.c | 498 +++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/typec/tcpci.h | 133 ++++++++++++ 4 files changed, 641 insertions(+) create mode 100644 drivers/usb/typec/tcpci.c create mode 100644 drivers/usb/typec/tcpci.h
drivers/usb/typec/Kconfig +9 -0
@@ -25,4 +25,13 @@ config TYPEC_TCPM The Type-C Port Controller Manager provides a USB PD and USB Type-C state machine for use with Type-C Port Controllers. +if TYPEC_TCPM + +config TYPEC_TCPCI + tristate "Type-C Port Controller Interface driver" + help + Type-C Port Controller driver for TCPCI-compliant controller. + +endif + endmenu
drivers/usb/typec/Makefile +1 -0
@@ -1,3 +1,4 @@ obj-$(CONFIG_TYPEC) += typec.o obj-$(CONFIG_TYPEC_WCOVE) += typec_wcove.o obj-$(CONFIG_TYPEC_TCPM) += tcpm.o +obj-$(CONFIG_TYPEC_TCPCI) += tcpci.o
drivers/usb/typec/tcpci.c new file +498 -0
498 lines not on this page · raw message
drivers/usb/typec/tcpci.h new file +133 -0
133 lines not on this page · raw message
Signature · 1 line
2.6.6
RFC PATCH 1/4 usb: typec: Drop locking from class code
In reply to Guenter RoeckDrop locking from USB Type-C class code to avoid deadlocks between driver and class code.
--- drivers/usb/typec/typec.c | 196 ++++++++++------------------------------------ 1 file changed, 41 insertions(+), 155 deletions(-)
drivers/usb/typec/typec.c +41 -155
@@ -17,7 +17,6 @@struct typec_port {unsigned int id;struct device dev; -struct mutex lock;/* device lock */ int prefer_role;
@@ -480,38 +479,30 @@ EXPORT_SYMBOL_GPL(typec_disconnect);void typec_set_data_role (struct typec_port *port,enum typec_data_role role) { -mutex_lock (&port->lock); port->data_role = role;sysfs_notify (&port->dev.kobj,NULL ,"current_data_role" ); -mutex_unlock (&port->lock); }EXPORT_SYMBOL (typec_set_data_role);void typec_set_pwr_role (struct typec_port *port,enum typec_role role) { -mutex_lock (&port->lock); port->pwr_role = role;sysfs_notify (&port->dev.kobj,NULL ,"current_power_role" ); -mutex_unlock (&port->lock); }EXPORT_SYMBOL (typec_set_pwr_role);void typec_set_vconn_role (struct typec_port *port,enum typec_role role) { -mutex_lock (&port->lock); port->vconn_role = role;sysfs_notify (&port->dev.kobj,NULL ,"current_vconn_role" ); -mutex_unlock (&port->lock); }EXPORT_SYMBOL (typec_set_vconn_role);void typec_set_pwr_opmode (struct typec_port *port,enum typec_pwr_opmode opmode) { -mutex_lock (&port->lock); port->pwr_opmode = opmode;sysfs_notify (&port->dev.kobj,NULL ,"power_operation_mode" ); -mutex_unlock (&port->lock); }EXPORT_SYMBOL (typec_set_pwr_opmode);
@@ -527,15 +518,12 @@ EXPORT_SYMBOL(typec_set_pwr_opmode);void typec_altmode_update_active (struct typec_altmode *alt,int mode,bool active) { -struct typec_port *port =typec_altmode2port (alt);struct typec_mode *m = alt->modes + mode;char dir[6 ]; -mutex_lock (&port->lock); m->active = active;sprintf (dir,"mode%d" , mode);sysfs_notify (&alt->dev.kobj, dir,"active" ); -mutex_unlock (&port->lock); }EXPORT_SYMBOL (typec_altmode_update_active);
@@ -573,14 +561,8 @@ typec_altmode_vdo_show(struct device *dev, struct device_attribute *attr, { struct typec_mode *mode = container_of(attr, struct typec_mode, vdo_attr); -struct typec_port *port =typec_altmode2port (mode->alt_mode); -ssize_t ret; -mutex_lock (&port->lock); - ret =sprintf (buf,"0x%08x\n" , mode->vdo); -mutex_unlock (&port->lock); - -return ret; +return sprintf (buf,"0x%08x\n" , mode->vdo); } static ssize_t
@@ -589,14 +571,8 @@ typec_altmode_desc_show(struct device *dev, struct device_attribute *attr, { struct typec_mode *mode = container_of(attr, struct typec_mode, desc_attr); -struct typec_port *port =typec_altmode2port (mode->alt_mode); -ssize_t ret; - -mutex_lock (&port->lock); - ret =sprintf (buf,"%s\n" , mode->desc ? mode->desc :"" ); -mutex_unlock (&port->lock); -return ret; +return sprintf (buf,"%s\n" , mode->desc ? mode->desc :"" ); } static ssize_t
@@ -605,14 +581,8 @@ typec_altmode_active_show(struct device *dev, struct device_attribute *attr, { struct typec_mode *mode = container_of(attr, struct typec_mode, active_attr); -struct typec_port *port =typec_altmode2port (mode->alt_mode); -ssize_t ret; - -mutex_lock (&port->lock); - ret =sprintf (buf,"%d\n" , mode->active); -mutex_unlock (&port->lock); -return ret; +return sprintf (buf,"%d\n" , mode->active); } static ssize_t
@@ -632,13 +602,11 @@ typec_altmode_active_store(struct device *dev, struct device_attribute *attr,if (activate >1 )return -EINVAL ; -mutex_lock (&port->lock); ret = port->cap->activate_mode (mode->alt_mode, mode->index, activate);if (!ret) { mode->active = activate; ret = size; } -mutex_unlock (&port->lock);return ret; }
@@ -649,10 +617,8 @@ typec_altmode_roles_show(struct device *dev, struct device_attribute *attr, { struct typec_mode *mode = container_of(attr, struct typec_mode, roles_attr); -struct typec_port *port =typec_altmode2port (mode->alt_mode);ssize_t ret; -mutex_lock (&port->lock);switch (mode->roles) {case TYPEC_PORT_DFP : ret =sprintf (buf,"source\n" );
@@ -665,7 +631,6 @@ typec_altmode_roles_show(struct device *dev, struct device_attribute *attr, ret =sprintf (buf,"source, sink\n" );break ; } -mutex_unlock (&port->lock);return ret; }
@@ -837,38 +802,30 @@ preferred_role_store(struct device *dev, struct device_attribute *attr,enum typec_role role;int ret; -mutex_lock (&port->lock); -if (port->cap->type !=TYPEC_PORT_DRP ) {dev_dbg (dev,"Preferred role only supported with DRP ports\n" ); - ret = -EOPNOTSUPP ; - goto out; +return -EOPNOTSUPP ; }if (!port->cap->try_role) {dev_dbg (dev,"Setting preferred role not supported\n" ); - ret = -EOPNOTSUPP ; - goto out; +return -EOPNOTSUPP ; } ret =match_string (typec_roles,ARRAY_SIZE (typec_roles), buf);if (ret <0 ) { port->prefer_role =-1 ; - ret = size; - goto out; +return size; } role = ret; ret = port->cap->try_role (port->cap, role);if (ret) - goto out; +return ret; port->prefer_role = role; - ret = size; -out: -mutex_unlock (&port->lock); -return ret; +return size; } static ssize_t
@@ -878,15 +835,10 @@ preferred_role_show(struct device *dev, struct device_attribute *attr,struct typec_port *port =to_typec_port (dev);ssize_t ret =0 ; -mutex_lock (&port->lock); -if (port->prefer_role <0 ) - goto out; +return ret; - ret =sprintf (buf,"%s\n" , typec_roles[port->prefer_role]); -out: -mutex_unlock (&port->lock); -return ret; +return sprintf (buf,"%s\n" , typec_roles[port->prefer_role]); }static DEVICE_ATTR_RW (preferred_role);
@@ -895,37 +847,30 @@ current_data_role_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) {struct typec_port *port =to_typec_port (dev); -int ret = size; - -mutex_lock (&port->lock); +int ret;if (port->cap->type !=TYPEC_PORT_DRP ) {dev_dbg (dev,"data role swap only supported with DRP ports\n" ); - ret = -EOPNOTSUPP ; - goto out; +return -EOPNOTSUPP ; }if (!port->cap->dr_set) {dev_dbg (dev,"data role swapping not supported\n" ); - ret = -EOPNOTSUPP ; - goto out; +return -EOPNOTSUPP ; }if (!port->connected) - goto out; +return size; ret =match_string (typec_data_roles,ARRAY_SIZE (typec_data_roles), buf);if (ret <0 ) - goto out; +return ret; ret = port->cap->dr_set (port->cap, ret);if (ret) - goto out; +return ret; - ret = size; -out: -mutex_unlock (&port->lock); -return ret; +return size; } static ssize_t
@@ -933,13 +878,8 @@ current_data_role_show(struct device *dev, struct device_attribute *attr, char *buf) {struct typec_port *port =to_typec_port (dev); -ssize_t ret; - -mutex_lock (&port->lock); - ret =sprintf (buf,"%s\n" , typec_data_roles[port->data_role]); -mutex_unlock (&port->lock); -return ret; +return sprintf (buf,"%s\n" , typec_data_roles[port->data_role]); }static DEVICE_ATTR_RW (current_data_role);
@@ -948,19 +888,11 @@ static ssize_t supported_data_roles_show(struct device *dev, char *buf) {struct typec_port *port =to_typec_port (dev); -size_t ret; -mutex_lock (&port->lock); +if (port->cap->type ==TYPEC_PORT_DRP ) +return sprintf (buf,"host, device\n" ); -if (port->cap->type ==TYPEC_PORT_DRP ) { - ret =sprintf (buf,"host, device\n" ); - goto out; - } - - ret =sprintf (buf,"%s\n" , typec_data_roles[port->data_role]); -out: -mutex_unlock (&port->lock); -return ret; +return sprintf (buf,"%s\n" , typec_data_roles[port->data_role]); }static DEVICE_ATTR_RO (supported_data_roles);
@@ -969,56 +901,43 @@ static ssize_t current_power_role_store(struct device *dev, const char *buf, size_t size) {struct typec_port *port =to_typec_port (dev); -int ret = size; - -mutex_lock (&port->lock); +int ret;if (!port->cap->usb_pd) {dev_dbg (dev,"power role swap only supported with USB PD\n" ); - ret = -EOPNOTSUPP ; - goto out; +return -EOPNOTSUPP ; }if (!port->cap->pr_set) {dev_dbg (dev,"power role swapping not supported\n" ); - ret = -EOPNOTSUPP ; - goto out; +return -EOPNOTSUPP ; }if (port->pwr_opmode !=TYPEC_PWR_MODE_PD ) {dev_dbg (dev,"partner unable to swap power role\n" ); - ret = -EIO ; - goto out; +return -EIO ; }if (!port->connected) - goto out; +return size; ret =match_string (typec_roles,ARRAY_SIZE (typec_roles), buf);if (ret <0 ) - goto out; +return ret; ret = port->cap->pr_set (port->cap, ret);if (ret) - goto out; +return ret; - ret = size; -out: -mutex_unlock (&port->lock); -return ret; +return size; }static ssize_t current_power_role_show (struct device *dev,struct device_attribute *attr,char *buf) {struct typec_port *port =to_typec_port (dev); -ssize_t ret; -mutex_lock (&port->lock); - ret =sprintf (buf,"%s\n" , typec_roles[port->pwr_role]); -mutex_unlock (&port->lock); - -return ret; +return sprintf (buf,"%s\n" , typec_roles[port->pwr_role]); }static DEVICE_ATTR_RW (current_power_role);
@@ -1027,19 +946,11 @@ static ssize_t supported_power_roles_show(struct device *dev, char *buf) {struct typec_port *port =to_typec_port (dev); -size_t ret; -mutex_lock (&port->lock); - -if (port->cap->usb_pd || port->cap->type ==TYPEC_PORT_DRP ) { - ret =sprintf (buf,"source, sink\n" ); - goto out; - } +if (port->cap->usb_pd || port->cap->type ==TYPEC_PORT_DRP ) +return sprintf (buf,"source, sink\n" ); - ret =sprintf (buf,"%s\n" , typec_roles[port->pwr_role]); -out: -mutex_unlock (&port->lock); -return ret; +return sprintf (buf,"%s\n" , typec_roles[port->pwr_role]); }static DEVICE_ATTR_RO (supported_power_roles);
@@ -1055,13 +966,8 @@ static ssize_t power_operation_mode_show(struct device *dev, char *buf) {struct typec_port *port =to_typec_port (dev); -ssize_t ret; -mutex_lock (&port->lock); - ret =sprintf (buf,"%s\n" , typec_pwr_opmodes[port->pwr_opmode]); -mutex_unlock (&port->lock); - -return ret; +return sprintf (buf,"%s\n" , typec_pwr_opmodes[port->pwr_opmode]); }static DEVICE_ATTR_RO (power_operation_mode);
@@ -1072,45 +978,33 @@ static ssize_t current_vconn_role_store(struct device *dev,struct typec_port *port =to_typec_port (dev);int ret; -mutex_lock (&port->lock); -if (!port->cap->usb_pd) {dev_dbg (dev,"vconn swap only supported with USB PD\n" ); - ret = -EOPNOTSUPP ; - goto out; +return -EOPNOTSUPP ; }if (!port->cap->vconn_set) {dev_dbg (dev,"vconn swapping not supported\n" ); - ret = -EOPNOTSUPP ; - goto out; +return -EOPNOTSUPP ; } ret =match_string (typec_roles,ARRAY_SIZE (typec_roles), buf);if (ret <0 ) - goto out; +return ret; ret = port->cap->vconn_set (port->cap, ret);if (ret) - goto out; +return ret; - ret = size; -out: -mutex_unlock (&port->lock); -return ret; +return size; }static ssize_t current_vconn_role_show (struct device *dev,struct device_attribute *attr,char *buf) {struct typec_port *port =to_typec_port (dev); -ssize_t ret; -mutex_lock (&port->lock); - ret =sprintf (buf,"%s\n" , typec_roles[port->vconn_role]); -mutex_unlock (&port->lock); - -return ret; +return sprintf (buf,"%s\n" , typec_roles[port->vconn_role]); }static DEVICE_ATTR_RW (current_vconn_role);
@@ -1123,13 +1017,11 @@ static ssize_t supported_accessory_modes_show(struct device *dev,ssize_t ret =0 ;int i; -mutex_lock (&port->lock);if (port->cap->accessory)for (accessory = port->cap->accessory, i =0 ; i < port->cap->num_accessory; accessory++, i++) ret +=sprintf (buf,"%s\n" , typec_accessory_modes[*accessory]); -mutex_unlock (&port->lock);return ret; }
@@ -1140,13 +1032,8 @@ static ssize_t supports_usb_power_delivery_show(struct device *dev, char *buf) {struct typec_port *port =to_typec_port (dev); -ssize_t ret; - -mutex_lock (&port->lock); - ret =sprintf (buf,"%d\n" , port->cap->usb_pd); -mutex_unlock (&port->lock); -return ret; +return sprintf (buf,"%d\n" , port->cap->usb_pd); }static DEVICE_ATTR_RO (supports_usb_power_delivery);
@@ -1224,7 +1111,6 @@ struct typec_port *typec_register_port(struct device *dev, port->dev.class = &typec_class; port->dev.parent = dev;dev_set_name (&port->dev,"usbc%d" , id); -mutex_init (&port->lock);typec_init_roles (port);
Signature · 1 line
2.6.6
RFC PATCH 2/4 usb: typec: Do not check if connected when setting roles
In reply to Guenter RoeckThe connection status can change after the connection status was checked. Leave it up to the driver to perform the necessary checks.
--- drivers/usb/typec/typec.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/usb/typec/typec.c +0 -6
@@ -859,9 +859,6 @@ current_data_role_store(struct device *dev, struct device_attribute *attr,return -EOPNOTSUPP ; } -if (!port->connected) -return size; - ret =match_string (typec_data_roles,ARRAY_SIZE (typec_data_roles), buf);if (ret <0 )return ret;
@@ -918,9 +915,6 @@ static ssize_t current_power_role_store(struct device *dev,return -EIO ; } -if (!port->connected) -return size; - ret =match_string (typec_roles,ARRAY_SIZE (typec_roles), buf);if (ret <0 )return ret;
Signature · 1 line
2.6.6
cover Type-C Port Manager
The following series of patches implements a USB Type-C Port Manager using the pending USB Type-C class code as basis. The code is still WIP (I am still waiting for a final decision on locking in the class code), but I think it is important to get feedback from the community at this point.
There are four patches in the series. The first two patches remove locking from the Type-C class code. The third patch implements the Type-C Port Manager state machine. The forth patch is an interface between the Type-C Port Manager and a TCPCI (Type-C Port Controller Interface) compliant USB Type-C Port Controller.
Patch 4/4 (the interface to a TCPCI compliant chip) is currently untested since I don't have the necessary hardware available. The port manager code was tested connecting to an Embedded Controller on a Chromebook, bypassing the Port Manager implementation in the EC.
Both Source and Sink operation was tested with various Type-C chargers, docks, and connectors. Alternate mode support is partially implemented (Alternate mode support is requested from the partner), but alternate modes are actually selected. Implementing this will require more thought, since the actual alternate mode support has to be implemented elsewhere, such as in a dedicated Phy driver. It should be possible to implement the interface between phy driver and Type-C Port Controller driver using extcon, but I have not further explored the possibilities, and other options might be possible and/or better.
Why remove locking from the Type-C class code ?
The primary problem is that Type-C state and role changes are triggered by the Port Manager state machine and quite independent from role change requests triggered by or requested through the class code. At the same time, the code handling role change requests triggered from the class code has to wait for the role change to complete before returning to the class code. This can result in a deadlock, since the state machine also needs to report unsolicited role (or status) changes to the class code.
Consider this situation:
- User requests a role change throuch class code.
- Class code acquires mutex, and passes role change request to port manager.
- Port manager attempts to acquire its port mutex. Port state machine is active, causing the code to stall.
- Port state machine executes a state change or role change request from the port partner. Upon completion, it attempts to inform the class that a role or state change occurred. It does so while the port mutex is active to prevent state changes while the state machine is still running.
- The callback into the class code waits for the class mutex, which is locked because there is also a role change request from the class code pending.
Instead of trying to handle the situation in low level drivers by trying to avoid deadlocks, it seems better to leave all locking to low level drivers to start with. Since low level drivers are in control of port changes and port roles, this appears to be the simpler approach. I am open to listen to other ideas, though.
Re: [RFC PATCH 3/4] usb: typec: USB Type-C Port Manager (tcpm)
In reply to Guenter Roeckdrivers/usb/typec/tcpm.c line 520
Quoted 9 lines · Guenter Roeck
drivers/usb/typec/tcpm.c new file +9
-0+static int tcpm_set_polarity (struct tcpm_port *port, +enum typec_cc_polarity polarity) +{ +tcpm_log (port,"polarity %d" , polarity); + + port->polarity = polarity; + +return port->tcpc->set_polarity (port->tcpc, port->polarity); +}
Here you don't care about the result.
Quoted 13 lines
drivers/usb/typec/tcpm.c new file +12
-0+ +static int tcpm_set_vconn (struct tcpm_port *port,bool enable) +{ +int ret =0 ; + +tcpm_log (port,"vconn:=%d" , enable); + + ret = port->tcpc->set_vconn (port->tcpc, enable); +if (!ret) { + port->con.vconn_role = enable ?TYPEC_SOURCE + :TYPEC_SINK ; + typec_set_vconn_role(port->typec_port,
port->con.vconn_role);
drivers/usb/typec/tcpm.c line 471
Quoted 4 lines
drivers/usb/typec/tcpm.c new file +4
-0+ } + +return ret; +}
But here you do. Which is right?
Regards
Oliver
Re: [RFC PATCH 3/4] usb: typec: USB Type-C Port Manager (tcpm)
In reply to Guenter Roeckdrivers/usb/typec/tcpm.c line 773
Quoted 13 lines · Guenter Roeck
+static bool svdm_consume_svids(struct
tcpm_port*port, const u32 *payload,drivers/usb/typec/tcpm.c new file +11
-0+ int cnt) +{ +struct pd_mode_data *pmdata = &port->mode_data; +int i; + +for (i =1 ; i < cnt; i++) { +u16 svid; + + svid = (payload[i] >>16 ) &0xffff ; +if (!svid) +return false;
Hi,
this looks like an endianness bug.
Regards
Oliver
Re: [RFC PATCH 3/4] usb: typec: USB Type-C Port Manager (tcpm)
In reply to Oliver NeukumQuoted 12 lines · Oliver Neukum
drivers/usb/typec/tcpm.c line 520
Quoted 9 lines · Guenter Roeck
drivers/usb/typec/tcpm.c new file +9
-0+static int tcpm_set_polarity (struct tcpm_port *port, +enum typec_cc_polarity polarity) +{ +tcpm_log (port,"polarity %d" , polarity); + + port->polarity = polarity; + +return port->tcpc->set_polarity (port->tcpc, port->polarity); +}Here you don't care about the result.
Changed to only set port->polarity if the set_polarity callback was successful.
Thanks,
Guenter
Re: [RFC PATCH 3/4] usb: typec: USB Type-C Port Manager (tcpm)
In reply to Oliver NeukumQuoted 17 lines · Oliver Neukum
drivers/usb/typec/tcpm.c line 773
Quoted 13 lines · Guenter Roeck
+static bool svdm_consume_svids(struct
tcpm_port*port, const u32 *payload,drivers/usb/typec/tcpm.c new file +11
-0+ int cnt) +{ +struct pd_mode_data *pmdata = &port->mode_data; +int i; + +for (i =1 ; i < cnt; i++) { +u16 svid; + + svid = (payload[i] >>16 ) &0xffff ; +if (!svid) +return false;Hi,
Quoted 2 lines
this looks like an endianness bug.
Yes, you are right, and there are lots of those in my code. Thanks for bringing it up.
Guenter