Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Christophe JAILLET and committed by
Greg Kroah-Hartman
a8bc8cc1 372488c6

+13 -8
+2 -1
drivers/usb/gadget/configfs.c
··· 3 3 #include <linux/module.h> 4 4 #include <linux/slab.h> 5 5 #include <linux/device.h> 6 + #include <linux/kstrtox.h> 6 7 #include <linux/nls.h> 7 8 #include <linux/usb/composite.h> 8 9 #include <linux/usb/gadget_configfs.h> ··· 801 800 bool use; 802 801 803 802 mutex_lock(&gi->lock); 804 - ret = strtobool(page, &use); 803 + ret = kstrtobool(page, &use); 805 804 if (!ret) { 806 805 gi->use_os_desc = use; 807 806 ret = len;
+2 -1
drivers/usb/gadget/function/f_mass_storage.c
··· 176 176 #include <linux/fcntl.h> 177 177 #include <linux/file.h> 178 178 #include <linux/fs.h> 179 + #include <linux/kstrtox.h> 179 180 #include <linux/kthread.h> 180 181 #include <linux/sched/signal.h> 181 182 #include <linux/limits.h> ··· 3388 3387 return -EBUSY; 3389 3388 } 3390 3389 3391 - ret = strtobool(page, &stall); 3390 + ret = kstrtobool(page, &stall); 3392 3391 if (!ret) { 3393 3392 opts->common->can_stall = stall; 3394 3393 ret = len;
+5 -4
drivers/usb/gadget/function/storage_common.c
··· 23 23 #include <linux/blkdev.h> 24 24 #include <linux/file.h> 25 25 #include <linux/fs.h> 26 + #include <linux/kstrtox.h> 26 27 #include <linux/usb/composite.h> 27 28 28 29 #include "storage_common.h" ··· 397 396 ssize_t rc; 398 397 bool ro; 399 398 400 - rc = strtobool(buf, &ro); 399 + rc = kstrtobool(buf, &ro); 401 400 if (rc) 402 401 return rc; 403 402 ··· 420 419 bool nofua; 421 420 int ret; 422 421 423 - ret = strtobool(buf, &nofua); 422 + ret = kstrtobool(buf, &nofua); 424 423 if (ret) 425 424 return ret; 426 425 ··· 471 470 bool cdrom; 472 471 int ret; 473 472 474 - ret = strtobool(buf, &cdrom); 473 + ret = kstrtobool(buf, &cdrom); 475 474 if (ret) 476 475 return ret; 477 476 ··· 494 493 bool removable; 495 494 int ret; 496 495 497 - ret = strtobool(buf, &removable); 496 + ret = kstrtobool(buf, &removable); 498 497 if (ret) 499 498 return ret; 500 499
+2 -1
drivers/usb/gadget/function/u_serial.c
··· 24 24 #include <linux/export.h> 25 25 #include <linux/module.h> 26 26 #include <linux/console.h> 27 + #include <linux/kstrtox.h> 27 28 #include <linux/kthread.h> 28 29 #include <linux/workqueue.h> 29 30 #include <linux/kfifo.h> ··· 1071 1070 bool enable; 1072 1071 int ret; 1073 1072 1074 - ret = strtobool(page, &enable); 1073 + ret = kstrtobool(page, &enable); 1075 1074 if (ret) 1076 1075 return ret; 1077 1076
+2 -1
drivers/usb/gadget/legacy/serial.c
··· 9 9 10 10 #include <linux/kernel.h> 11 11 #include <linux/device.h> 12 + #include <linux/kstrtox.h> 12 13 #include <linux/module.h> 13 14 #include <linux/tty.h> 14 15 #include <linux/tty_flip.h> ··· 110 109 if (!s) /* called for no-arg enable == default */ 111 110 return 0; 112 111 113 - ret = strtobool(s, &do_enable); 112 + ret = kstrtobool(s, &do_enable); 114 113 if (ret || enable == do_enable) 115 114 return ret; 116 115