From patchwork Thu Nov 24 21:28:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 25713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3619907wrr; Thu, 24 Nov 2022 13:35:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf53X+CpgFmxAZD1k/VYQP9uTHkkO4uVCaSHNQgWsyhLIYP6/Dw32zsdScHEzgVaMfNq5pge X-Received: by 2002:a17:906:794b:b0:7bb:a098:988c with SMTP id l11-20020a170906794b00b007bba098988cmr3171967ejo.11.1669325719902; Thu, 24 Nov 2022 13:35:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669325719; cv=none; d=google.com; s=arc-20160816; b=o7mNu81+ssN66wD9hSoR1lsJDjFRKLpvpHoVUSgUclQer7fvo5Rm+9Co2fNiVPKgr9 3MkUnm4VvZSvXscWOMOO64aZFS2RQIKzngZvbNLB/pNlJhKmN2sbXiskHjJnBtmNcEmk QjHwdLbgoR9XTtNiuKZnni0Be/ayvGo2kgE5LCrduArI1azlqldAPBzkynKz9k8q8VS+ dqornose3Xyz//k7i/tyJNnLrjuBscRVMCod4oGwUeL4P1qEQEX7FShpOO5Lrq2KD7yV 1/422VvPHpTGB3xdpC8i3WKKoeEyTCXpR8p77TmMFNUgrGFr5rXj6kqtOWbo4/sWzmeZ Xj7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=BMVbjlB+wHrttxedtCp/NyECzuG3m4NrYWQZ/eCae/c=; b=d7BMI17eh/HoclySnoft0nPqprkT2B7MdOc8uIR9741myX05jhxGBxiVbmQ2fbGdkC tjUHSwOku7xJT61rLF33B6dqdnlRa5f+qCAB3cXoAweFLyZEOTUf36j8BhTq2Krolt+B lGvecPVP7nl+ELI3q2oD1q/K2bvCrluLNbMA3hMkeaV89VPZMUONVafds7g6kZ/FSTH2 JIo13251ocxwULe7MiAvJ625tGXxN6xeIWS246p1ILMp2l821fP7otSvZumA7j3OmD+4 h7lPHfDiMH/wdoyLHSMkiTmL9hCNwkfQVnX79hqw5E7D74oBz4Ms1VKIdGx5cb4z7nD4 MXwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs17-20020a170906dc9100b00780def41dc4si1837359ejc.527.2022.11.24.13.34.55; Thu, 24 Nov 2022 13:35:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229536AbiKXV2U (ORCPT + 99 others); Thu, 24 Nov 2022 16:28:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbiKXV2T (ORCPT ); Thu, 24 Nov 2022 16:28:19 -0500 Received: from smtp.smtpout.orange.fr (smtp-18.smtpout.orange.fr [80.12.242.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E08AF22B30 for ; Thu, 24 Nov 2022 13:28:17 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id yJlWods52CoWhyJlWo2n87; Thu, 24 Nov 2022 22:28:15 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 24 Nov 2022 22:28:15 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-nvme@lists.infradead.org Subject: [PATCH v2] nvme: Use kstrtobool() instead of strtobool() Date: Thu, 24 Nov 2022 22:28:12 +0100 Message-Id: <5edef1b51c865faf61752c991eaf292c8a68cc01.1669324969.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750414885983813103?= X-GMAIL-MSGID: =?utf-8?q?1750414885983813103?= 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 () Signed-off-by: Christophe JAILLET --- This patch was initially part of a serie ([1]) that axed all usages of strtobool(). It is synched with latest -next and resent as an individual patch as requested in [2]. [1]: https://lore.kernel.org/all/cover.1667336095.git.christophe.jaillet@wanadoo.fr/ [2]: https://lore.kernel.org/all/20221102064747.GA8903@lst.de/ --- 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 0163bfa925aa..be70229c0b94 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -2185,7 +2186,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 6a2816f3b4e8..f14a5db3f02c 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 #include #include #include @@ -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); @@ -1275,7 +1276,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; @@ -1395,7 +1396,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)