aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_mass_storage.c
diff options
context:
space:
mode:
authorBenoit Goby <benoit@android.com>2011-04-19 20:37:33 -0700
committerBenoit Goby <benoit@android.com>2011-06-17 16:02:37 -0700
commitaab96815ae9a40e05600b8e351561b514233afca (patch)
treeb96a69b2be5f648ee17581246acf97895f1c72bf /drivers/usb/gadget/f_mass_storage.c
parent94df1bdfdca9be6d4bbe6cc56354b4ee536cb15a (diff)
downloadkernel_samsung_aries-aab96815ae9a40e05600b8e351561b514233afca.zip
kernel_samsung_aries-aab96815ae9a40e05600b8e351561b514233afca.tar.gz
kernel_samsung_aries-aab96815ae9a40e05600b8e351561b514233afca.tar.bz2
usb: gadget: android: Update android gadget driver
* Functions and the device descriptor are configured from user space: echo 0 > /sys/class/android_usb/android0/enable echo adb,acm > /sys/class/android_usb/android0/functions echo 2 > /sys/class/android_usb/android0/f_acm/instances echo 1 > /sys/class/android_usb/android0/enable * Driver does not require platform data anymore * Moved function initialization to android.c instead of each function file * Replaced switches by uevents Signed-off-by: Benoit Goby <benoit@android.com> Signed-off-by: Mike Lockwood <lockwood@android.com> Change-Id: If5ad9267c111ad0a442f0d87a0d31082dc5381b6
Diffstat (limited to 'drivers/usb/gadget/f_mass_storage.c')
-rw-r--r--drivers/usb/gadget/f_mass_storage.c82
1 files changed, 1 insertions, 81 deletions
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index a296cd8..5440c6d 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -297,12 +297,6 @@
#include "gadget_chips.h"
-#ifdef CONFIG_USB_ANDROID_MASS_STORAGE
-#include <linux/usb/android_composite.h>
-#include <linux/platform_device.h>
-
-#define FUNCTION_NAME "usb_mass_storage"
-#endif
/*------------------------------------------------------------------------*/
@@ -438,10 +432,6 @@ struct fsg_config {
u16 release;
char can_stall;
-
-#ifdef CONFIG_USB_ANDROID_MASS_STORAGE
- struct platform_device *pdev;
-#endif
};
struct fsg_dev {
@@ -2790,13 +2780,7 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
curlun->initially_ro = curlun->ro;
curlun->removable = lcfg->removable;
curlun->dev.release = fsg_lun_release;
-
-#ifdef CONFIG_USB_ANDROID_MASS_STORAGE
- /* use "usb_mass_storage" platform device as parent */
- curlun->dev.parent = &cfg->pdev->dev;
-#else
curlun->dev.parent = &gadget->dev;
-#endif
/* curlun->dev.driver = &fsg_driver.driver; XXX */
dev_set_drvdata(&curlun->dev, &common->filesem);
dev_set_name(&curlun->dev,
@@ -3068,11 +3052,7 @@ static int fsg_bind_config(struct usb_composite_dev *cdev,
if (unlikely(!fsg))
return -ENOMEM;
-#ifdef CONFIG_USB_ANDROID_MASS_STORAGE
- fsg->function.name = FUNCTION_NAME;
-#else
- fsg->function.name = FSG_DRIVER_DESC;
-#endif
+ fsg->function.name = "mass_storage";
fsg->function.strings = fsg_strings_array;
fsg->function.bind = fsg_bind;
fsg->function.unbind = fsg_unbind;
@@ -3198,63 +3178,3 @@ fsg_common_from_params(struct fsg_common *common,
return fsg_common_init(common, cdev, &cfg);
}
-#ifdef CONFIG_USB_ANDROID_MASS_STORAGE
-
-static struct fsg_config fsg_cfg;
-
-static int fsg_probe(struct platform_device *pdev)
-{
- struct usb_mass_storage_platform_data *pdata = pdev->dev.platform_data;
- int i, nluns;
-
- printk(KERN_INFO "fsg_probe pdev: %p, pdata: %p\n", pdev, pdata);
- if (!pdata)
- return -1;
-
- nluns = pdata->nluns;
- if (nluns > FSG_MAX_LUNS)
- nluns = FSG_MAX_LUNS;
- fsg_cfg.nluns = nluns;
- for (i = 0; i < nluns; i++)
- fsg_cfg.luns[i].removable = 1;
-
- fsg_cfg.vendor_name = pdata->vendor;
- fsg_cfg.product_name = pdata->product;
- fsg_cfg.release = pdata->release;
- fsg_cfg.can_stall = 0;
- fsg_cfg.pdev = pdev;
-
- return 0;
-}
-
-static struct platform_driver fsg_platform_driver = {
- .driver = { .name = FUNCTION_NAME, },
- .probe = fsg_probe,
-};
-
-int mass_storage_bind_config(struct usb_configuration *c)
-{
- struct fsg_common *common = fsg_common_init(NULL, c->cdev, &fsg_cfg);
- if (IS_ERR(common))
- return -1;
- return fsg_add(c->cdev, c, common);
-}
-
-static struct android_usb_function mass_storage_function = {
- .name = FUNCTION_NAME,
- .bind_config = mass_storage_bind_config,
-};
-
-static int __init init(void)
-{
- int rc;
- printk(KERN_INFO "f_mass_storage init\n");
- rc = platform_driver_register(&fsg_platform_driver);
- if (rc != 0)
- return rc;
- android_register_function(&mass_storage_function);
- return 0;
-}module_init(init);
-
-#endif /* CONFIG_USB_ANDROID_MASS_STORAGE */
-