OSDN Git Service

Revert "usb: gadget: storage: Remove warning message"
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Jul 2019 11:05:59 +0000 (13:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Jul 2019 11:05:59 +0000 (13:05 +0200)
This reverts commit e70b3f5da00119e057b7faa557753fee7f786f17.

EJ writes:
Thinh found this patch might cause a failure in USB CV TD 9.13
Set Configuration Test. We are trying to fix it.  Could you
please defer the merging of this patch until we fix it?

So am now dropping it.

Reported-by: EJ Hsu <ejh@nvidia.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_mass_storage.c
drivers/usb/gadget/function/storage_common.h

index b1fba31..29cc569 100644 (file)
@@ -2293,7 +2293,8 @@ static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 static void fsg_disable(struct usb_function *f)
 {
        struct fsg_dev *fsg = fsg_from_func(f);
-       raise_exception(fsg->common, FSG_STATE_DISCONNECT);
+       fsg->common->new_fsg = NULL;
+       raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
 }
 
 
@@ -2306,7 +2307,6 @@ static void handle_exception(struct fsg_common *common)
        enum fsg_state          old_state;
        struct fsg_lun          *curlun;
        unsigned int            exception_req_tag;
-       struct fsg_dev          *fsg;
 
        /*
         * Clear the existing signals.  Anything but SIGUSR1 is converted
@@ -2413,19 +2413,9 @@ static void handle_exception(struct fsg_common *common)
                break;
 
        case FSG_STATE_CONFIG_CHANGE:
-               fsg = common->new_fsg;
-               /*
-                * Add a check here to double confirm if a disconnect event
-                * occurs and common->new_fsg has been cleared.
-                */
-               if (fsg) {
-                       do_set_interface(common, fsg);
+               do_set_interface(common, common->new_fsg);
+               if (common->new_fsg)
                        usb_composite_setup_continue(common->cdev);
-               }
-               break;
-
-       case FSG_STATE_DISCONNECT:
-               do_set_interface(common, NULL);
                break;
 
        case FSG_STATE_EXIT:
@@ -2999,7 +2989,8 @@ static void fsg_unbind(struct usb_configuration *c, struct usb_function *f)
 
        DBG(fsg, "unbind\n");
        if (fsg->common->fsg == fsg) {
-               raise_exception(fsg->common, FSG_STATE_DISCONNECT);
+               fsg->common->new_fsg = NULL;
+               raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
                /* FIXME: make interruptible or killable somehow? */
                wait_event(common->fsg_wait, common->fsg != fsg);
        }
index 12687f7..e5e3a25 100644 (file)
@@ -161,7 +161,6 @@ enum fsg_state {
        FSG_STATE_ABORT_BULK_OUT,
        FSG_STATE_PROTOCOL_RESET,
        FSG_STATE_CONFIG_CHANGE,
-       FSG_STATE_DISCONNECT,
        FSG_STATE_EXIT,
        FSG_STATE_TERMINATED
 };