From 54ebcb5cec016a29d70c04da6cc1000b2ba5b097 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Sat, 30 Jul 2011 22:45:28 +0800 Subject: [PATCH] Revert "USB: gadget: android: android USB gadget improvements:" This reverts commit 0ab69f47e172739fd499f09469fde6eb16e9287d. --- drivers/usb/gadget/Kconfig | 14 +++------ drivers/usb/gadget/Makefile | 1 - drivers/usb/gadget/android.c | 2 +- drivers/usb/gadget/f_acm.c | 21 +++++--------- drivers/usb/gadget/f_adb.c | 2 -- drivers/usb/gadget/f_mass_storage.c | 6 ++-- drivers/usb/gadget/f_rndis.c | 45 +++++------------------------ drivers/usb/gadget/u_ether.h | 2 +- 8 files changed, 25 insertions(+), 68 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index f703c762e0e4..6a79468ae919 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -802,28 +802,22 @@ config USB_ANDROID enabled and disabled dynamically. config USB_ANDROID_ACM - boolean "Android gadget ACM serial function" + boolean "Android gadget ACM function" depends on USB_ANDROID help - Provides ACM serial function for android gadget driver. + Provides adb function for adb gadget driver. config USB_ANDROID_ADB boolean "Android gadget adb function" depends on USB_ANDROID help - Provides adb function for android gadget driver. + Provides adb function for adb gadget driver. config USB_ANDROID_MASS_STORAGE boolean "Android gadget mass storage function" depends on USB_ANDROID && SWITCH help - Provides USB mass storage function for android gadget driver. - -config USB_ANDROID_RNDIS - boolean "Android gadget RNDIS ethernet function" - depends on USB_ANDROID - help - Provides RNDIS ethernet function for android gadget driver. + Provides USB mass storage function for adb gadget driver. config USB_CDC_COMPOSITE tristate "CDC Composite Device (Ethernet and ACM)" diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index eaf8c27bc5a0..0e0f7fe2e576 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile @@ -55,5 +55,4 @@ obj-$(CONFIG_USB_ANDROID) += android.o obj-$(CONFIG_USB_ANDROID_ACM) += f_acm.o u_serial.o obj-$(CONFIG_USB_ANDROID_ADB) += f_adb.o obj-$(CONFIG_USB_ANDROID_MASS_STORAGE) += f_mass_storage.o -obj-$(CONFIG_USB_ANDROID_RNDIS) += f_rndis.o u_ether.o diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c index ce7426be487d..d10568ef8940 100755 --- a/drivers/usb/gadget/android.c +++ b/drivers/usb/gadget/android.c @@ -305,7 +305,7 @@ void android_register_function(struct android_usb_function *f) { struct android_dev *dev = _android_dev; - printk(KERN_INFO "android_register_function %s\n", f->name); + printk(KERN_INFO "android_register_function\n"); list_add_tail(&f->list, &_functions); _registered_function_count++; diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c index 68c74a2ba0c0..436e0f297389 100644 --- a/drivers/usb/gadget/f_acm.c +++ b/drivers/usb/gadget/f_acm.c @@ -14,10 +14,10 @@ #include #include -#include #include "u_serial.h" #include "gadget_chips.h" +#include "linux/usb/android_composite.h" /* @@ -385,10 +385,10 @@ static int acm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) usb_ep_disable(acm->notify); } else { VDBG(cdev, "init acm ctrl interface %d\n", intf); + acm->notify_desc = ep_choose(cdev->gadget, + acm->hs.notify, + acm->fs.notify); } - acm->notify_desc = ep_choose(cdev->gadget, - acm->hs.notify, - acm->fs.notify); usb_ep_enable(acm->notify, acm->notify_desc); acm->notify->driver_data = acm; @@ -398,11 +398,11 @@ static int acm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) gserial_disconnect(&acm->port); } else { DBG(cdev, "activate acm ttyGS%d\n", acm->port_num); + acm->port.in_desc = ep_choose(cdev->gadget, + acm->hs.in, acm->fs.in); + acm->port.out_desc = ep_choose(cdev->gadget, + acm->hs.out, acm->fs.out); } - acm->port.in_desc = ep_choose(cdev->gadget, - acm->hs.in, acm->fs.in); - acm->port.out_desc = ep_choose(cdev->gadget, - acm->hs.out, acm->fs.out); gserial_connect(&acm->port, acm->port_num); } else @@ -763,8 +763,6 @@ int __init acm_bind_config(struct usb_configuration *c, u8 port_num) return status; } -#ifdef CONFIG_USB_ANDROID_ACM - int acm_function_bind_config(struct usb_configuration *c) { int ret = acm_bind_config(c, 0); @@ -780,10 +778,7 @@ static struct android_usb_function acm_function = { static int __init init(void) { - printk(KERN_INFO "f_acm init\n"); android_register_function(&acm_function); return 0; } module_init(init); - -#endif /* CONFIG_USB_ANDROID_ACM */ diff --git a/drivers/usb/gadget/f_adb.c b/drivers/usb/gadget/f_adb.c index 8ea6b3bec313..f782796ce7d9 100644 --- a/drivers/usb/gadget/f_adb.c +++ b/drivers/usb/gadget/f_adb.c @@ -235,7 +235,6 @@ static int __init create_bulk_endpoints(struct adb_dev *dev, return -ENODEV; } DBG(cdev, "usb_ep_autoconfig for ep_in got %s\n", ep->name); - ep->driver_data = dev; /* claim the endpoint */ dev->ep_in = ep; ep = usb_ep_autoconfig(cdev->gadget, out_desc); @@ -244,7 +243,6 @@ static int __init create_bulk_endpoints(struct adb_dev *dev, return -ENODEV; } DBG(cdev, "usb_ep_autoconfig for adb ep_out got %s\n", ep->name); - ep->driver_data = dev; /* claim the endpoint */ dev->ep_out = ep; /* now allocate requests for our endpoints */ diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 1dc72346b81b..98d1f6774f0f 100755 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -69,9 +69,10 @@ #include #include -#include #include #include +#include +#include #include #include "gadget_chips.h" @@ -2755,7 +2756,8 @@ fsg_function_bind(struct usb_configuration *c, struct usb_function *f) else curlun->dev.parent = &cdev->gadget->dev; dev_set_drvdata(&curlun->dev, fsg); - dev_set_name(&curlun->dev,"lun%d", i); + snprintf(curlun->dev.bus_id, BUS_ID_SIZE, + "lun%d", i); rc = device_register(&curlun->dev); if (rc != 0) { diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index af67a0096e09..c9966cc07d3a 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c @@ -25,7 +25,6 @@ #include #include #include -#include #include @@ -468,10 +467,10 @@ static int rndis_set_alt(struct usb_function *f, unsigned intf, unsigned alt) usb_ep_disable(rndis->notify); } else { VDBG(cdev, "init rndis ctrl %d\n", intf); + rndis->notify_desc = ep_choose(cdev->gadget, + rndis->hs.notify, + rndis->fs.notify); } - rndis->notify_desc = ep_choose(cdev->gadget, - rndis->hs.notify, - rndis->fs.notify); usb_ep_enable(rndis->notify, rndis->notify_desc); rndis->notify->driver_data = rndis; @@ -485,11 +484,11 @@ static int rndis_set_alt(struct usb_function *f, unsigned intf, unsigned alt) if (!rndis->port.in) { DBG(cdev, "init rndis\n"); + rndis->port.in = ep_choose(cdev->gadget, + rndis->hs.in, rndis->fs.in); + rndis->port.out = ep_choose(cdev->gadget, + rndis->hs.out, rndis->fs.out); } - rndis->port.in = ep_choose(cdev->gadget, - rndis->hs.in, rndis->fs.in); - rndis->port.out = ep_choose(cdev->gadget, - rndis->hs.out, rndis->fs.out); /* Avoid ZLPs; they can be troublesome. */ rndis->port.is_zlp_ok = false; @@ -834,33 +833,3 @@ fail: } return status; } - -#ifdef CONFIG_USB_ANDROID_RNDIS -#include "rndis.c" - -// FIXME - using bogus MAC address for now - -static u8 ethaddr[ETH_ALEN] = { 11, 22, 33, 44, 55, 66 }; - -int rndis_function_bind_config(struct usb_configuration *c) -{ - int ret = gether_setup(c->cdev->gadget, ethaddr); - if (ret == 0) - ret = rndis_bind_config(c, ethaddr); - return ret; -} - -static struct android_usb_function rndis_function = { - .name = "rndis", - .bind_config = rndis_function_bind_config, -}; - -static int __init init(void) -{ - printk(KERN_INFO "f_rndis init\n"); - android_register_function(&rndis_function); - return 0; -} -module_init(init); - -#endif /* CONFIG_USB_ANDROID_RNDIS */ diff --git a/drivers/usb/gadget/u_ether.h b/drivers/usb/gadget/u_ether.h index 82b30b5de268..91b39ffdf6ea 100644 --- a/drivers/usb/gadget/u_ether.h +++ b/drivers/usb/gadget/u_ether.h @@ -112,7 +112,7 @@ int geth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); int ecm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); int eem_bind_config(struct usb_configuration *c); -#if defined(CONFIG_USB_ETH_RNDIS) || defined(CONFIG_USB_ANDROID_RNDIS) +#ifdef CONFIG_USB_ETH_RNDIS int rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); -- 2.34.1