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

usb: core: 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/f01ef2ddaf12a6412127611617786adc1234e0b4.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
372488c6 7a09c126

+6 -4
+2 -1
drivers/usb/core/port.c
··· 7 7 * Author: Lan Tianyu <tianyu.lan@intel.com> 8 8 */ 9 9 10 + #include <linux/kstrtox.h> 10 11 #include <linux/slab.h> 11 12 #include <linux/pm_qos.h> 12 13 #include <linux/component.h> ··· 64 63 bool disabled; 65 64 int rc; 66 65 67 - rc = strtobool(buf, &disabled); 66 + rc = kstrtobool(buf, &disabled); 68 67 if (rc) 69 68 return rc; 70 69
+4 -3
drivers/usb/core/sysfs.c
··· 13 13 14 14 15 15 #include <linux/kernel.h> 16 + #include <linux/kstrtox.h> 16 17 #include <linux/string.h> 17 18 #include <linux/usb.h> 18 19 #include <linux/usb/hcd.h> ··· 506 505 if (ret < 0) 507 506 return -EINTR; 508 507 509 - ret = strtobool(buf, &value); 508 + ret = kstrtobool(buf, &value); 510 509 511 510 if (!ret) { 512 511 udev->usb2_hw_lpm_allowed = value; ··· 976 975 int rc = count; 977 976 bool val; 978 977 979 - if (strtobool(buf, &val) != 0) 978 + if (kstrtobool(buf, &val) != 0) 980 979 return -EINVAL; 981 980 982 981 if (val) ··· 1177 1176 struct usb_interface *intf = to_usb_interface(dev); 1178 1177 bool val; 1179 1178 1180 - if (strtobool(buf, &val) != 0) 1179 + if (kstrtobool(buf, &val) != 0) 1181 1180 return -EINVAL; 1182 1181 1183 1182 if (val)