USB: fix usb mass storage umonut err.
authorwlf <wulf@rock-chips.com>
Thu, 4 Sep 2014 11:39:59 +0000 (19:39 +0800)
committerwlf <wulf@rock-chips.com>
Thu, 4 Sep 2014 11:39:59 +0000 (19:39 +0800)
drivers/usb/gadget/storage_common.c

index a7977eb3ab7b521612bfe0c12b5a973b867f299a..71cebf2e7c9ac914d216eed85506ad4a93a4a8bc 100755 (executable)
@@ -703,10 +703,12 @@ static ssize_t fsg_store_file(struct device *dev, struct device_attribute *attr,
        struct rw_semaphore     *filesem = dev_get_drvdata(dev);
        int             rc = 0;
 
+#ifndef CONFIG_USB_G_ANDROID
        if (curlun->prevent_medium_removal && fsg_lun_is_open(curlun)) {
                LDBG(curlun, "eject attempt prevented\n");
                return -EBUSY;                          /* "Door is locked" */
        }
+#endif
 
        /* Remove a trailing newline */
        if (count > 0 && buf[count-1] == '\n')
@@ -715,12 +717,14 @@ static ssize_t fsg_store_file(struct device *dev, struct device_attribute *attr,
        /* Load new medium */
        down_write(filesem);
        if (count > 0 && buf[0]) {
+               LDBG(curlun, "fsg_lun_open\n");
                /* fsg_lun_open() will close existing file if any. */
                rc = fsg_lun_open(curlun, buf);
                if (rc == 0)
                        curlun->unit_attention_data =
                                        SS_NOT_READY_TO_READY_TRANSITION;
        } else if (fsg_lun_is_open(curlun)) {
+               LDBG(curlun, "fsg_lun_open\n");
                fsg_lun_close(curlun);
                curlun->unit_attention_data = SS_MEDIUM_NOT_PRESENT;
        }