]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
USB: g_mass_storage: superfluous and missing packets fixed
authorMichal Nazarewicz <m.nazarewicz@samsung.com>
Wed, 27 Jan 2010 10:14:28 +0000 (11:14 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 2 Mar 2010 22:54:50 +0000 (14:54 -0800)
The mass storage function responded needlessly to a set
configuration packet.  This was a leftover from converting
gadget (file storage gadget) into a composite function.

Moreover, it has failed to respond to get max LUN request.
Adding request queueing made the function work better.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/f_mass_storage.c

index 0a18d446e9dd26322c60d296c87a811616799e9b..3c835503ffb111f0e80cb919d1fdf9884f2952a1 100644 (file)
@@ -618,7 +618,12 @@ static int fsg_setup(struct usb_function *f,
                        return -EDOM;
                VDBG(fsg, "get max LUN\n");
                *(u8 *) req->buf = fsg->common->nluns - 1;
-               return 1;
+
+               /* Respond with data/status */
+               req->length = min(1, w_length);
+               fsg->common->ep0req_name =
+                       ctrl->bRequestType & USB_DIR_IN ? "ep0-in" : "ep0-out";
+               return ep0_queue(fsg->common);
        }
 
        VDBG(fsg,
@@ -2528,14 +2533,6 @@ static void handle_exception(struct fsg_common *common)
 
        case FSG_STATE_CONFIG_CHANGE:
                rc = do_set_config(common, new_config);
-               if (common->ep0_req_tag != exception_req_tag)
-                       break;
-               if (rc != 0) {                  /* STALL on errors */
-                       DBG(common, "ep0 set halt\n");
-                       usb_ep_set_halt(common->ep0);
-               } else {                        /* Complete the status stage */
-                       ep0_queue(common);
-               }
                break;
 
        case FSG_STATE_EXIT: