2022-11-01 21:38:25

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 00/30] Remove 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>)


Each patch can be applied independently from the other ones.
The last patch of the serie removes the definition of strtobool().

All patches have been compile tested, except the ones against
arm64, s390 and irq-gic.


Finally, this gives the opportunity to remove some <linux/kernel.h> from
a few drivers. This will be addressed later when/if the serie is applied.


Christophe JAILLET (30):
net: usb: Use kstrtobool() instead of strtobool()
wifi: Use kstrtobool() instead of strtobool()
irqchip: Use kstrtobool() instead of strtobool()
scsi: target: Use kstrtobool() instead of strtobool()
nvdimm: Use kstrtobool() instead of strtobool()
nvme: Use kstrtobool() instead of strtobool()
usb: core: Use kstrtobool() instead of strtobool()
usb: gadget: Use kstrtobool() instead of strtobool()
ACPI: sysfs: Use kstrtobool() instead of strtobool()
clocksource/drivers/arm_arch_timer: Use kstrtobool() instead of
strtobool()
greybus: svc: Use kstrtobool() instead of strtobool()
input: Use kstrtobool() instead of strtobool()
platform/chrome: Use kstrtobool() instead of strtobool()
powercap: Use kstrtobool() instead of strtobool()
video: fbdev: omapfb: Use kstrtobool() instead of strtobool()
cifs: Use kstrtobool() instead of strtobool()
initramfs: Use kstrtobool() instead of strtobool()
module: Use kstrtobool() instead of strtobool()
kernel/params.c: Use kstrtobool() instead of strtobool()
mm/damon: Use kstrtobool() instead of strtobool()
mm: Use kstrtobool() instead of strtobool()
Bluetooth: hci_debugfs:: Use kstrtobool() instead of strtobool()
test_firmware: Use kstrtobool() instead of strtobool()
arm64: cpufeature: Use kstrtobool() instead of strtobool()
KVM: arm64: vgic-v3: Use kstrtobool() instead of strtobool()
s390/ipl: Use kstrtobool() instead of strtobool()
KVM: x86/mmu: Use kstrtobool() instead of strtobool()
x86/xen: Use kstrtobool() instead of strtobool()
driver core: Use kstrtobool() instead of strtobool()
kstrtox: Remove strtobool()

arch/arm64/kernel/cpufeature.c | 5 ++--
arch/arm64/kvm/vgic/vgic-v3.c | 9 +++---
arch/s390/kernel/ipl.c | 7 +++--
arch/x86/kvm/mmu/mmu.c | 3 +-
arch/x86/xen/enlighten_pv.c | 3 +-
arch/x86/xen/setup.c | 3 +-
drivers/acpi/sysfs.c | 3 +-
drivers/base/core.c | 7 +++--
drivers/clocksource/arm_arch_timer.c | 3 +-
drivers/greybus/svc.c | 3 +-
drivers/input/input.c | 3 +-
drivers/irqchip/irq-gic-v3.c | 3 +-
drivers/irqchip/irq-gic.c | 3 +-
drivers/net/usb/cdc_ncm.c | 3 +-
drivers/net/usb/qmi_wwan.c | 5 ++--
drivers/net/wireless/ath/ath10k/debug.c | 5 ++--
drivers/net/wireless/ath/ath9k/ath9k.h | 1 +
drivers/net/wireless/ath/ath9k/tx99.c | 2 +-
.../net/wireless/marvell/mwifiex/debugfs.c | 2 +-
drivers/net/wireless/marvell/mwifiex/main.h | 1 +
drivers/nvdimm/namespace_devs.c | 3 +-
drivers/nvdimm/pmem.c | 3 +-
drivers/nvdimm/region_devs.c | 5 ++--
drivers/nvme/host/pci.c | 3 +-
drivers/nvme/target/configfs.c | 17 ++++++-----
drivers/platform/chrome/cros_ec_lightbar.c | 3 +-
drivers/powercap/powercap_sys.c | 3 +-
drivers/target/target_core_configfs.c | 29 ++++++++++---------
drivers/target/target_core_fabric_configfs.c | 3 +-
drivers/usb/core/port.c | 3 +-
drivers/usb/core/sysfs.c | 7 +++--
drivers/usb/gadget/configfs.c | 3 +-
drivers/usb/gadget/function/f_mass_storage.c | 3 +-
drivers/usb/gadget/function/storage_common.c | 9 +++---
drivers/usb/gadget/function/u_serial.c | 3 +-
drivers/usb/gadget/legacy/serial.c | 3 +-
.../fbdev/omap2/omapfb/dss/display-sysfs.c | 7 +++--
.../fbdev/omap2/omapfb/dss/manager-sysfs.c | 7 +++--
.../fbdev/omap2/omapfb/dss/overlay-sysfs.c | 3 +-
.../video/fbdev/omap2/omapfb/omapfb-sysfs.c | 3 +-
fs/cifs/cifs_debug.c | 5 ++--
include/linux/kernel.h | 2 +-
init/initramfs.c | 8 ++++-
kernel/module/main.c | 3 +-
kernel/params.c | 3 +-
lib/test_firmware.c | 3 +-
mm/damon/lru_sort.c | 3 +-
mm/damon/reclaim.c | 3 +-
mm/page_table_check.c | 3 +-
mm/usercopy.c | 3 +-
net/bluetooth/hci_debugfs.c | 3 +-
51 files changed, 143 insertions(+), 90 deletions(-)

--
2.34.1



2022-11-01 21:41:57

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 30/30] kstrtox: Remove strtobool()

strtobool() is the same as kstrtobool().
All uses of strtobool() have been turned into kstrtobool().

So strtobool() can now be removed as well.

Signed-off-by: Christophe JAILLET <[email protected]>
---
include/linux/kernel.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index fe6efb24d151..244b92041cb0 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -20,7 +20,7 @@
#include <linux/compiler.h>
#include <linux/container_of.h>
#include <linux/bitops.h>
-#include <linux/kstrtox.h>
+//#include <linux/kstrtox.h>
#include <linux/log2.h>
#include <linux/math.h>
#include <linux/minmax.h>
--
2.34.1


