USB: serial: add support for multi-interface functions
authorJohan Hovold <johan@kernel.org>
Tue, 30 Mar 2021 14:38:19 +0000 (16:38 +0200)
committerJohan Hovold <johan@kernel.org>
Thu, 1 Apr 2021 08:04:07 +0000 (10:04 +0200)
commit5de03c99691d5b0b6253fda1d1d3bbc8239aadb8
tree9116f9279486b19ca31e064ad8afc3cf86e0664d
parentb3431093ad05c5242d87fcf94bddc7a84a2134f5
USB: serial: add support for multi-interface functions

A single USB function can be implemented using a group of interfaces and
this is for example commonly used for Communication Class devices.

Add support for multi-interface functions to USB serial core and export
an interface that allows drivers to claim a second sibling interface.
The interface could easily be extended to allow claiming further
interfaces if ever needed.

When a driver claims a sibling interface in probe(), core allocates
resources for any bulk in, bulk out, interrupt in and interrupt out
endpoints found also on the sibling interface.

Disconnect is implemented so that unbinding either interface will
release the other interface while disconnect() is called precisely once.

Similarly, suspend() is called when the first sibling interface is
suspended and resume() is called when the last sibling interface is
resumed by USB core.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/usb-serial.c
include/linux/usb/serial.h