Merge "gadget: android: Undo acm code movement"
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index 9dd9c40..87a0078 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -516,6 +516,82 @@
/*-------------------------------------------------------------------------*/
/* Supported functions initialization */
+/* ACM */
+static char acm_transports[32]; /*enabled ACM ports - "tty[,sdio]"*/
+static ssize_t acm_transports_store(
+ struct device *device, struct device_attribute *attr,
+ const char *buff, size_t size)
+{
+ strlcpy(acm_transports, buff, sizeof(acm_transports));
+
+ return size;
+}
+
+static DEVICE_ATTR(acm_transports, S_IWUSR, NULL, acm_transports_store);
+static struct device_attribute *acm_function_attributes[] = {
+ &dev_attr_acm_transports,
+ NULL
+};
+
+static void acm_function_cleanup(struct android_usb_function *f)
+{
+ gserial_cleanup();
+}
+
+static int
+acm_function_bind_config(struct android_usb_function *f,
+ struct usb_configuration *c)
+{
+ char *name;
+ char buf[32], *b;
+ int err = -1, i;
+ static int acm_initialized, ports;
+
+ if (acm_initialized)
+ goto bind_config;
+
+ acm_initialized = 1;
+ strlcpy(buf, acm_transports, sizeof(buf));
+ b = strim(buf);
+
+ while (b) {
+ name = strsep(&b, ",");
+
+ if (name) {
+ err = acm_init_port(ports, name);
+ if (err) {
+ pr_err("acm: Cannot open port '%s'", name);
+ goto out;
+ }
+ ports++;
+ }
+ }
+ err = acm_port_setup(c);
+ if (err) {
+ pr_err("acm: Cannot setup transports");
+ goto out;
+ }
+
+bind_config:
+ for (i = 0; i < ports; i++) {
+ err = acm_bind_config(c, i);
+ if (err) {
+ pr_err("acm: bind_config failed for port %d", i);
+ goto out;
+ }
+ }
+
+out:
+ return err;
+}
+
+static struct android_usb_function acm_function = {
+ .name = "acm",
+ .cleanup = acm_function_cleanup,
+ .bind_config = acm_function_bind_config,
+ .attributes = acm_function_attributes,
+};
+
/* RMNET_SMD */
static int rmnet_smd_function_bind_config(struct android_usb_function *f,
struct usb_configuration *c)
@@ -996,78 +1072,6 @@
.attributes = serial_function_attributes,
};
-/* ACM */
-static char acm_transports[32]; /*enabled ACM ports - "tty[,sdio]"*/
-static ssize_t acm_transports_store(
- struct device *device, struct device_attribute *attr,
- const char *buff, size_t size)
-{
- strlcpy(acm_transports, buff, sizeof(acm_transports));
-
- return size;
-}
-
-static DEVICE_ATTR(acm_transports, S_IWUSR, NULL, acm_transports_store);
-static struct device_attribute *acm_function_attributes[] = {
- &dev_attr_acm_transports, NULL };
-
-static void acm_function_cleanup(struct android_usb_function *f)
-{
- gserial_cleanup();
-}
-
-static int acm_function_bind_config(struct android_usb_function *f,
- struct usb_configuration *c)
-{
- char *name;
- char buf[32], *b;
- int err = -1, i;
- static int acm_initialized, ports;
-
- if (acm_initialized)
- goto bind_config;
-
- acm_initialized = 1;
- strlcpy(buf, acm_transports, sizeof(buf));
- b = strim(buf);
-
- while (b) {
- name = strsep(&b, ",");
-
- if (name) {
- err = acm_init_port(ports, name);
- if (err) {
- pr_err("acm: Cannot open port '%s'", name);
- goto out;
- }
- ports++;
- }
- }
- err = acm_port_setup(c);
- if (err) {
- pr_err("acm: Cannot setup transports");
- goto out;
- }
-
-bind_config:
- for (i = 0; i < ports; i++) {
- err = acm_bind_config(c, i);
- if (err) {
- pr_err("acm: bind_config failed for port %d", i);
- goto out;
- }
- }
-
-out:
- return err;
-}
-static struct android_usb_function acm_function = {
- .name = "acm",
- .cleanup = acm_function_cleanup,
- .bind_config = acm_function_bind_config,
- .attributes = acm_function_attributes,
-};
-
/* CCID */
static int ccid_function_init(struct android_usb_function *f,
struct usb_composite_dev *cdev)
@@ -1093,7 +1097,8 @@
.bind_config = ccid_function_bind_config,
};
-static int mtp_function_init(struct android_usb_function *f,
+static int
+mtp_function_init(struct android_usb_function *f,
struct usb_composite_dev *cdev)
{
return mtp_setup();
@@ -1104,13 +1109,16 @@
mtp_cleanup();
}
-static int mtp_function_bind_config(struct android_usb_function *f,
+static int
+mtp_function_bind_config(struct android_usb_function *f,
struct usb_configuration *c)
{
return mtp_bind_config(c, false);
}
-static int ptp_function_init(struct android_usb_function *f, struct usb_composite_dev *cdev)
+static int
+ptp_function_init(struct android_usb_function *f,
+ struct usb_composite_dev *cdev)
{
/* nothing to do - initialization is handled by mtp_function_init */
return 0;
@@ -1121,7 +1129,9 @@
/* nothing to do - cleanup is handled by mtp_function_cleanup */
}
-static int ptp_function_bind_config(struct android_usb_function *f, struct usb_configuration *c)
+static int
+ptp_function_bind_config(struct android_usb_function *f,
+ struct usb_configuration *c)
{
return mtp_bind_config(c, true);
}