2022-11-01 21:42:24

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 01/30] net: usb: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/net/usb/cdc_ncm.c | 3 ++-
drivers/net/usb/qmi_wwan.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 8d5cbda33f66..6b5f24f28dd1 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -43,6 +43,7 @@
#include <linux/ctype.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
+#include <linux/kstrtox.h>
#include <linux/workqueue.h>
#include <linux/mii.h>
#include <linux/crc32.h>
@@ -318,7 +319,7 @@ static ssize_t ndp_to_end_store(struct device *d, struct device_attribute *attr
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
bool enable;

- if (strtobool(buf, &enable))
+ if (kstrtobool(buf, &enable))
return -EINVAL;

/* no change? */
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 26c34a7c21bd..30d733c81ed8 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -13,6 +13,7 @@
#include <linux/ethtool.h>
#include <linux/etherdevice.h>
#include <linux/if_arp.h>
+#include <linux/kstrtox.h>
#include <linux/mii.h>
#include <linux/rtnetlink.h>
#include <linux/usb.h>
@@ -343,7 +344,7 @@ static ssize_t raw_ip_store(struct device *d, struct device_attribute *attr, co
bool enable;
int ret;

- if (strtobool(buf, &enable))
+ if (kstrtobool(buf, &enable))
return -EINVAL;

/* no change? */
@@ -492,7 +493,7 @@ static ssize_t pass_through_store(struct device *d,
struct qmi_wwan_state *info;
bool enable;

- if (strtobool(buf, &enable))
+ if (kstrtobool(buf, &enable))
return -EINVAL;

info = (void *)&dev->data;
--
2.34.1


2022-11-01 21:42:54

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 03/30] irqchip: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].


This patch has NOT been compile tested.


[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/irqchip/irq-gic-v3.c | 3 ++-
drivers/irqchip/irq-gic.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 34d58567b78d..997104d4338e 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -12,6 +12,7 @@
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
+#include <linux/kstrtox.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
@@ -1171,7 +1172,7 @@ static bool gicv3_nolpi;

static int __init gicv3_nolpi_cfg(char *buf)
{
- return strtobool(buf, &gicv3_nolpi);
+ return kstrtobool(buf, &gicv3_nolpi);
}
early_param("irqchip.gicv3_nolpi", gicv3_nolpi_cfg);

diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 4c7bae0ec8f9..799f86d84b43 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -19,6 +19,7 @@
*/
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/kstrtox.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/list.h>
@@ -1332,7 +1333,7 @@ static bool gicv2_force_probe;

static int __init gicv2_force_probe_cfg(char *buf)
{
- return strtobool(buf, &gicv2_force_probe);
+ return kstrtobool(buf, &gicv2_force_probe);
}
early_param("irqchip.gicv2_force_probe", gicv2_force_probe_cfg);

--
2.34.1


2022-11-01 21:43:15

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 17/30] initramfs: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
init/initramfs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/init/initramfs.c b/init/initramfs.c
index 62321883fe61..174e15236c8e 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -11,6 +11,7 @@
#include <linux/syscalls.h>
#include <linux/utime.h>
#include <linux/file.h>
+#include <linux/kstrtox.h>
#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/namei.h>
@@ -571,7 +572,12 @@ __setup("keepinitrd", keepinitrd_setup);
static bool __initdata initramfs_async = true;
static int __init initramfs_async_setup(char *str)
{
- strtobool(str, &initramfs_async);
+ int ret;
+
+ ret = kstrtobool(str, &initramfs_async);
+ if (ret)
+ return 0;
+
return 1;
}
__setup("initramfs_async=", initramfs_async_setup);
--
2.34.1


2022-11-01 21:43:53

by Christophe JAILLET

[permalink] [raw]
Subject: Re: [PATCH 30/30] kstrtox: Remove strtobool()

Le 01/11/2022 à 22:14, Christophe JAILLET a écrit :
> strtobool() is the same as kstrtobool().
> All uses of strtobool() have been turned into kstrtobool().
>
> So strtobool() can now be removed as well.
>
> Signed-off-by: Christophe JAILLET <[email protected]>
> ---
> include/linux/kernel.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index fe6efb24d151..244b92041cb0 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -20,7 +20,7 @@
> #include <linux/compiler.h>
> #include <linux/container_of.h>
> #include <linux/bitops.h>
> -#include <linux/kstrtox.h>
> +//#include <linux/kstrtox.h>
> #include <linux/log2.h>
> #include <linux/math.h>
> #include <linux/minmax.h>

Ouch, the last patch is not what was expected...

I'll send it separately when the other patches are merged.

CJ

2022-11-01 21:44:00

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 12/30] input: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/input/input.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index ebb2b7f0f8ff..783961df3626 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -21,6 +21,7 @@
#include <linux/seq_file.h>
#include <linux/poll.h>
#include <linux/device.h>
+#include <linux/kstrtox.h>
#include <linux/mutex.h>
#include <linux/rcupdate.h>
#include "input-compat.h"
@@ -1465,7 +1466,7 @@ static ssize_t inhibited_store(struct device *dev,
ssize_t rv;
bool inhibited;

- if (strtobool(buf, &inhibited))
+ if (kstrtobool(buf, &inhibited))
return -EINVAL;

if (inhibited)
--
2.34.1


2022-11-01 21:45:25

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 05/30] nvdimm: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/nvdimm/namespace_devs.c | 3 ++-
drivers/nvdimm/pmem.c | 3 ++-
drivers/nvdimm/region_devs.c | 5 +++--
3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index c60ec0b373c5..07177eadc56e 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -2,6 +2,7 @@
/*
* Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
*/
+#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/sort.h>
@@ -1338,7 +1339,7 @@ static ssize_t force_raw_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
bool force_raw;
- int rc = strtobool(buf, &force_raw);
+ int rc = kstrtobool(buf, &force_raw);

if (rc)
return rc;
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 3c63dc2cdc81..46475d146f64 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -17,6 +17,7 @@
#include <linux/moduleparam.h>
#include <linux/badblocks.h>
#include <linux/memremap.h>
+#include <linux/kstrtox.h>
#include <linux/vmalloc.h>
#include <linux/blk-mq.h>
#include <linux/pfn_t.h>
@@ -408,7 +409,7 @@ static ssize_t write_cache_store(struct device *dev,
bool write_cache;
int rc;

- rc = strtobool(buf, &write_cache);
+ rc = kstrtobool(buf, &write_cache);
if (rc)
return rc;
dax_write_cache(pmem->dax_dev, write_cache);
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index e0875d369762..76e1ae6f830a 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -5,6 +5,7 @@
#include <linux/scatterlist.h>
#include <linux/memregion.h>
#include <linux/highmem.h>
+#include <linux/kstrtox.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/hash.h>
@@ -229,7 +230,7 @@ static ssize_t deep_flush_store(struct device *dev, struct device_attribute *att
const char *buf, size_t len)
{
bool flush;
- int rc = strtobool(buf, &flush);
+ int rc = kstrtobool(buf, &flush);
struct nd_region *nd_region = to_nd_region(dev);

if (rc)
@@ -484,7 +485,7 @@ static ssize_t read_only_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
bool ro;
- int rc = strtobool(buf, &ro);
+ int rc = kstrtobool(buf, &ro);
struct nd_region *nd_region = to_nd_region(dev);

if (rc)
--
2.34.1


2022-11-01 21:45:51

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 13/30] platform/chrome: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/platform/chrome/cros_ec_lightbar.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index 469dfc7a4a03..58beb2a047b2 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -8,6 +8,7 @@
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/kobject.h>
+#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
@@ -493,7 +494,7 @@ static ssize_t userspace_control_store(struct device *dev,
bool enable;
int ret;

- ret = strtobool(buf, &enable);
+ ret = kstrtobool(buf, &enable);
if (ret < 0)
return ret;

--
2.34.1


2022-11-01 21:46:06

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 25/30] KVM: arm64: vgic-v3: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].


This patch has NOT been compile tested.


