usb gadget serial: split out CDC ACM function
Split out CDC ACM parts of "gadget serial" to a "function driver".
Some key structural differences from the previous ACM support, shared
with with the generic serial function (next patch):
- As a function driver, it can be combined with other functions.
One gadget configuration could offer both serial and network
links, as an example.
- One serial port can be exposed in multiple configurations;
the /dev/ttyGS0 node could be exposed regardless of which
config the host selected.
- One configuration can expose multiple serial ports, such as
ttyGS0, ttyGS1, ttyGS2, and ttyGS3.
This code should be a lot easier to understand than the previous
all-in-one-big-file version of the driver.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/drivers/usb/gadget/u_serial.h b/drivers/usb/gadget/u_serial.h
index bc38e68..83b45a3 100644
--- a/drivers/usb/gadget/u_serial.h
+++ b/drivers/usb/gadget/u_serial.h
@@ -12,10 +12,7 @@
#ifndef __U_SERIAL_H
#define __U_SERIAL_H
-/* #include <linux/usb/composite.h> */
-#include <linux/usb/ch9.h>
-#include <linux/usb/gadget.h>
-
+#include <linux/usb/composite.h>
#include <linux/usb/cdc.h>
/*
@@ -32,7 +29,7 @@
* REVISIT someday, allow multiplexing several TTYs over these endpoints.
*/
struct gserial {
- /* struct usb_function func; */
+ struct usb_function func;
/* port is managed by gserial_{connect,disconnect} */
struct gs_port *ioport;
@@ -59,4 +56,7 @@
int gserial_connect(struct gserial *, u8 port_num);
void gserial_disconnect(struct gserial *);
+/* functions are bound to configurations by a config or gadget driver */
+int acm_bind_config(struct usb_configuration *c, u8 port_num);
+
#endif /* __U_SERIAL_H */