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/storage_common.h | |
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/storage_common.h')
-rw-r--r-- | drivers/usb/gadget/storage_common.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/usb/gadget/storage_common.h b/drivers/usb/gadget/storage_common.h index d8cc090..16cf07b 100644 --- a/drivers/usb/gadget/storage_common.h +++ b/drivers/usb/gadget/storage_common.h @@ -181,6 +181,11 @@ static inline u32 get_unaligned_be24(u8 *buf) return 0xffffff & (u32) get_unaligned_be32(buf - 1); } +static inline struct fsg_lun *fsg_lun_from_dev(struct device *dev) +{ + return container_of(dev, struct fsg_lun, dev); +} + enum { FSG_STRING_INTERFACE }; @@ -205,18 +210,14 @@ void fsg_lun_close(struct fsg_lun *curlun); int fsg_lun_open(struct fsg_lun *curlun, const char *filename); int fsg_lun_fsync_sub(struct fsg_lun *curlun); void store_cdrom_address(u8 *dest, int msf, u32 addr); -ssize_t fsg_show_ro(struct device *dev, struct device_attribute *attr, - char *buf); -ssize_t fsg_show_nofua(struct device *dev, struct device_attribute *attr, - char *buf); -ssize_t fsg_show_file(struct device *dev, struct device_attribute *attr, +ssize_t fsg_show_ro(struct fsg_lun *curlun, char *buf); +ssize_t fsg_show_nofua(struct fsg_lun *curlun, char *buf); +ssize_t fsg_show_file(struct fsg_lun *curlun, struct rw_semaphore *filesem, char *buf); -ssize_t fsg_store_ro(struct device *dev, struct device_attribute *attr, +ssize_t fsg_store_ro(struct fsg_lun *curlun, struct rw_semaphore *filesem, const char *buf, size_t count); -ssize_t fsg_store_nofua(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count); -ssize_t fsg_store_file(struct device *dev, struct device_attribute *attr, +ssize_t fsg_store_nofua(struct fsg_lun *curlun, const char *buf, size_t count); +ssize_t fsg_store_file(struct fsg_lun *curlun, struct rw_semaphore *filesem, const char *buf, size_t count); #endif /* USB_STORAGE_COMMON_H */ |