[03/30] irqchip: Use kstrtobool() instead of strtobool()

Message ID 755c4083122071bb27aa8ed5d98156a07bb63a39.1667336095.git.christophe.jaillet@wanadoo.fr
State New
Headers
Series Remove strtobool() |

Commit Message

Christophe JAILLET Nov. 1, 2022, 9:13 p.m. UTC
  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>
---
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/cover.1667336095.git.christophe.jaillet@wanadoo.fr/
---
 drivers/irqchip/irq-gic-v3.c | 3 ++-
 drivers/irqchip/irq-gic.c    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
  

Comments

Marc Zyngier Nov. 26, 2022, 12:46 p.m. UTC | #1
On Tue, 01 Nov 2022 21:13:51 +0000,
Christophe JAILLET <christophe.jaillet@wanadoo.fr> 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 <christophe.jaillet@wanadoo.fr>
> ---
> 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.
  
Christophe JAILLET Nov. 26, 2022, 3:16 p.m. UTC | #2
Le 26/11/2022 à 13:46, Marc Zyngier a écrit :
> On Tue, 01 Nov 2022 21:13:51 +0000,
> Christophe JAILLET <christophe.jaillet@wanadoo.fr> 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 <christophe.jaillet@wanadoo.fr>
>> ---
>> 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.
>
  

Patch

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);