[1]: https://lore.kernel.org/all/[email protected]/
---
arch/arm64/kvm/vgic/vgic-v3.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kvm/vgic/vgic-v3.c b/arch/arm64/kvm/vgic/vgic-v3.c
index 826ff6f2a4e7..efb2726efbb3 100644
--- a/arch/arm64/kvm/vgic/vgic-v3.c
+++ b/arch/arm64/kvm/vgic/vgic-v3.c
@@ -3,6 +3,7 @@
#include <linux/irqchip/arm-gic-v3.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
+#include <linux/kstrtox.h>
#include <linux/kvm.h>
#include <linux/kvm_host.h>
#include <kvm/arm_vgic.h>
@@ -587,25 +588,25 @@ DEFINE_STATIC_KEY_FALSE(vgic_v3_cpuif_trap);

static int __init early_group0_trap_cfg(char *buf)
{
- return strtobool(buf, &group0_trap);
+ return kstrtobool(buf, &group0_trap);
}
early_param("kvm-arm.vgic_v3_group0_trap", early_group0_trap_cfg);

static int __init early_group1_trap_cfg(char *buf)
{
- return strtobool(buf, &group1_trap);
+ return kstrtobool(buf, &group1_trap);
}
early_param("kvm-arm.vgic_v3_group1_trap", early_group1_trap_cfg);

static int __init early_common_trap_cfg(char *buf)
{
- return strtobool(buf, &common_trap);
+ return kstrtobool(buf, &common_trap);
}
early_param("kvm-arm.vgic_v3_common_trap", early_common_trap_cfg);

static int __init early_gicv4_enable(char *buf)
{
- return strtobool(buf, &gicv4_enable);
+ return kstrtobool(buf, &gicv4_enable);
}
early_param("kvm-arm.vgic_v4_enable", early_gicv4_enable);

--
2.34.1


2022-11-01 21:46:39

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 15/30] video: fbdev: omapfb: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c | 7 ++++---
drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c | 7 ++++---
drivers/video/fbdev/omap2/omapfb/dss/overlay-sysfs.c | 3 ++-
drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c | 3 ++-
4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c b/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c
index bc5a44c2a144..ae937854403b 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c
@@ -10,6 +10,7 @@
#define DSS_SUBSYS_NAME "DISPLAY"

#include <linux/kernel.h>
+#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/sysfs.h>
@@ -36,7 +37,7 @@ static ssize_t display_enabled_store(struct omap_dss_device *dssdev,
int r;
bool enable;

- r = strtobool(buf, &enable);
+ r = kstrtobool(buf, &enable);
if (r)
return r;

@@ -73,7 +74,7 @@ static ssize_t display_tear_store(struct omap_dss_device *dssdev,
if (!dssdev->driver->enable_te || !dssdev->driver->get_te)
return -ENOENT;

- r = strtobool(buf, &te);
+ r = kstrtobool(buf, &te);
if (r)
return r;

@@ -183,7 +184,7 @@ static ssize_t display_mirror_store(struct omap_dss_device *dssdev,
if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror)
return -ENOENT;

- r = strtobool(buf, &mirror);
+ r = kstrtobool(buf, &mirror);
if (r)
return r;

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c b/drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c
index ba21c4a2633d..1b644be5fe2e 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c
@@ -10,6 +10,7 @@
#define DSS_SUBSYS_NAME "MANAGER"

#include <linux/kernel.h>
+#include <linux/kstrtox.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/platform_device.h>
@@ -246,7 +247,7 @@ static ssize_t manager_trans_key_enabled_store(struct omap_overlay_manager *mgr,
bool enable;
int r;

- r = strtobool(buf, &enable);
+ r = kstrtobool(buf, &enable);
if (r)
return r;

@@ -290,7 +291,7 @@ static ssize_t manager_alpha_blending_enabled_store(
if(!dss_has_feature(FEAT_ALPHA_FIXED_ZORDER))
return -ENODEV;

- r = strtobool(buf, &enable);
+ r = kstrtobool(buf, &enable);
if (r)
return r;

@@ -329,7 +330,7 @@ static ssize_t manager_cpr_enable_store(struct omap_overlay_manager *mgr,
if (!dss_has_feature(FEAT_CPR))
return -ENODEV;

- r = strtobool(buf, &enable);
+ r = kstrtobool(buf, &enable);
if (r)
return r;

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/overlay-sysfs.c b/drivers/video/fbdev/omap2/omapfb/dss/overlay-sysfs.c
index 601c0beb6de9..1da4fb1c77b4 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/overlay-sysfs.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/overlay-sysfs.c
@@ -13,6 +13,7 @@
#include <linux/err.h>
#include <linux/sysfs.h>
#include <linux/kobject.h>
+#include <linux/kstrtox.h>
#include <linux/platform_device.h>

#include <video/omapfb_dss.h>
@@ -210,7 +211,7 @@ static ssize_t overlay_enabled_store(struct omap_overlay *ovl, const char *buf,
int r;
bool enable;

- r = strtobool(buf, &enable);
+ r = kstrtobool(buf, &enable);
if (r)
return r;

diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c b/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c
index 06dc41aa0354..831b2c2fbdf9 100644
--- a/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c
+++ b/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c
@@ -15,6 +15,7 @@
#include <linux/uaccess.h>
#include <linux/platform_device.h>
#include <linux/kernel.h>
+#include <linux/kstrtox.h>
#include <linux/mm.h>
#include <linux/omapfb.h>

@@ -96,7 +97,7 @@ static ssize_t store_mirror(struct device *dev,
int r;
struct fb_var_screeninfo new_var;

- r = strtobool(buf, &mirror);
+ r = kstrtobool(buf, &mirror);
if (r)
return r;

--
2.34.1


2022-11-01 21:48:21

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 28/30] x86/xen: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
arch/x86/xen/enlighten_pv.c | 3 ++-
arch/x86/xen/setup.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 05170fc19083..9e1ac6a281e4 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -23,6 +23,7 @@
#include <linux/start_kernel.h>
#include <linux/sched.h>
#include <linux/kprobes.h>
+#include <linux/kstrtox.h>
#include <linux/memblock.h>
#include <linux/export.h>
#include <linux/mm.h>
@@ -113,7 +114,7 @@ static __read_mostly bool xen_msr_safe = IS_ENABLED(CONFIG_XEN_PV_MSR_SAFE);
static int __init parse_xen_msr_safe(char *str)
{
if (str)
- return strtobool(str, &xen_msr_safe);
+ return kstrtobool(str, &xen_msr_safe);
return -EINVAL;
}
early_param("xen_msr_safe", parse_xen_msr_safe);
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index cfa99e8f054b..0abccdab5bc6 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -7,6 +7,7 @@

#include <linux/init.h>
#include <linux/sched.h>
+#include <linux/kstrtox.h>
#include <linux/mm.h>
#include <linux/pm.h>
#include <linux/memblock.h>
@@ -85,7 +86,7 @@ static void __init xen_parse_512gb(void)
arg = strstr(xen_start_info->cmd_line, "xen_512gb_limit=");
if (!arg)
val = true;
- else if (strtobool(arg + strlen("xen_512gb_limit="), &val))
+ else if (kstrtobool(arg + strlen("xen_512gb_limit="), &val))
return;

xen_512gb_limit = val;
--
2.34.1


2022-11-01 21:49:45

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 19/30] kernel/params.c: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
kernel/params.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/params.c b/kernel/params.c
index a06f80c56f19..96250d3e201b 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -4,6 +4,7 @@

*/
#include <linux/kernel.h>
+#include <linux/kstrtox.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/module.h>
@@ -310,7 +311,7 @@ int param_set_bool(const char *val, const struct kernel_param *kp)
if (!val) val = "1";

/* One of =[yYnN01] */
- return strtobool(val, kp->arg);
+ return kstrtobool(val, kp->arg);
}
EXPORT_SYMBOL(param_set_bool);

--
2.34.1


2022-11-01 21:50:59

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 08/30] 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/usb/gadget/configfs.c | 3 ++-
drivers/usb/gadget/function/f_mass_storage.c | 3 ++-
drivers/usb/gadget/function/storage_common.c | 9 +++++----
drivers/usb/gadget/function/u_serial.c | 3 ++-
drivers/usb/gadget/legacy/serial.c | 3 ++-
5 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 3a6b4926193e..96121d1c8df4 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -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;
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index 3abf7f586e2a..3a30feb47073 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -176,6 +176,7 @@
#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;
diff --git a/drivers/usb/gadget/function/storage_common.c b/drivers/usb/gadget/function/storage_common.c
index 208c6a92780a..2a4163b0f6fe 100644
--- a/drivers/usb/gadget/function/storage_common.c
+++ b/drivers/usb/gadget/function/storage_common.c
@@ -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;

diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index 7538279f9817..840626e064e1 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -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;

diff --git a/drivers/usb/gadget/legacy/serial.c b/drivers/usb/gadget/legacy/serial.c
index dcd3a6603d90..4974bee6049a 100644
--- a/drivers/usb/gadget/legacy/serial.c
+++ b/drivers/usb/gadget/legacy/serial.c
@@ -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;

--
2.34.1


2022-11-01 21:52:38

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 21/30] mm: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
mm/page_table_check.c | 3 ++-
mm/usercopy.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/page_table_check.c b/mm/page_table_check.c
index 433dbce13fe1..93e633c1d587 100644
--- a/mm/page_table_check.c
+++ b/mm/page_table_check.c
@@ -4,6 +4,7 @@
* Copyright (c) 2021, Google LLC.
* Pasha Tatashin <[email protected]>
*/
+#include <linux/kstrtox.h>
#include <linux/mm.h>
#include <linux/page_table_check.h>

@@ -23,7 +24,7 @@ EXPORT_SYMBOL(page_table_check_disabled);

static int __init early_page_table_check_param(char *buf)
{
- return strtobool(buf, &__page_table_check_enabled);
+ return kstrtobool(buf, &__page_table_check_enabled);
}

early_param("page_table_check", early_page_table_check_param);
diff --git a/mm/usercopy.c b/mm/usercopy.c
index c1ee15a98633..4c3164beacec 100644
--- a/mm/usercopy.c
+++ b/mm/usercopy.c
@@ -12,6 +12,7 @@

#include <linux/mm.h>
#include <linux/highmem.h>
+#include <linux/kstrtox.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/sched/task.h>
@@ -258,7 +259,7 @@ static bool enable_checks __initdata = true;

static int __init parse_hardened_usercopy(char *str)
{
- if (strtobool(str, &enable_checks))
+ if (kstrtobool(str, &enable_checks))
pr_warn("Invalid option string for hardened_usercopy: '%s'\n",
str);
return 1;
--
2.34.1


2022-11-01 22:17:10

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 26/30] s390/ipl: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].


This patch has NOT been compile tested.


[1]: https://lore.kernel.org/all/[email protected]/
---
arch/s390/kernel/ipl.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 325cbf69ebbd..cdd575d7a91a 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -12,6 +12,7 @@
#include <linux/init.h>
#include <linux/device.h>
#include <linux/delay.h>
+#include <linux/kstrtox.h>
#include <linux/panic_notifier.h>
#include <linux/reboot.h>
#include <linux/ctype.h>
@@ -779,7 +780,7 @@ static ssize_t reipl_fcp_clear_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t len)
{
- if (strtobool(buf, &reipl_fcp_clear) < 0)
+ if (kstrtobool(buf, &reipl_fcp_clear) < 0)
return -EINVAL;
return len;
}
@@ -899,7 +900,7 @@ static ssize_t reipl_nvme_clear_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t len)
{
- if (strtobool(buf, &reipl_nvme_clear) < 0)
+ if (kstrtobool(buf, &reipl_nvme_clear) < 0)
return -EINVAL;
return len;
}
@@ -952,7 +953,7 @@ static ssize_t reipl_ccw_clear_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t len)
{
- if (strtobool(buf, &reipl_ccw_clear) < 0)
+ if (kstrtobool(buf, &reipl_ccw_clear) < 0)
return -EINVAL;
return len;
}
--
2.34.1


