[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1358650693-29971-1-git-send-email-pali.rohar@gmail.com>
Date: Sun, 20 Jan 2013 03:58:13 +0100
From: Pali Rohár <pali.rohar@...il.com>
To: Felipe Balbi <balbi@...com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Pali Rohár <pali.rohar@...il.com>
Subject: [PATCH] usb: gadget: nokia: Add mass storage driver to g_nokia
Signed-off-by: Pali Rohár <pali.rohar@...il.com>
---
drivers/usb/gadget/nokia.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index 661600a..56409ee 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -38,6 +38,7 @@
* a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/
#include "u_serial.c"
+#include "f_mass_storage.c"
#include "f_acm.c"
#include "f_ecm.c"
#include "f_obex.c"
@@ -99,6 +100,17 @@ MODULE_LICENSE("GPL");
/*-------------------------------------------------------------------------*/
+static struct fsg_module_parameters fsg_mod_data = {
+ .stall = 0,
+ .luns = 2,
+ .removable_count = 2,
+ .removable = { 1, 1, },
+};
+
+FSG_MODULE_PARAMETERS(/* no prefix */, fsg_mod_data);
+
+static struct fsg_common fsg_common;
+
static u8 hostaddr[ETH_ALEN];
static int __init nokia_bind_config(struct usb_configuration *c)
@@ -125,6 +137,11 @@ static int __init nokia_bind_config(struct usb_configuration *c)
if (status)
printk(KERN_DEBUG "could not bind ecm config\n");
+ status = fsg_bind_config(c->cdev, c, &fsg_common);
+ if (status)
+ printk(KERN_DEBUG "could not bind fsg config\n");
+ fsg_common_put(&fsg_common);
+
return status;
}
@@ -148,6 +165,8 @@ static int __init nokia_bind(struct usb_composite_dev *cdev)
{
struct usb_gadget *gadget = cdev->gadget;
int status;
+ void *retp;
+ struct fsg_config fsg_cfg;
status = gphonet_setup(cdev->gadget);
if (status < 0)
@@ -161,6 +180,15 @@ static int __init nokia_bind(struct usb_composite_dev *cdev)
if (status < 0)
goto err_ether;
+ fsg_config_from_params(&fsg_cfg, &fsg_mod_data);
+ fsg_cfg.vendor_name = "Nokia";
+ fsg_cfg.product_name = "N900";
+ retp = fsg_common_init(&fsg_common, cdev, &fsg_cfg);
+ if (IS_ERR(retp)) {
+ status = PTR_ERR(retp);
+ goto err_fsg;
+ }
+
status = usb_string_ids_tab(cdev, strings_dev);
if (status < 0)
goto err_usb;
@@ -190,6 +218,8 @@ static int __init nokia_bind(struct usb_composite_dev *cdev)
return 0;
err_usb:
+ fsg_common_put(&fsg_common);
+err_fsg:
gether_cleanup();
err_ether:
gserial_cleanup();
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists