From: Roger Quadros <roger.quadros@nokia.com>
To: gregkh@suse.de
Cc: stern@rowland.harvard.edu, mina86@mina86.com, m-sonasath@ti.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] usb: gadget: f_mass_storage: Make us pass USBCV MSC Compliance tests
Date: Tue, 19 Apr 2011 16:33:53 +0300 [thread overview]
Message-ID: <1303220033-5274-3-git-send-email-roger.quadros@nokia.com> (raw)
In-Reply-To: <1303220033-5274-1-git-send-email-roger.quadros@nokia.com>
We delay the SET_CONFIG and SET_INTERFACE setup transfers status phase
till we are ready to process new CBW from the host. This way we ensure
that we don't loose any CBW and cause lock up.
Signed-off-by: Roger Quadros <roger.quadros@nokia.com>
---
drivers/usb/gadget/f_mass_storage.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 6d8e533..a70468e 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -347,6 +347,7 @@ struct fsg_operations {
/* Data shared by all the FSG instances. */
struct fsg_common {
struct usb_gadget *gadget;
+ struct usb_composite_dev *cdev;
struct fsg_dev *fsg, *new_fsg;
wait_queue_head_t fsg_wait;
@@ -2468,7 +2469,7 @@ static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
struct fsg_dev *fsg = fsg_from_func(f);
fsg->common->new_fsg = fsg;
raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
- return 0;
+ return USB_GADGET_DELAYED_STATUS;
}
static void fsg_disable(struct usb_function *f)
@@ -2604,6 +2605,8 @@ static void handle_exception(struct fsg_common *common)
case FSG_STATE_CONFIG_CHANGE:
do_set_interface(common, common->new_fsg);
+ if (common->new_fsg)
+ usb_composite_setup_continue(common->cdev);
break;
case FSG_STATE_EXIT:
@@ -3083,6 +3086,7 @@ static int fsg_bind_config(struct usb_composite_dev *cdev,
fsg->function.disable = fsg_disable;
fsg->common = common;
+ fsg->common->cdev = cdev;
/*
* Our caller holds a reference to common structure so we
* don't have to be worry about it being freed until we return
--
1.6.0.4
next prev parent reply other threads:[~2011-04-19 13:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-19 13:33 [PATCH 0/2] usb: gadget: Make mass_storage " Roger Quadros
2011-04-19 13:33 ` [PATCH 1/2] usb: gadget: composite: Allow function drivers to defer setup responses Roger Quadros
2011-04-19 14:14 ` Alan Stern
2011-04-21 13:27 ` Roger Quadros
2011-04-19 14:23 ` Michal Nazarewicz
2011-04-21 13:30 ` Roger Quadros
2011-05-09 9:42 ` Roger Quadros
2011-04-19 13:33 ` Roger Quadros [this message]
2011-04-19 14:33 ` [PATCH 2/2] usb: gadget: f_mass_storage: Make us pass USBCV MSC Compliance tests Michal Nazarewicz
2011-04-19 20:44 ` [PATCH 0/2] usb: gadget: Make mass_storage " Sonasath, Moiz
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=1303220033-5274-3-git-send-email-roger.quadros@nokia.com \
--to=roger.quadros@nokia.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m-sonasath@ti.com \
--cc=mina86@mina86.com \
--cc=stern@rowland.harvard.edu \
/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
all inboxes | Powered by JetHome®