On Wed, Jul 06, 2022 at 08:46:34PM +0300, Maxim Devaev wrote: > It allows to reset prevent_medium_removal flag and "eject" the image. > > The patch is a completely alternative implementation of the previously > proposed [1], the idea of which was born after the mentioned discussion. > > Signed-off-by: Maxim Devaev <mdevaev@xxxxxxxxx> > Link: https://lore.kernel.org/lkml/20220406092445.215288-1-mdevaev@xxxxxxxxx [1] > --- > drivers/usb/gadget/function/f_mass_storage.c | 25 ++++++++++++++++++++ > drivers/usb/gadget/function/storage_common.c | 11 +++++++++ > drivers/usb/gadget/function/storage_common.h | 2 ++ > 3 files changed, 38 insertions(+) > > diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c > index 6ad669dde41c..00cac2a38178 100644 > --- a/drivers/usb/gadget/function/f_mass_storage.c > +++ b/drivers/usb/gadget/function/f_mass_storage.c > @@ -2520,10 +2520,21 @@ static ssize_t file_store(struct device *dev, struct device_attribute *attr, > return fsg_store_file(curlun, filesem, buf, count); > } > > +static ssize_t forced_eject_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + struct fsg_lun *curlun = fsg_lun_from_dev(dev); > + struct rw_semaphore *filesem = dev_get_drvdata(dev); > + > + return fsg_store_forced_eject(curlun, filesem, buf, count); > +} > + > static DEVICE_ATTR_RW(nofua); > /* mode wil be set in fsg_lun_attr_is_visible() */ > static DEVICE_ATTR(ro, 0, ro_show, ro_store); > static DEVICE_ATTR(file, 0, file_show, file_store); > +static DEVICE_ATTR_WO(forced_eject); You have to document sysfs files in Documentation/ABI/ in order for us to be able to accept them. thanks, greg k-h