linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] nvdimm: Use kstrtobool() instead of strtobool()
@ 2023-01-14  8:50 Christophe JAILLET
  2023-01-25 18:40 ` Verma, Vishal L
  2023-01-25 19:11 ` Dan Williams
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2023-01-14  8:50 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, nvdimm

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 was already sent as a part of a serie ([1]) that axed all usages
of strtobool().
Most of the patches have been merged in -next.

I synch'ed with latest -next and re-send the remaining ones as individual
patches.

Changes in v2:
  - synch with latest -next.

[1]: https://lore.kernel.org/all/cover.1667336095.git.christophe.jaillet@wanadoo.fr/
---
 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 80ded5a2838a..f2a336c6d8c6 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 83dbf398ea84..f5872de7ea5a 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>
@@ -275,7 +276,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)
@@ -530,7 +531,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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] nvdimm: Use kstrtobool() instead of strtobool()
  2023-01-14  8:50 [PATCH v2] nvdimm: Use kstrtobool() instead of strtobool() Christophe JAILLET
@ 2023-01-25 18:40 ` Verma, Vishal L
  2023-01-25 19:11 ` Dan Williams
  1 sibling, 0 replies; 4+ messages in thread
From: Verma, Vishal L @ 2023-01-25 18:40 UTC (permalink / raw)
  To: Williams, Dan J, Jiang, Dave, christophe.jaillet, Weiny, Ira
  Cc: kernel-janitors, linux-kernel, nvdimm

On Sat, 2023-01-14 at 09:50 +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 <christophe.jaillet@wanadoo.fr>
> ---
> This patch was already sent as a part of a serie ([1]) that axed all usages
> of strtobool().
> Most of the patches have been merged in -next.
> 
> I synch'ed with latest -next and re-send the remaining ones as individual
> patches.
> 
> Changes in v2:
>   - synch with latest -next.
> 
> [1]: https://lore.kernel.org/all/cover.1667336095.git.christophe.jaillet@wanadoo.fr/
> ---
>  drivers/nvdimm/namespace_devs.c | 3 ++-
>  drivers/nvdimm/pmem.c           | 3 ++-
>  drivers/nvdimm/region_devs.c    | 5 +++--
>  3 files changed, 7 insertions(+), 4 deletions(-)

This looks reasonable,

Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

> 
> 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 80ded5a2838a..f2a336c6d8c6 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 83dbf398ea84..f5872de7ea5a 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>
> @@ -275,7 +276,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)
> @@ -530,7 +531,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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v2] nvdimm: Use kstrtobool() instead of strtobool()
  2023-01-14  8:50 [PATCH v2] nvdimm: Use kstrtobool() instead of strtobool() Christophe JAILLET
  2023-01-25 18:40 ` Verma, Vishal L
@ 2023-01-25 19:11 ` Dan Williams
  2023-05-04 20:29   ` Christophe JAILLET
  1 sibling, 1 reply; 4+ messages in thread
From: Dan Williams @ 2023-01-25 19:11 UTC (permalink / raw)
  To: Christophe JAILLET, Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, nvdimm

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 <christophe.jaillet@wanadoo.fr>
> ---
> This patch was already sent as a part of a serie ([1]) that axed all usages
> of strtobool().
> Most of the patches have been merged in -next.
> 
> I synch'ed with latest -next and re-send the remaining ones as individual
> patches.
> 
> Changes in v2:
>   - synch with latest -next.

Looks good, applied for v6.3.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RE: [PATCH v2] nvdimm: Use kstrtobool() instead of strtobool()
  2023-01-25 19:11 ` Dan Williams
@ 2023-05-04 20:29   ` Christophe JAILLET
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2023-05-04 20:29 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny
  Cc: linux-kernel, kernel-janitors, nvdimm

Le 25/01/2023 à 20:11, Dan Williams a écrit :
> 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 <christophe.jaillet@wanadoo.fr>
>> ---
>> This patch was already sent as a part of a serie ([1]) that axed all usages
>> of strtobool().
>> Most of the patches have been merged in -next.
>>
>> I synch'ed with latest -next and re-send the remaining ones as individual
>> patches.
>>
>> Changes in v2:
>>    - synch with latest -next.
> 
> Looks good, applied for v6.3.
> 

Hi,

polite reminder.

If I'm right, only 2 places still use strtobool().
This one and net/bluetooth/hci_debugfs.c.

I'll also try to push the other one and get rid of strtobool().

CJ

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-04 21:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-14  8:50 [PATCH v2] nvdimm: Use kstrtobool() instead of strtobool() Christophe JAILLET
2023-01-25 18:40 ` Verma, Vishal L
2023-01-25 19:11 ` Dan Williams
2023-05-04 20:29   ` Christophe JAILLET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).