summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/function/storage_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/function/storage_common.c')
-rw-r--r--drivers/usb/gadget/function/storage_common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/storage_common.c b/drivers/usb/gadget/function/storage_common.c
index b859a158a414..03035dbbe97b 100644
--- a/drivers/usb/gadget/function/storage_common.c
+++ b/drivers/usb/gadget/function/storage_common.c
@@ -519,4 +519,19 @@ ssize_t fsg_store_inquiry_string(struct fsg_lun *curlun, const char *buf,
}
EXPORT_SYMBOL_GPL(fsg_store_inquiry_string);
+ssize_t fsg_store_forced_eject(struct fsg_lun *curlun, struct rw_semaphore *filesem,
+ const char *buf, size_t count)
+{
+ int ret;
+
+ /*
+ * Forcibly detach the backing file from the LUN
+ * regardless of whether the host has allowed it.
+ */
+ curlun->prevent_medium_removal = 0;
+ ret = fsg_store_file(curlun, filesem, "", 0);
+ return ret < 0 ? ret : count;
+}
+EXPORT_SYMBOL_GPL(fsg_store_forced_eject);
+
MODULE_LICENSE("GPL");