All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] usb: Linking ports to their Type-C connectors
@ 2021-03-29  8:44 Heikki Krogerus
  2021-03-29  8:44 ` [PATCH v2 1/6] usb: typec: Organize the private headers properly Heikki Krogerus
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Heikki Krogerus @ 2021-03-29  8:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Stern, Benson Leung, Prashant Malani, Guenter Roeck,
	linux-usb, linux-kernel

Hi,

This is the second version of this series. The "Iterator for ports"
patch is now moved to the end of the series (5/6).

I'm now using usb_for_each_dev() in usb_for_each_port like Alan
suggested, and I'm now using usb_port_peer_mutex to lock the ports
while we're dealing with them in __each_hub().


The original cover letter:

Adding a simple function typec_link_port() that can be used to create
a symlink "connector" that points to the USB Type-C connector of a
port. It is used with USB ports initially, but hopefully later also
with other things like DisplayPorts.

Being able to see which connector is connected to a port is important
in general, but it is really important when for example the data or
power role of a device needs to swapped. The user probable wants to
know which USB device is disconnected if role swap on a USB Type-C
connector is executed.

Hope these are OK.

thanks,

Heikki Krogerus (6):
  usb: typec: Organize the private headers properly
  usb: typec: Declare the typec_class static
  usb: typec: Port mapping utility
  usb: Link the ports to the connectors they are attached to
  usb: Iterator for ports
  usb: typec: Link all ports during connector registration

 Documentation/ABI/testing/sysfs-bus-usb |   9 +
 drivers/usb/core/port.c                 |   3 +
 drivers/usb/core/usb.c                  |  46 ++++
 drivers/usb/typec/Makefile              |   2 +-
 drivers/usb/typec/bus.c                 |   2 +
 drivers/usb/typec/bus.h                 |  19 +-
 drivers/usb/typec/class.c               | 101 +++------
 drivers/usb/typec/class.h               |  85 +++++++
 drivers/usb/typec/mux.c                 |   4 +-
 drivers/usb/typec/mux.h                 |  21 ++
 drivers/usb/typec/port-mapper.c         | 280 ++++++++++++++++++++++++
 include/linux/usb.h                     |   1 +
 include/linux/usb/typec.h               |  13 ++
 13 files changed, 490 insertions(+), 96 deletions(-)
 create mode 100644 drivers/usb/typec/class.h
 create mode 100644 drivers/usb/typec/mux.h
 create mode 100644 drivers/usb/typec/port-mapper.c

-- 
2.30.2


^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH v2 6/6] usb: typec: Link all ports during connector registration
@ 2021-03-29 12:19 kernel test robot
  0 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2021-03-29 12:19 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210329084426.78138-7-heikki.krogerus@linux.intel.com>
References: <20210329084426.78138-7-heikki.krogerus@linux.intel.com>
TO: Heikki Krogerus <heikki.krogerus@linux.intel.com>
TO: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
CC: Alan Stern <stern@rowland.harvard.edu>
CC: Benson Leung <bleung@google.com>
CC: Prashant Malani <pmalani@chromium.org>
CC: Guenter Roeck <linux@roeck-us.net>
CC: linux-usb(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

Hi Heikki,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20210326]
[also build test WARNING on v5.12-rc5]
[cannot apply to usb/usb-testing chrome-platform-linux/for-next linus/master v5.12-rc5 v5.12-rc4 v5.12-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Heikki-Krogerus/usb-Linking-ports-to-their-Type-C-connectors/20210329-164859
base:    931294922e65a23e1aad6398b9ae02df74044679
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: i386-randconfig-m021-20210329 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/usb/typec/port-mapper.c:229 each_port() warn: passing a valid pointer to 'PTR_ERR'

Old smatch warnings:
drivers/usb/typec/port-mapper.c:164 typec_link_port() warn: passing a valid pointer to 'PTR_ERR'
drivers/usb/typec/port-mapper.c:168 typec_link_port() warn: missing error code 'ret'

vim +/PTR_ERR +229 drivers/usb/typec/port-mapper.c

10f66a35667732 Heikki Krogerus 2021-03-29  220  
10f66a35667732 Heikki Krogerus 2021-03-29  221  #ifdef CONFIG_USB
10f66a35667732 Heikki Krogerus 2021-03-29  222  static int each_port(struct device *port, void *connector)
10f66a35667732 Heikki Krogerus 2021-03-29  223  {
10f66a35667732 Heikki Krogerus 2021-03-29  224  	struct port_node *node;
10f66a35667732 Heikki Krogerus 2021-03-29  225  	int ret;
10f66a35667732 Heikki Krogerus 2021-03-29  226  
10f66a35667732 Heikki Krogerus 2021-03-29  227  	node = create_port_node(port);
10f66a35667732 Heikki Krogerus 2021-03-29  228  	if (IS_ERR(node))
10f66a35667732 Heikki Krogerus 2021-03-29 @229  		return PTR_ERR(node);
10f66a35667732 Heikki Krogerus 2021-03-29  230  
10f66a35667732 Heikki Krogerus 2021-03-29  231  	if (!connector_match(connector, node)) {
10f66a35667732 Heikki Krogerus 2021-03-29  232  		remove_port_node(node);
10f66a35667732 Heikki Krogerus 2021-03-29  233  		return 0;
10f66a35667732 Heikki Krogerus 2021-03-29  234  	}
10f66a35667732 Heikki Krogerus 2021-03-29  235  
10f66a35667732 Heikki Krogerus 2021-03-29  236  	ret = link_port(to_typec_port(connector), node);
10f66a35667732 Heikki Krogerus 2021-03-29  237  	if (ret) {
10f66a35667732 Heikki Krogerus 2021-03-29  238  		remove_port_node(node->pld);
10f66a35667732 Heikki Krogerus 2021-03-29  239  		return ret;
10f66a35667732 Heikki Krogerus 2021-03-29  240  	}
10f66a35667732 Heikki Krogerus 2021-03-29  241  
10f66a35667732 Heikki Krogerus 2021-03-29  242  	get_device(connector);
10f66a35667732 Heikki Krogerus 2021-03-29  243  
10f66a35667732 Heikki Krogerus 2021-03-29  244  	return 0;
10f66a35667732 Heikki Krogerus 2021-03-29  245  }
10f66a35667732 Heikki Krogerus 2021-03-29  246  #endif
10f66a35667732 Heikki Krogerus 2021-03-29  247  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 28163 bytes --]

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

end of thread, other threads:[~2021-03-30 15:50 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29  8:44 [PATCH v2 0/6] usb: Linking ports to their Type-C connectors Heikki Krogerus
2021-03-29  8:44 ` [PATCH v2 1/6] usb: typec: Organize the private headers properly Heikki Krogerus
2021-03-29  8:44 ` [PATCH v2 2/6] usb: typec: Declare the typec_class static Heikki Krogerus
2021-03-29  8:44 ` [PATCH v2 3/6] usb: typec: Port mapping utility Heikki Krogerus
2021-03-29 15:15   ` kernel test robot
2021-03-29 15:15     ` kernel test robot
2021-03-29 16:06   ` kernel test robot
2021-03-29 16:06     ` kernel test robot
2021-03-29  8:44 ` [PATCH v2 4/6] usb: Link the ports to the connectors they are attached to Heikki Krogerus
2021-03-29  8:44 ` [PATCH v2 5/6] usb: Iterator for ports Heikki Krogerus
2021-03-29 18:49   ` Alan Stern
2021-03-30  9:07     ` Heikki Krogerus
2021-03-30 15:49       ` Alan Stern
2021-03-29  8:44 ` [PATCH v2 6/6] usb: typec: Link all ports during connector registration Heikki Krogerus
2021-03-29  8:48   ` Greg Kroah-Hartman
2021-03-29  9:17     ` Heikki Krogerus
2021-03-29  9:19       ` Heikki Krogerus
2021-03-29  9:21         ` Greg Kroah-Hartman
2021-03-29 12:19 kernel test robot

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.