diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2013-10-09 10:06:03 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-10-10 10:24:15 -0500 |
commit | 77850ae28607f33c1388928b9a4146ee2e0e57cf (patch) | |
tree | 1b5280848da08002e9674963ee0fe6f9b0452867 /drivers/usb/gadget/f_mass_storage.c | |
parent | 2412fbf1ffac21da14308924ccb17fe1a5506b1a (diff) | |
download | op-kernel-dev-77850ae28607f33c1388928b9a4146ee2e0e57cf.zip op-kernel-dev-77850ae28607f33c1388928b9a4146ee2e0e57cf.tar.gz |
usb: gadget: storage_common: make attribute operations more generic
Show/store methods for sysfs attributes contain code which can be used
also by configfs. Make them abstract the source the lun and rw_semaphore
are taken from.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_mass_storage.c')
-rw-r--r-- | drivers/usb/gadget/f_mass_storage.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index d6c2da0..d80be5f 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -2581,37 +2581,52 @@ static int fsg_main_thread(void *common_) static ssize_t ro_show(struct device *dev, struct device_attribute *attr, char *buf) { - return fsg_show_ro(dev, attr, buf); + struct fsg_lun *curlun = fsg_lun_from_dev(dev); + + return fsg_show_ro(curlun, buf); } static ssize_t nofua_show(struct device *dev, struct device_attribute *attr, char *buf) { - return fsg_show_nofua(dev, attr, buf); + struct fsg_lun *curlun = fsg_lun_from_dev(dev); + + return fsg_show_nofua(curlun, buf); } static ssize_t file_show(struct device *dev, struct device_attribute *attr, char *buf) { - return fsg_show_file(dev, attr, buf); + struct fsg_lun *curlun = fsg_lun_from_dev(dev); + struct rw_semaphore *filesem = dev_get_drvdata(dev); + + return fsg_show_file(curlun, filesem, buf); } static ssize_t ro_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - return fsg_store_ro(dev, attr, buf, count); + struct fsg_lun *curlun = fsg_lun_from_dev(dev); + struct rw_semaphore *filesem = dev_get_drvdata(dev); + + return fsg_store_ro(curlun, filesem, buf, count); } static ssize_t nofua_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - return fsg_store_nofua(dev, attr, buf, count); + struct fsg_lun *curlun = fsg_lun_from_dev(dev); + + return fsg_store_nofua(curlun, buf, count); } static ssize_t file_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - return fsg_store_file(dev, attr, buf, count); + struct fsg_lun *curlun = fsg_lun_from_dev(dev); + struct rw_semaphore *filesem = dev_get_drvdata(dev); + + return fsg_store_file(curlun, filesem, buf, count); } static DEVICE_ATTR_RW(ro); |