Skip to content

Commit 44f23da

Browse files
tititiou36davejiang
authored andcommitted
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>) Reviewed-by: Vishal Verma <[email protected]> Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Dave Jiang <[email protected]>
1 parent fdf0eaf commit 44f23da

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

drivers/nvdimm/namespace_devs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/*
33
* Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
44
*/
5+
#include <linux/kstrtox.h>
56
#include <linux/module.h>
67
#include <linux/device.h>
78
#include <linux/sort.h>
@@ -1338,7 +1339,7 @@ static ssize_t force_raw_store(struct device *dev,
13381339
struct device_attribute *attr, const char *buf, size_t len)
13391340
{
13401341
bool force_raw;
1341-
int rc = strtobool(buf, &force_raw);
1342+
int rc = kstrtobool(buf, &force_raw);
13421343

13431344
if (rc)
13441345
return rc;

drivers/nvdimm/pmem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/moduleparam.h>
1818
#include <linux/badblocks.h>
1919
#include <linux/memremap.h>
20+
#include <linux/kstrtox.h>
2021
#include <linux/vmalloc.h>
2122
#include <linux/blk-mq.h>
2223
#include <linux/pfn_t.h>
@@ -385,7 +386,7 @@ static ssize_t write_cache_store(struct device *dev,
385386
bool write_cache;
386387
int rc;
387388

388-
rc = strtobool(buf, &write_cache);
389+
rc = kstrtobool(buf, &write_cache);
389390
if (rc)
390391
return rc;
391392
dax_write_cache(pmem->dax_dev, write_cache);

drivers/nvdimm/region_devs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/scatterlist.h>
66
#include <linux/memregion.h>
77
#include <linux/highmem.h>
8+
#include <linux/kstrtox.h>
89
#include <linux/sched.h>
910
#include <linux/slab.h>
1011
#include <linux/hash.h>
@@ -275,7 +276,7 @@ static ssize_t deep_flush_store(struct device *dev, struct device_attribute *att
275276
const char *buf, size_t len)
276277
{
277278
bool flush;
278-
int rc = strtobool(buf, &flush);
279+
int rc = kstrtobool(buf, &flush);
279280
struct nd_region *nd_region = to_nd_region(dev);
280281

281282
if (rc)
@@ -530,7 +531,7 @@ static ssize_t read_only_store(struct device *dev,
530531
struct device_attribute *attr, const char *buf, size_t len)
531532
{
532533
bool ro;
533-
int rc = strtobool(buf, &ro);
534+
int rc = kstrtobool(buf, &ro);
534535
struct nd_region *nd_region = to_nd_region(dev);
535536

536537
if (rc)

0 commit comments

Comments
 (0)