Commit a8bc8cc1 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Greg Kroah-Hartman

usb: gadget: Use kstrtobool() instead of strtobool()

strtobool() is the same as kstrtobool().
However, the latter is more used within the kernel.

In order to remove strtobool() and slightly simplify kstrtox.h, switch to
the other function name.

While at it, include the corresponding header file (<linux/kstrtox.h>)
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/09bc980d8432a4b5f7d88388ec0df5b085583139.1667336095.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 372488c6
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/kstrtox.h>
#include <linux/nls.h> #include <linux/nls.h>
#include <linux/usb/composite.h> #include <linux/usb/composite.h>
#include <linux/usb/gadget_configfs.h> #include <linux/usb/gadget_configfs.h>
...@@ -800,7 +801,7 @@ static ssize_t os_desc_use_store(struct config_item *item, const char *page, ...@@ -800,7 +801,7 @@ static ssize_t os_desc_use_store(struct config_item *item, const char *page,
bool use; bool use;
mutex_lock(&gi->lock); mutex_lock(&gi->lock);
ret = strtobool(page, &use); ret = kstrtobool(page, &use);
if (!ret) { if (!ret) {
gi->use_os_desc = use; gi->use_os_desc = use;
ret = len; ret = len;
......
...@@ -176,6 +176,7 @@ ...@@ -176,6 +176,7 @@
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kstrtox.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/sched/signal.h> #include <linux/sched/signal.h>
#include <linux/limits.h> #include <linux/limits.h>
...@@ -3387,7 +3388,7 @@ static ssize_t fsg_opts_stall_store(struct config_item *item, const char *page, ...@@ -3387,7 +3388,7 @@ static ssize_t fsg_opts_stall_store(struct config_item *item, const char *page,
return -EBUSY; return -EBUSY;
} }
ret = strtobool(page, &stall); ret = kstrtobool(page, &stall);
if (!ret) { if (!ret) {
opts->common->can_stall = stall; opts->common->can_stall = stall;
ret = len; ret = len;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kstrtox.h>
#include <linux/usb/composite.h> #include <linux/usb/composite.h>
#include "storage_common.h" #include "storage_common.h"
...@@ -396,7 +397,7 @@ ssize_t fsg_store_ro(struct fsg_lun *curlun, struct rw_semaphore *filesem, ...@@ -396,7 +397,7 @@ ssize_t fsg_store_ro(struct fsg_lun *curlun, struct rw_semaphore *filesem,
ssize_t rc; ssize_t rc;
bool ro; bool ro;
rc = strtobool(buf, &ro); rc = kstrtobool(buf, &ro);
if (rc) if (rc)
return rc; return rc;
...@@ -419,7 +420,7 @@ ssize_t fsg_store_nofua(struct fsg_lun *curlun, const char *buf, size_t count) ...@@ -419,7 +420,7 @@ ssize_t fsg_store_nofua(struct fsg_lun *curlun, const char *buf, size_t count)
bool nofua; bool nofua;
int ret; int ret;
ret = strtobool(buf, &nofua); ret = kstrtobool(buf, &nofua);
if (ret) if (ret)
return ret; return ret;
...@@ -470,7 +471,7 @@ ssize_t fsg_store_cdrom(struct fsg_lun *curlun, struct rw_semaphore *filesem, ...@@ -470,7 +471,7 @@ ssize_t fsg_store_cdrom(struct fsg_lun *curlun, struct rw_semaphore *filesem,
bool cdrom; bool cdrom;
int ret; int ret;
ret = strtobool(buf, &cdrom); ret = kstrtobool(buf, &cdrom);
if (ret) if (ret)
return ret; return ret;
...@@ -493,7 +494,7 @@ ssize_t fsg_store_removable(struct fsg_lun *curlun, const char *buf, ...@@ -493,7 +494,7 @@ ssize_t fsg_store_removable(struct fsg_lun *curlun, const char *buf,
bool removable; bool removable;
int ret; int ret;
ret = strtobool(buf, &removable); ret = kstrtobool(buf, &removable);
if (ret) if (ret)
return ret; return ret;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/export.h> #include <linux/export.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/kstrtox.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/kfifo.h> #include <linux/kfifo.h>
...@@ -1070,7 +1071,7 @@ ssize_t gserial_set_console(unsigned char port_num, const char *page, size_t cou ...@@ -1070,7 +1071,7 @@ ssize_t gserial_set_console(unsigned char port_num, const char *page, size_t cou
bool enable; bool enable;
int ret; int ret;
ret = strtobool(page, &enable); ret = kstrtobool(page, &enable);
if (ret) if (ret)
return ret; return ret;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/kstrtox.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/tty_flip.h> #include <linux/tty_flip.h>
...@@ -109,7 +110,7 @@ static int enable_set(const char *s, const struct kernel_param *kp) ...@@ -109,7 +110,7 @@ static int enable_set(const char *s, const struct kernel_param *kp)
if (!s) /* called for no-arg enable == default */ if (!s) /* called for no-arg enable == default */
return 0; return 0;
ret = strtobool(s, &do_enable); ret = kstrtobool(s, &do_enable);
if (ret || enable == do_enable) if (ret || enable == do_enable)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment