summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/storage_common.c
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-07-29 14:42:24 -0400
committerColin Cross <ccross@android.com>2011-06-14 09:09:34 -0700
commit1dabc19e7f8a49cc2cb9dc3989b707470a0c9d90 (patch)
tree1d9932031e5f177fbd19f4b44fb4031f773fde73 /drivers/usb/gadget/storage_common.c
parent2311937725994d67ea771ed386ee107a1dbd20cb (diff)
USB: g_mass_storage: Always allow disabling mass storage by writing to lun file
For android builds we disable the check for curlun->prevent_medium_removal. Instead we let the framework manage unmounting policy, as we sometimes need to unmount after the media has been removed. This also helps support hosts that do not inform the device when the media has been unmounted. Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'drivers/usb/gadget/storage_common.c')
-rw-r--r--drivers/usb/gadget/storage_common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
index 1fa4f705b0b..a872248f37d 100644
--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -763,10 +763,16 @@ 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_ANDROID_MASS_STORAGE
+ /* disabled in android because we need to allow closing the backing file
+ * if the media was removed
+ */
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')