From: "Pali Rohár" <pali.rohar@gmail.com>
To: Felipe Balbi <balbi@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
"Pali Rohár" <pali.rohar@gmail.com>
Subject: [PATCH] usb: gadget: nokia: Add mass storage driver to g_nokia
Date: Sun, 20 Jan 2013 03:58:13 +0100 [thread overview]
Message-ID: <1358650693-29971-1-git-send-email-pali.rohar@gmail.com> (raw)
Signed-off-by: Pali Rohár <pali.rohar@gmail.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
next reply other threads:[~2013-01-20 2:58 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-20 2:58 Pali Rohár [this message]
2013-01-20 9:25 ` Felipe Balbi
2013-01-20 10:17 ` Pali Rohár
2013-01-21 8:05 ` Felipe Balbi
2013-01-22 11:03 ` Pali Rohár
2013-01-22 16:17 ` Felipe Balbi
2013-01-22 21:46 ` Pali Rohár
2013-03-30 18:05 ` Pavel Machek
2015-01-31 9:53 Pali Rohár
2015-02-02 10:56 ` Andrzej Pietrasiewicz
2015-02-02 18:54 ` Felipe Balbi
2015-02-02 18:58 ` Pali Rohár
2015-02-02 19:01 ` Felipe Balbi
2015-02-02 19:07 ` Pali Rohár
2015-02-02 19:14 ` Felipe Balbi
2015-02-05 12:45 ` Pali Rohár
2015-02-07 18:01 ` Ivaylo Dimitrov
2015-02-07 18:33 ` Ivaylo Dimitrov
2015-02-18 12:07 ` Pali Rohár
2015-02-18 12:07 ` Pali Rohár
2015-05-28 7:47 ` Pali Rohár
2015-05-28 14:27 ` Krzysztof Opasiak
2015-05-28 14:31 ` Pali Rohár
2015-05-28 14:51 ` Krzysztof Opasiak
2015-05-28 14:59 ` Pali Rohár
2015-05-28 16:34 ` Felipe Balbi
2015-05-28 21:40 ` Pali Rohár
2015-05-29 16:57 ` Felipe Balbi
2015-06-05 20:09 ` Pali Rohár
2015-06-05 20:17 ` Felipe Balbi
2015-06-06 8:04 ` Pali Rohár
2015-06-08 3:43 ` Felipe Balbi
2015-06-08 6:20 ` Pali Rohár
2015-06-08 16:08 ` Felipe Balbi
2015-07-06 11:59 ` Pali Rohár
2015-07-06 17:40 ` Felipe Balbi
2015-07-06 17:44 ` Felipe Balbi
2015-07-06 18:07 ` Pali Rohár
2015-07-06 18:10 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358650693-29971-1-git-send-email-pali.rohar@gmail.com \
--to=pali.rohar@gmail.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome