Skip to content

Commit 99722c8

Browse files
tititiou36Christoph Hellwig
authored andcommitted
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]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent ba0718a commit 99722c8

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

drivers/nvme/host/pci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/init.h>
1616
#include <linux/interrupt.h>
1717
#include <linux/io.h>
18+
#include <linux/kstrtox.h>
1819
#include <linux/memremap.h>
1920
#include <linux/mm.h>
2021
#include <linux/module.h>
@@ -2184,7 +2185,7 @@ static ssize_t hmb_store(struct device *dev, struct device_attribute *attr,
21842185
bool new;
21852186
int ret;
21862187

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

21902191
if (new == ndev->hmb)

drivers/nvme/target/configfs.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright (c) 2015-2016 HGST, a Western Digital Company.
55
*/
66
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7+
#include <linux/kstrtox.h>
78
#include <linux/kernel.h>
89
#include <linux/module.h>
910
#include <linux/slab.h>
@@ -267,7 +268,7 @@ static ssize_t nvmet_param_pi_enable_store(struct config_item *item,
267268
struct nvmet_port *port = to_nvmet_port(item);
268269
bool val;
269270

270-
if (strtobool(page, &val))
271+
if (kstrtobool(page, &val))
271272
return -EINVAL;
272273

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

535-
if (strtobool(page, &enable))
536+
if (kstrtobool(page, &enable))
536537
return -EINVAL;
537538

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

559-
if (strtobool(page, &val))
560+
if (kstrtobool(page, &val))
560561
return -EINVAL;
561562

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

582-
if (strtobool(page, &val))
583+
if (kstrtobool(page, &val))
583584
return -EINVAL;
584585

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

731-
if (strtobool(page, &enable))
732+
if (kstrtobool(page, &enable))
732733
return -EINVAL;
733734

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

998-
if (strtobool(page, &allow_any_host))
999+
if (kstrtobool(page, &allow_any_host))
9991000
return -EINVAL;
10001001

10011002
down_write(&nvmet_config_sem);
@@ -1382,7 +1383,7 @@ static ssize_t nvmet_subsys_attr_pi_enable_store(struct config_item *item,
13821383
struct nvmet_subsys *subsys = to_subsys(item);
13831384
bool pi_enable;
13841385

1385-
if (strtobool(page, &pi_enable))
1386+
if (kstrtobool(page, &pi_enable))
13861387
return -EINVAL;
13871388

13881389
subsys->pi_support = pi_enable;
@@ -1511,7 +1512,7 @@ static ssize_t nvmet_referral_enable_store(struct config_item *item,
15111512
struct nvmet_port *port = to_nvmet_port(item);
15121513
bool enable;
15131514

1514-
if (strtobool(page, &enable))
1515+
if (kstrtobool(page, &enable))
15151516
goto inval;
15161517

15171518
if (enable)

0 commit comments

Comments
 (0)