usb: gadget: Use kstrtobool() instead of strtobool()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 1 Nov 2022 21:13:56 +0000 (22:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 14:46:01 +0000 (23:46 +0900)
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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/09bc980d8432a4b5f7d88388ec0df5b085583139.1667336095.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/configfs.c
drivers/usb/gadget/function/f_mass_storage.c
drivers/usb/gadget/function/storage_common.c
drivers/usb/gadget/function/u_serial.c
drivers/usb/gadget/legacy/serial.c

index 3a6b4926193ef2b51aba2abdb1bc2476b378d5f4..96121d1c8df4c71e0d4d0077fa0c37121ddd90ba 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/device.h>
+#include <linux/kstrtox.h>
 #include <linux/nls.h>
 #include <linux/usb/composite.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,
        bool use;
 
        mutex_lock(&gi->lock);
-       ret = strtobool(page, &use);
+       ret = kstrtobool(page, &use);
        if (!ret) {
                gi->use_os_desc = use;
                ret = len;
index 3abf7f586e2afba4f08be76bbcb29ea6c7fcdfcd..3a30feb47073f0aeeac0bd13e5f82e36cfe2a030 100644 (file)
 #include <linux/fcntl.h>
 #include <linux/file.h>
 #include <linux/fs.h>
+#include <linux/kstrtox.h>
 #include <linux/kthread.h>
 #include <linux/sched/signal.h>
 #include <linux/limits.h>
@@ -3387,7 +3388,7 @@ static ssize_t fsg_opts_stall_store(struct config_item *item, const char *page,
                return -EBUSY;
        }
 
-       ret = strtobool(page, &stall);
+       ret = kstrtobool(page, &stall);
        if (!ret) {
                opts->common->can_stall = stall;
                ret = len;
index 208c6a92780ab28744b31932c2cdd9961277453a..2a4163b0f6fe26b7e482646fc343a5856e71618b 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/blkdev.h>
 #include <linux/file.h>
 #include <linux/fs.h>
+#include <linux/kstrtox.h>
 #include <linux/usb/composite.h>
 
 #include "storage_common.h"
@@ -396,7 +397,7 @@ ssize_t fsg_store_ro(struct fsg_lun *curlun, struct rw_semaphore *filesem,
        ssize_t         rc;
        bool            ro;
 
-       rc = strtobool(buf, &ro);
+       rc = kstrtobool(buf, &ro);
        if (rc)
                return rc;
 
@@ -419,7 +420,7 @@ ssize_t fsg_store_nofua(struct fsg_lun *curlun, const char *buf, size_t count)
        bool            nofua;
        int             ret;
 
-       ret = strtobool(buf, &nofua);
+       ret = kstrtobool(buf, &nofua);
        if (ret)
                return ret;
 
@@ -470,7 +471,7 @@ ssize_t fsg_store_cdrom(struct fsg_lun *curlun, struct rw_semaphore *filesem,
        bool            cdrom;
        int             ret;
 
-       ret = strtobool(buf, &cdrom);
+       ret = kstrtobool(buf, &cdrom);
        if (ret)
                return ret;
 
@@ -493,7 +494,7 @@ ssize_t fsg_store_removable(struct fsg_lun *curlun, const char *buf,
        bool            removable;
        int             ret;
 
-       ret = strtobool(buf, &removable);
+       ret = kstrtobool(buf, &removable);
        if (ret)
                return ret;
 
index 7538279f98179a17b7ced9b182ebb36b6f655304..840626e064e13a5578930809eb03b3ab889b3426 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/export.h>
 #include <linux/module.h>
 #include <linux/console.h>
+#include <linux/kstrtox.h>
 #include <linux/kthread.h>
 #include <linux/workqueue.h>
 #include <linux/kfifo.h>
@@ -1070,7 +1071,7 @@ ssize_t gserial_set_console(unsigned char port_num, const char *page, size_t cou
        bool enable;
        int ret;
 
-       ret = strtobool(page, &enable);
+       ret = kstrtobool(page, &enable);
        if (ret)
                return ret;
 
index dcd3a6603d900f2a1fd743a2ab14f7ff9a087aa1..4974bee6049a6527b123bfe4fb7463dc48b35fc3 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/kernel.h>
 #include <linux/device.h>
+#include <linux/kstrtox.h>
 #include <linux/module.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
@@ -109,7 +110,7 @@ static int enable_set(const char *s, const struct kernel_param *kp)
        if (!s) /* called for no-arg enable == default */
                return 0;
 
-       ret = strtobool(s, &do_enable);
+       ret = kstrtobool(s, &do_enable);
        if (ret || enable == do_enable)
                return ret;