[PATCH v2 1/2] usb/gadget: storage_common: use strtobool instead of kstrtouint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



strtobool is more flexible for the user and is more appropriate in the
context.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>
---
 drivers/usb/gadget/storage_common.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
index c7b78a1..8bd5f2d 100644
--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -375,9 +375,9 @@ ssize_t fsg_store_ro(struct fsg_lun *curlun, struct rw_semaphore *filesem,
 		     const char *buf, size_t count)
 {
 	ssize_t		rc;
-	unsigned	ro;
+	bool		ro;
 
-	rc = kstrtouint(buf, 2, &ro);
+	rc = strtobool(buf, &ro);
 	if (rc)
 		return rc;
 
@@ -402,10 +402,10 @@ EXPORT_SYMBOL(fsg_store_ro);
 
 ssize_t fsg_store_nofua(struct fsg_lun *curlun, const char *buf, size_t count)
 {
-	unsigned	nofua;
+	bool		nofua;
 	int		ret;
 
-	ret = kstrtouint(buf, 2, &nofua);
+	ret = strtobool(buf, &nofua);
 	if (ret)
 		return ret;
 
@@ -452,10 +452,10 @@ EXPORT_SYMBOL(fsg_store_file);
 
 ssize_t fsg_store_cdrom(struct fsg_lun *curlun, const char *buf, size_t count)
 {
-	unsigned	cdrom;
+	bool		cdrom;
 	int		ret;
 
-	ret = kstrtouint(buf, 2, &cdrom);
+	ret = strtobool(buf, &cdrom);
 	if (ret)
 		return ret;
 
@@ -468,10 +468,10 @@ EXPORT_SYMBOL(fsg_store_cdrom);
 ssize_t fsg_store_removable(struct fsg_lun *curlun, const char *buf,
 			    size_t count)
 {
-	unsigned	removable;
+	bool		removable;
 	int		ret;
 
-	ret = kstrtouint(buf, 2, &removable);
+	ret = strtobool(buf, &removable);
 	if (ret)
 		return ret;
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux