usb: frmnet: Add support to use multiple transport functions
Current driver supports the single instance of control and data
transport. Add support to use multiple control and data transport
pairs per port (interface) basis. Control and data transport pair is
passed by user space from
/sys/class/android_usb/android0/f_rmnet/transports
Also moved and renamed common function str_to_xport and xport_to_str
to header file and updated respecitve callers of the function.
Change-Id: Ib0ceff85a1224336f7f4929235b6a40b8f13e849
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
index 3fd12b1..7299dff 100644
--- a/drivers/usb/gadget/f_acm.c
+++ b/drivers/usb/gadget/f_acm.c
@@ -107,20 +107,6 @@
return container_of(p, struct f_acm, port);
}
-static char *transport_to_str(enum transport_type t)
-{
- switch (t) {
- case USB_GADGET_FSERIAL_TRANSPORT_TTY:
- return "TTY";
- case USB_GADGET_FSERIAL_TRANSPORT_SDIO:
- return "SDIO";
- case USB_GADGET_FSERIAL_TRANSPORT_SMD:
- return "SMD";
- }
-
- return "NONE";
-}
-
static int gport_setup(struct usb_configuration *c)
{
int ret = 0;
@@ -146,7 +132,7 @@
pr_debug("%s: transport:%s f_acm:%p gserial:%p port_num:%d cl_port_no:%d\n",
- __func__, transport_to_str(acm->transport),
+ __func__, xport_to_str(acm->transport),
acm, &acm->port, acm->port_num, port_num);
switch (acm->transport) {
@@ -161,7 +147,7 @@
break;
default:
pr_err("%s: Un-supported transport: %s\n", __func__,
- transport_to_str(acm->transport));
+ xport_to_str(acm->transport));
return -ENODEV;
}
@@ -175,7 +161,7 @@
port_num = gacm_ports[acm->port_num].client_port_num;
pr_debug("%s: transport:%s f_acm:%p gserial:%p port_num:%d cl_pno:%d\n",
- __func__, transport_to_str(acm->transport),
+ __func__, xport_to_str(acm->transport),
acm, &acm->port, acm->port_num, port_num);
switch (acm->transport) {
@@ -190,7 +176,7 @@
break;
default:
pr_err("%s: Un-supported transport:%s\n", __func__,
- transport_to_str(acm->transport));
+ xport_to_str(acm->transport));
return -ENODEV;
}