usb: gadget: storage_common: add methods to show/store 'cdrom' and 'removable'
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Wed, 9 Oct 2013 08:06:04 +0000 (10:06 +0200)
committerFelipe Balbi <balbi@ti.com>
Thu, 10 Oct 2013 15:24:21 +0000 (10:24 -0500)
This will be required by configfs integration.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/storage_common.c
drivers/usb/gadget/storage_common.h

index 969948dc2596a70e385e8b2118f6e188d4f50db0..c7b78a1f60869fd6d19d1a07b482f63e3bcf6152 100644 (file)
@@ -359,6 +359,17 @@ ssize_t fsg_show_file(struct fsg_lun *curlun, struct rw_semaphore *filesem,
 }
 EXPORT_SYMBOL(fsg_show_file);
 
+ssize_t fsg_show_cdrom(struct fsg_lun *curlun, char *buf)
+{
+       return sprintf(buf, "%u\n", curlun->cdrom);
+}
+EXPORT_SYMBOL(fsg_show_cdrom);
+
+ssize_t fsg_show_removable(struct fsg_lun *curlun, char *buf)
+{
+       return sprintf(buf, "%u\n", curlun->removable);
+}
+EXPORT_SYMBOL(fsg_show_removable);
 
 ssize_t fsg_store_ro(struct fsg_lun *curlun, struct rw_semaphore *filesem,
                     const char *buf, size_t count)
@@ -439,4 +450,35 @@ ssize_t fsg_store_file(struct fsg_lun *curlun, struct rw_semaphore *filesem,
 }
 EXPORT_SYMBOL(fsg_store_file);
 
+ssize_t fsg_store_cdrom(struct fsg_lun *curlun, const char *buf, size_t count)
+{
+       unsigned        cdrom;
+       int             ret;
+
+       ret = kstrtouint(buf, 2, &cdrom);
+       if (ret)
+               return ret;
+
+       curlun->cdrom = cdrom;
+
+       return count;
+}
+EXPORT_SYMBOL(fsg_store_cdrom);
+
+ssize_t fsg_store_removable(struct fsg_lun *curlun, const char *buf,
+                           size_t count)
+{
+       unsigned        removable;
+       int             ret;
+
+       ret = kstrtouint(buf, 2, &removable);
+       if (ret)
+               return ret;
+
+       curlun->removable = removable;
+
+       return count;
+}
+EXPORT_SYMBOL(fsg_store_removable);
+
 MODULE_LICENSE("GPL");
index 16cf07bb9e7576e8729ee2a94f058e9e1186eae1..e0f7aa69c7ed2cf137f7513c6cf9cfc62f419b19 100644 (file)
@@ -214,10 +214,15 @@ 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_show_cdrom(struct fsg_lun *curlun, char *buf);
+ssize_t fsg_show_removable(struct fsg_lun *curlun, char *buf);
 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 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);
+ssize_t fsg_store_cdrom(struct fsg_lun *curlun, const char *buf, size_t count);
+ssize_t fsg_store_removable(struct fsg_lun *curlun, const char *buf,
+                           size_t count);
 
 #endif /* USB_STORAGE_COMMON_H */