2022-11-01 22:24:15

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 14/30] powercap: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/powercap/powercap_sys.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
index f0654a932b37..1f968353d479 100644
--- a/drivers/powercap/powercap_sys.c
+++ b/drivers/powercap/powercap_sys.c
@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/device.h>
#include <linux/err.h>
+#include <linux/kstrtox.h>
#include <linux/slab.h>
#include <linux/powercap.h>

@@ -446,7 +447,7 @@ static ssize_t enabled_store(struct device *dev,
{
bool mode;

- if (strtobool(buf, &mode))
+ if (kstrtobool(buf, &mode))
return -EINVAL;
if (dev->parent) {
struct powercap_zone *power_zone = to_powercap_zone(dev);
--
2.34.1


2022-11-01 22:25:27

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 16/30] cifs: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
fs/cifs/cifs_debug.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 90850da390ae..4f1b3a65e74c 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -8,6 +8,7 @@
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/ctype.h>
+#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/uaccess.h>
@@ -779,7 +780,7 @@ static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,
rc = get_user(c[0], buffer);
if (rc)
return rc;
- if (strtobool(c, &bv) == 0)
+ if (kstrtobool(c, &bv) == 0)
cifsFYI = bv;
else if ((c[0] > '1') && (c[0] <= '9'))
cifsFYI = (int) (c[0] - '0'); /* see cifs_debug.h for meanings */
@@ -939,7 +940,7 @@ static ssize_t cifs_security_flags_proc_write(struct file *file,

if (count < 3) {
/* single char or single char followed by null */
- if (strtobool(flags_string, &bv) == 0) {
+ if (kstrtobool(flags_string, &bv) == 0) {
global_secflags = bv ? CIFSSEC_MAX : CIFSSEC_DEF;
return count;
} else if (!isdigit(flags_string[0])) {
--
2.34.1


2022-11-01 22:26:05

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 07/30] 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/usb/core/port.c | 3 ++-
drivers/usb/core/sysfs.c | 7 ++++---
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 38c1a4f4fdea..015204fc67a1 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -7,6 +7,7 @@
* Author: Lan Tianyu <[email protected]>
*/

+#include <linux/kstrtox.h>
#include <linux/slab.h>
#include <linux/pm_qos.h>
#include <linux/component.h>
@@ -63,7 +64,7 @@ static ssize_t disable_store(struct device *dev, struct device_attribute *attr,
bool disabled;
int rc;

- rc = strtobool(buf, &disabled);
+ rc = kstrtobool(buf, &disabled);
if (rc)
return rc;

diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 631574718d8a..8217032dfb85 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -13,6 +13,7 @@


#include <linux/kernel.h>
+#include <linux/kstrtox.h>
#include <linux/string.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
@@ -505,7 +506,7 @@ static ssize_t usb2_hardware_lpm_store(struct device *dev,
if (ret < 0)
return -EINTR;

- ret = strtobool(buf, &value);
+ ret = kstrtobool(buf, &value);

if (!ret) {
udev->usb2_hw_lpm_allowed = value;
@@ -975,7 +976,7 @@ static ssize_t interface_authorized_default_store(struct device *dev,
int rc = count;
bool val;

- if (strtobool(buf, &val) != 0)
+ if (kstrtobool(buf, &val) != 0)
return -EINVAL;

if (val)
@@ -1176,7 +1177,7 @@ static ssize_t interface_authorized_store(struct device *dev,
struct usb_interface *intf = to_usb_interface(dev);
bool val;

- if (strtobool(buf, &val) != 0)
+ if (kstrtobool(buf, &val) != 0)
return -EINVAL;

if (val)
--
2.34.1


2022-11-01 22:41:55

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 18/30] module: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
kernel/module/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/module/main.c b/kernel/module/main.c
index ff2dfd1f548d..79e17522e196 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -17,6 +17,7 @@
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/kernel_read_file.h>
+#include <linux/kstrtox.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/elf.h>
@@ -2649,7 +2650,7 @@ static int unknown_module_param_cb(char *param, char *val, const char *modname,
int ret;

if (strcmp(param, "async_probe") == 0) {
- if (strtobool(val, &mod->async_probe_requested))
+ if (kstrtobool(val, &mod->async_probe_requested))
mod->async_probe_requested = true;
return 0;
}
--
2.34.1


2022-11-01 22:43:44

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 20/30] mm/damon: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
mm/damon/lru_sort.c | 3 ++-
mm/damon/reclaim.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index 2a532e3983df..7b8fce2f67a8 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -8,6 +8,7 @@
#define pr_fmt(fmt) "damon-lru-sort: " fmt

#include <linux/damon.h>
+#include <linux/kstrtox.h>
#include <linux/module.h>

#include "modules-common.h"
@@ -241,7 +242,7 @@ static int damon_lru_sort_enabled_store(const char *val,
bool enable;
int err;

- err = strtobool(val, &enable);
+ err = kstrtobool(val, &enable);
if (err)
return err;

diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c
index e57604bec06d..e82631f39481 100644
--- a/mm/damon/reclaim.c
+++ b/mm/damon/reclaim.c
@@ -8,6 +8,7 @@
#define pr_fmt(fmt) "damon-reclaim: " fmt

#include <linux/damon.h>
+#include <linux/kstrtox.h>
#include <linux/module.h>

#include "modules-common.h"
@@ -187,7 +188,7 @@ static int damon_reclaim_enabled_store(const char *val,
bool enable;
int err;

- err = strtobool(val, &enable);
+ err = kstrtobool(val, &enable);
if (err)
return err;

--
2.34.1


2022-11-01 22:45:31

by SeongJae Park

[permalink] [raw]
Subject: Re: [PATCH 20/30] mm/damon: Use kstrtobool() instead of strtobool()

On Tue, 1 Nov 2022 22:14:08 +0100 Christophe JAILLET <[email protected]> wrote:

> 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 <[email protected]>

Reviewed-by: SeongJae Park <[email protected]>


Thanks,
SJ

[...]

2022-11-01 22:56:02

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 27/30] KVM: x86/mmu: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
arch/x86/kvm/mmu/mmu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 6f81539061d6..aa45abce7586 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -42,6 +42,7 @@
#include <linux/uaccess.h>
#include <linux/hash.h>
#include <linux/kern_levels.h>
+#include <linux/kstrtox.h>
#include <linux/kthread.h>

#include <asm/page.h>
@@ -6641,7 +6642,7 @@ static int set_nx_huge_pages(const char *val, const struct kernel_param *kp)
new_val = 1;
else if (sysfs_streq(val, "auto"))
new_val = get_nx_auto_mode();
- else if (strtobool(val, &new_val) < 0)
+ else if (kstrtobool(val, &new_val) < 0)
return -EINVAL;

__set_nx_huge_pages(new_val);
--
2.34.1


2022-11-01 22:58:29

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 06/30] nvme: 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/nvme/host/pci.c | 3 ++-
drivers/nvme/target/configfs.c | 17 +++++++++--------
2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 5f1d71ac0086..7c83dfd1bca6 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -15,6 +15,7 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
+#include <linux/kstrtox.h>
#include <linux/memremap.h>
#include <linux/mm.h>
#include <linux/module.h>
@@ -2186,7 +2187,7 @@ static ssize_t hmb_store(struct device *dev, struct device_attribute *attr,
bool new;
int ret;

- if (strtobool(buf, &new) < 0)
+ if (kstrtobool(buf, &new) < 0)
return -EINVAL;

if (new == ndev->hmb)
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index 9443ee1d4ae3..3eb8bdd4d464 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -4,6 +4,7 @@
* Copyright (c) 2015-2016 HGST, a Western Digital Company.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/kstrtox.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
@@ -267,7 +268,7 @@ static ssize_t nvmet_param_pi_enable_store(struct config_item *item,
struct nvmet_port *port = to_nvmet_port(item);
bool val;

- if (strtobool(page, &val))
+ if (kstrtobool(page, &val))
return -EINVAL;

if (nvmet_is_port_enabled(port, __func__))
@@ -532,7 +533,7 @@ static ssize_t nvmet_ns_enable_store(struct config_item *item,
bool enable;
int ret = 0;

- if (strtobool(page, &enable))
+ if (kstrtobool(page, &enable))
return -EINVAL;

if (enable)
@@ -556,7 +557,7 @@ static ssize_t nvmet_ns_buffered_io_store(struct config_item *item,
struct nvmet_ns *ns = to_nvmet_ns(item);
bool val;

- if (strtobool(page, &val))
+ if (kstrtobool(page, &val))
return -EINVAL;

mutex_lock(&ns->subsys->lock);
@@ -579,7 +580,7 @@ static ssize_t nvmet_ns_revalidate_size_store(struct config_item *item,
struct nvmet_ns *ns = to_nvmet_ns(item);
bool val;

- if (strtobool(page, &val))
+ if (kstrtobool(page, &val))
return -EINVAL;

if (!val)
@@ -728,7 +729,7 @@ static ssize_t nvmet_passthru_enable_store(struct config_item *item,
bool enable;
int ret = 0;

- if (strtobool(page, &enable))
+ if (kstrtobool(page, &enable))
return -EINVAL;

if (enable)
@@ -995,7 +996,7 @@ static ssize_t nvmet_subsys_attr_allow_any_host_store(struct config_item *item,
bool allow_any_host;
int ret = 0;

- if (strtobool(page, &allow_any_host))
+ if (kstrtobool(page, &allow_any_host))
return -EINVAL;

down_write(&nvmet_config_sem);
@@ -1272,7 +1273,7 @@ static ssize_t nvmet_subsys_attr_pi_enable_store(struct config_item *item,
struct nvmet_subsys *subsys = to_subsys(item);
bool pi_enable;

- if (strtobool(page, &pi_enable))
+ if (kstrtobool(page, &pi_enable))
return -EINVAL;

subsys->pi_support = pi_enable;
@@ -1392,7 +1393,7 @@ static ssize_t nvmet_referral_enable_store(struct config_item *item,
struct nvmet_port *port = to_nvmet_port(item);
bool enable;

- if (strtobool(page, &enable))
+ if (kstrtobool(page, &enable))
goto inval;

if (enable)
--
2.34.1


2022-11-01 22:58:45

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 29/30] driver 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 <[email protected]>
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is available
at [1].

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/base/core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index d02501933467..5f6b80329cf1 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -14,6 +14,7 @@
#include <linux/err.h>
#include <linux/fwnode.h>
#include <linux/init.h>
+#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
@@ -1628,7 +1629,7 @@ early_param("fw_devlink", fw_devlink_setup);
static bool fw_devlink_strict;
static int __init fw_devlink_strict_setup(char *arg)
{
- return strtobool(arg, &fw_devlink_strict);
+ return kstrtobool(arg, &fw_devlink_strict);
}
early_param("fw_devlink.strict", fw_devlink_strict_setup);

@@ -2280,7 +2281,7 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
{
struct dev_ext_attribute *ea = to_ext_attr(attr);

- if (strtobool(buf, ea->var) < 0)
+ if (kstrtobool(buf, ea->var) < 0)
return -EINVAL;

return size;
@@ -2534,7 +2535,7 @@ static ssize_t online_store(struct device *dev, struct device_attribute *attr,
bool val;
int ret;

- ret = strtobool(buf, &val);
+ ret = kstrtobool(buf, &val);
if (ret < 0)
return ret;

--
2.34.1


2022-11-01 23:34:08

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH 21/30] mm: Use kstrtobool() instead of strtobool()

On Tue, Nov 01, 2022 at 10:14:09PM +0100, Christophe JAILLET wrote:
> 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 <[email protected]>
> ---
> This patch is part of a serie that axes all usages of strtobool().
> Each patch can be applied independently from the other ones.
>
> The last patch of the serie removes the definition of strtobool().
>
> You may not be in copy of the cover letter. So, if needed, it is available
> at [1].
>
> [1]: https://lore.kernel.org/all/[email protected]/

This seems in keeping with the removal of the simple_*str*() helpers:
https://docs.kernel.org/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull

Reviewed-by: Kees Cook <[email protected]>

--
Kees Cook

2022-11-01 23:41:31

by Boris Ostrovsky

[permalink] [raw]
Subject: Re: [PATCH 28/30] x86/xen: Use kstrtobool() instead of strtobool()


On 11/1/22 5:14 PM, Christophe JAILLET wrote:
> 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 <[email protected]>
> ---
> This patch is part of a serie that axes all usages of strtobool().
> Each patch can be applied independently from the other ones.
>
> The last patch of the serie removes the definition of strtobool().
>
> You may not be in copy of the cover letter. So, if needed, it is available
> at [1].
>
> [1]: https://lore.kernel.org/all/[email protected]/


Reviewed-by: Boris Ostrovsky <[email protected]>



2022-11-02 04:16:39

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH 01/30] net: usb: Use kstrtobool() instead of strtobool()

On Tue, 1 Nov 2022 22:13:49 +0100 Christophe JAILLET wrote:
> This patch is part of a serie that axes all usages of strtobool().
> Each patch can be applied independently from the other ones.
>
> The last patch of the serie removes the definition of strtobool().
>
> You may not be in copy of the cover letter. So, if needed, it is available
> at [1].
>
> [1]: https://lore.kernel.org/all/[email protected]/

Please repost this patch separately. Patch bots and CIs will not test
partially received series.

Subject: Re: [PATCH 13/30] platform/chrome: Use kstrtobool() instead of strtobool()

Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <[email protected]>:

On Tue, 1 Nov 2022 22:14:01 +0100 you wrote:
> 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>)
>
> [...]

Here is the summary with links:
- [13/30] platform/chrome: Use kstrtobool() instead of strtobool()
https://git.kernel.org/chrome-platform/c/58f23a6795a6

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



2022-11-02 06:11:42

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH 06/30] nvme: Use kstrtobool() instead of strtobool()

On 11/1/22 14:13, Christophe JAILLET wrote:
> 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 <[email protected]>
> ---
> This patch is part of a serie that axes all usages of strtobool().
> Each patch can be applied independently from the other ones.
>
> The last patch of the serie removes the definition of strtobool().
>
> You may not be in copy of the cover letter. So, if needed, it is available
> at [1].
>
> [1]: https://lore.kernel.org/all/[email protected]/
> ---

I believe you have tested this patch thoroughly, with that,

Reviewed-by: Chaitanya Kulkarni <[email protected]>

-ck

2022-11-02 07:06:41

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 06/30] nvme: Use kstrtobool() instead of strtobool()

What are th other 29 patches doing in this series? Due to the lack of
context individual patches from series have to through /dev/null here,
sorry.

2022-11-02 07:12:17

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 06/30] nvme: Use kstrtobool() instead of strtobool()

On Wed, Nov 02, 2022 at 07:57:23AM +0100, Christophe JAILLET wrote:
> What is the best strategy for sending such patches?

Just send them per subsystems as mini series or individual patches.

2022-11-02 07:49:29

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH 06/30] nvme: Use kstrtobool() instead of strtobool()



On Wed, 2 Nov 2022, Christophe JAILLET wrote:

> Le 02/11/2022 à 07:47, Christoph Hellwig a écrit :
> > What are th other 29 patches doing in this series? Due to the lack of
> > context individual patches from series have to through /dev/null here,
> > sorry.
> >
>
> Hi,
>
> in each patch, in order to give some context, I wrote:
> ---
> This patch is part of a serie that axes all usages of strtobool().
> Each patch can be applied independently from the other ones.
>
> The last patch of the serie removes the definition of strtobool().
>
> You may not be in copy of the cover letter. So, if needed, it is
> available at [1].
>
> [1]:
> https://lore.kernel.org/all/[email protected]/
>
>
> What is the best strategy for sending such patches?

I send the cover letter to everyone. The problem with sending individual
unconnected patches is that people who are looking at the patches on
generic mailing lists can't easily see that they should just skip over all
of them at once. But it is hard to please everyone for this issue...

julia

>
> Should I send only individual patches?
> Should everybody be in copy of all patches? Or at least of the cover letter?
>
>
> Some patches have already been Acked or even applied. So I'll wait a bit so
> that things stabilize before resending what is remaining.
>
> CJ
>

2022-11-02 08:09:01

by Christophe JAILLET

[permalink] [raw]
Subject: Re: [PATCH 06/30] nvme: Use kstrtobool() instead of strtobool()

Le 02/11/2022 à 07:47, Christoph Hellwig a écrit :
> What are th other 29 patches doing in this series? Due to the lack of
> context individual patches from series have to through /dev/null here,
> sorry.
>

Hi,

in each patch, in order to give some context, I wrote:
---
This patch is part of a serie that axes all usages of strtobool().
Each patch can be applied independently from the other ones.

The last patch of the serie removes the definition of strtobool().

You may not be in copy of the cover letter. So, if needed, it is
available at [1].

[1]:
https://lore.kernel.org/all/[email protected]/


What is the best strategy for sending such patches?

Should I send only individual patches?
Should everybody be in copy of all patches? Or at least of the cover letter?


Some patches have already been Acked or even applied. So I'll wait a bit
so that things stabilize before resending what is remaining.

CJ

2022-11-02 11:33:10

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 00/30] Remove strtobool()

On Tue, Nov 01, 2022 at 10:05:37PM +0100, Christophe JAILLET wrote:
> 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>)
>
>
> Each patch can be applied independently from the other ones.
> The last patch of the serie removes the definition of strtobool().
>
> All patches have been compile tested, except the ones against
> arm64, s390 and irq-gic.

I got only a cover letter...
Luckily we have a powerful `b4` tool and available archives on lore.kernel.org :-)

> Finally, this gives the opportunity to remove some <linux/kernel.h> from
> a few drivers. This will be addressed later when/if the serie is applied.

--
With Best Regards,
Andy Shevchenko



2022-11-02 11:54:52

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 21/30] mm: Use kstrtobool() instead of strtobool()

On Tue, Nov 01, 2022 at 03:47:20PM -0700, Kees Cook wrote:
> On Tue, Nov 01, 2022 at 10:14:09PM +0100, Christophe JAILLET wrote:

...

> This seems in keeping with the removal of the simple_*str*() helpers:
> https://docs.kernel.org/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull

That piece of the documentation is partially wrong. Nobody will going to remove
simple_strtox() due to their convenience when it's related to parse something
from the stream. Yes, overflow is possible, but here is a trade-off.

Note, kstrtox() may not work at early boot stages when we need to parse stream
(with mixed digits and text and symbols) without acquiring space from the heap,
i.o.w. RO strings.

--
With Best Regards,
Andy Shevchenko



Subject: Re: [PATCH 13/30] platform/chrome: Use kstrtobool() instead of strtobool()

Hello:

This patch was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <[email protected]>:

On Tue, 1 Nov 2022 22:14:01 +0100 you wrote:
> 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>)
>
> [...]

Here is the summary with links:
- [13/30] platform/chrome: Use kstrtobool() instead of strtobool()
https://git.kernel.org/chrome-platform/c/58f23a6795a6

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



2022-11-02 19:13:26

by Luis Chamberlain

[permalink] [raw]
Subject: Re: [PATCH 18/30] module: Use kstrtobool() instead of strtobool()

On Tue, Nov 01, 2022 at 10:14:06PM +0100, Christophe JAILLET wrote:
> 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 <[email protected]>

Reviewed-by: Luis Chamberlain <[email protected]>

Luis

2022-11-03 18:51:01

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH 14/30] powercap: Use kstrtobool() instead of strtobool()

On Tue, Nov 1, 2022 at 10:15 PM Christophe JAILLET
<[email protected]> wrote:
>
> 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 <[email protected]>
> ---
> This patch is part of a serie that axes all usages of strtobool().
> Each patch can be applied independently from the other ones.
>
> The last patch of the serie removes the definition of strtobool().
>
> You may not be in copy of the cover letter. So, if needed, it is available
> at [1].
>
> [1]: https://lore.kernel.org/all/[email protected]/
> ---
> drivers/powercap/powercap_sys.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
> index f0654a932b37..1f968353d479 100644
> --- a/drivers/powercap/powercap_sys.c
> +++ b/drivers/powercap/powercap_sys.c
> @@ -7,6 +7,7 @@
> #include <linux/module.h>
> #include <linux/device.h>
> #include <linux/err.h>
> +#include <linux/kstrtox.h>
> #include <linux/slab.h>
> #include <linux/powercap.h>
>
> @@ -446,7 +447,7 @@ static ssize_t enabled_store(struct device *dev,
> {
> bool mode;
>
> - if (strtobool(buf, &mode))
> + if (kstrtobool(buf, &mode))
> return -EINVAL;
> if (dev->parent) {
> struct powercap_zone *power_zone = to_powercap_zone(dev);
> --

Applied as 6.2 material, thanks!

2022-11-03 21:11:08

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 12/30] input: Use kstrtobool() instead of strtobool()

On Tue, Nov 01, 2022 at 10:14:00PM +0100, Christophe JAILLET wrote:
> 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 <[email protected]>

Acked-by: Dmitry Torokhov <[email protected]>

Please feel free to merge with the rest of the series. Or let me know if
you want me to pick just this one through my tree.

Thanks.

--
Dmitry

2022-11-03 22:28:39

by Christophe JAILLET

[permalink] [raw]
Subject: Re: [PATCH 12/30] input: Use kstrtobool() instead of strtobool()

Le 03/11/2022 à 21:46, Dmitry Torokhov a écrit :
> On Tue, Nov 01, 2022 at 10:14:00PM +0100, Christophe JAILLET wrote:
>> 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 <[email protected]>
>
> Acked-by: Dmitry Torokhov <[email protected]>
>
> Please feel free to merge with the rest of the series. Or let me know if
> you want me to pick just this one through my tree.
>
> Thanks.
>

Hi,

the patch can go through your tree.
There is no plan to merge the whole serie at once, and some other
maintainers have asked for some patches to be re-sent as individual patches.

CJ

2022-11-05 04:20:02

by Pasha Tatashin

[permalink] [raw]
Subject: Re: [PATCH 21/30] mm: Use kstrtobool() instead of strtobool()

On Tue, Nov 1, 2022 at 5:15 PM Christophe JAILLET
<[email protected]> wrote:
>
> 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 <[email protected]>
> ---
> This patch is part of a serie that axes all usages of strtobool().
> Each patch can be applied independently from the other ones.
>
> The last patch of the serie removes the definition of strtobool().
>
> You may not be in copy of the cover letter. So, if needed, it is available
> at [1].
>
> [1]: https://lore.kernel.org/all/[email protected]/
> ---
> mm/page_table_check.c | 3 ++-
> mm/usercopy.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/page_table_check.c b/mm/page_table_check.c
> index 433dbce13fe1..93e633c1d587 100644
> --- a/mm/page_table_check.c
> +++ b/mm/page_table_check.c
> @@ -4,6 +4,7 @@
> * Copyright (c) 2021, Google LLC.
> * Pasha Tatashin <[email protected]>
> */
> +#include <linux/kstrtox.h>
> #include <linux/mm.h>
> #include <linux/page_table_check.h>
>
> @@ -23,7 +24,7 @@ EXPORT_SYMBOL(page_table_check_disabled);
>
> static int __init early_page_table_check_param(char *buf)
> {
> - return strtobool(buf, &__page_table_check_enabled);
> + return kstrtobool(buf, &__page_table_check_enabled);
> }

Acked-by: Pasha Tatashin <[email protected]>

>
> early_param("page_table_check", early_page_table_check_param);
> diff --git a/mm/usercopy.c b/mm/usercopy.c
> index c1ee15a98633..4c3164beacec 100644
> --- a/mm/usercopy.c
> +++ b/mm/usercopy.c
> @@ -12,6 +12,7 @@
>
> #include <linux/mm.h>
> #include <linux/highmem.h>
> +#include <linux/kstrtox.h>
> #include <linux/slab.h>
> #include <linux/sched.h>
> #include <linux/sched/task.h>
> @@ -258,7 +259,7 @@ static bool enable_checks __initdata = true;
>
> static int __init parse_hardened_usercopy(char *str)
> {
> - if (strtobool(str, &enable_checks))
> + if (kstrtobool(str, &enable_checks))
> pr_warn("Invalid option string for hardened_usercopy: '%s'\n",
> str);
> return 1;
> --
> 2.34.1
>

2022-11-06 15:25:13

by Aaron Tomlin

[permalink] [raw]
Subject: Re: [PATCH 18/30] module: Use kstrtobool() instead of strtobool()

On Tue 2022-11-01 22:14 +0100, Christophe JAILLET wrote:
> 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 <[email protected]>
> ---
> This patch is part of a serie that axes all usages of strtobool().
> Each patch can be applied independently from the other ones.
>
> The last patch of the serie removes the definition of strtobool().
>
> You may not be in copy of the cover letter. So, if needed, it is available
> at [1].
>
> [1]: https://lore.kernel.org/all/[email protected]/
> ---
> kernel/module/main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/module/main.c b/kernel/module/main.c
> index ff2dfd1f548d..79e17522e196 100644
> --- a/kernel/module/main.c
> +++ b/kernel/module/main.c
> @@ -17,6 +17,7 @@
> #include <linux/fs.h>
> #include <linux/kernel.h>
> #include <linux/kernel_read_file.h>
> +#include <linux/kstrtox.h>
> #include <linux/slab.h>
> #include <linux/vmalloc.h>
> #include <linux/elf.h>
> @@ -2649,7 +2650,7 @@ static int unknown_module_param_cb(char *param, char *val, const char *modname,
> int ret;
>
> if (strcmp(param, "async_probe") == 0) {
> - if (strtobool(val, &mod->async_probe_requested))
> + if (kstrtobool(val, &mod->async_probe_requested))
> mod->async_probe_requested = true;
> return 0;
> }
> --
> 2.34.1
>

Reviewed-by: Aaron Tomlin <[email protected]>

--
Aaron Tomlin


2022-11-07 21:06:18

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 12/30] input: Use kstrtobool() instead of strtobool()

On Thu, Nov 03, 2022 at 10:37:19PM +0100, Christophe JAILLET wrote:
> Le 03/11/2022 ? 21:46, Dmitry Torokhov a ?crit?:
> > On Tue, Nov 01, 2022 at 10:14:00PM +0100, Christophe JAILLET wrote:
> > > 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 <[email protected]>
> >
> > Acked-by: Dmitry Torokhov <[email protected]>
> >
> > Please feel free to merge with the rest of the series. Or let me know if
> > you want me to pick just this one through my tree.
> >
> > Thanks.
> >
>
> Hi,
>
> the patch can go through your tree.
> There is no plan to merge the whole serie at once, and some other
> maintainers have asked for some patches to be re-sent as individual patches.

OK, applied, thank you.

--
Dmitry

2022-11-08 15:09:10

by Alexander Gordeev

[permalink] [raw]
Subject: Re: [PATCH 26/30] s390/ipl: Use kstrtobool() instead of strtobool()

On Tue, Nov 01, 2022 at 10:14:14PM +0100, Christophe JAILLET wrote:
> 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 <[email protected]>

Applied, thanks!

2022-11-26 13:14:54

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH 03/30] irqchip: Use kstrtobool() instead of strtobool()

On Tue, 01 Nov 2022 21:13:51 +0000,
Christophe JAILLET <[email protected]> wrote:
>
> 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 <[email protected]>
> ---
> This patch is part of a serie that axes all usages of strtobool().
> Each patch can be applied independently from the other ones.
>
> The last patch of the serie removes the definition of strtobool().
>
> You may not be in copy of the cover letter. So, if needed, it is available
> at [1].
>
>
> This patch has NOT been compile tested.

Thanks for having the honesty to state that this hasn't been even
compile tested. However, and for fairly obvious reason, I will not
take such patches.

Thanks,

M.

--
Without deviation from the norm, progress is not possible.

2022-11-26 15:46:09

by Christophe JAILLET

[permalink] [raw]
Subject: Re: [PATCH 03/30] irqchip: Use kstrtobool() instead of strtobool()

Le 26/11/2022 à 13:46, Marc Zyngier a écrit :
> On Tue, 01 Nov 2022 21:13:51 +0000,
> Christophe JAILLET <[email protected]> wrote:
>>
>> 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 <[email protected]>
>> ---
>> This patch is part of a serie that axes all usages of strtobool().
>> Each patch can be applied independently from the other ones.
>>
>> The last patch of the serie removes the definition of strtobool().
>>
>> You may not be in copy of the cover letter. So, if needed, it is available
>> at [1].
>>
>>
>> This patch has NOT been compile tested.
>
> Thanks for having the honesty to state that this hasn't been even
> compile tested. However, and for fairly obvious reason, I will not
> take such patches.

Ok, so, with a sucessful:
sudo apt install libc6-armel-cross libc6-dev-armel-cross
binutils-arm-linux-gnueabi libncurses5-dev build-essential bison flex
libssl-dev bc
sudo apt install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -j7 allmodconfig

patch -p1 < strtobool.diff

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -j7
./drivers/irqchip/irq-gic.o
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -j7
./drivers/irqchip/irq-gic-v3.o

can I make you change your mind?

CJ

>
> Thanks,
>
> M.
>

2023-01-14 14:04:59

by Christophe JAILLET

[permalink] [raw]
Subject: Re: [PATCH 18/30] module: Use kstrtobool() instead of strtobool()

Le 02/11/2022 à 19:41, Luis Chamberlain a écrit :
> On Tue, Nov 01, 2022 at 10:14:06PM +0100, Christophe JAILLET wrote:
>> 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 <[email protected]>
>
> Reviewed-by: Luis Chamberlain <[email protected]>
>
> Luis
>

Hi,

This has been R-b 2 months ago by 2 persons, and I've just resent
patches in this serie that have neither been merged in -next, nor A-b or
R-b.

So for this one, it is just a polite reminder. ????

Do you have visibility on when it should be merged?

CJ

2023-01-17 16:20:46

by Luis Chamberlain

[permalink] [raw]
Subject: Re: [PATCH 18/30] module: Use kstrtobool() instead of strtobool()

On Tue, Nov 01, 2022 at 10:14:06PM +0100, Christophe JAILLET wrote:
> 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 <[email protected]>
> ---
> This patch is part of a serie that axes all usages of strtobool().
> Each patch can be applied independently from the other ones.
>
> The last patch of the serie removes the definition of strtobool().
>
> You may not be in copy of the cover letter. So, if needed, it is available
> at [1].
>
> [1]: https://lore.kernel.org/all/[email protected]/
> ---

Queued up to modules-next.

Luis

2023-01-20 18:59:32

by Catalin Marinas

[permalink] [raw]
Subject: Re: (subset) [PATCH 00/30] Remove strtobool()

On Tue, 01 Nov 2022 22:05:37 +0100, Christophe JAILLET wrote:
> 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>)
>
> [...]

Applied to arm64 (for-next/misc), thanks!

[24/30] arm64: cpufeature: Use kstrtobool() instead of strtobool()
https://git.kernel.org/arm64/c/1a920c92cd0c

--
Catalin