From patchwork Sat Jan 14 08:50:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 43715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp193737wrn; Sat, 14 Jan 2023 00:52:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXsPcfcMMJKTq10GcLSZijAXZ+5LygbVKf6JQ4bVyg+2DwI8BjWtE0+C/F5Tu1NbhTczXdGN X-Received: by 2002:a17:906:49cd:b0:7c0:f684:9092 with SMTP id w13-20020a17090649cd00b007c0f6849092mr67630928ejv.37.1673686320420; Sat, 14 Jan 2023 00:52:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673686320; cv=none; d=google.com; s=arc-20160816; b=kt+2YXFauQ1tSDiU5XkeZsd+HnEvYRFvuqeOkElOaFigS8UiInBqEH3XHVmzhCczfA CVzn/1OUXxw2VSaMZnTUJv5eNmmJlGeRqQuJfZaA4yLldeVpLrJp6fDJyI8+OYuu9VQ2 pOUCVHRpMJ+9esuI09iby74TPmmHE6kGkljolKC8gkfU/VdGUHJuaEH2wPShSDnx4oOO VS10tNk+aPhf4OU7socnfDDgfzpQXOmINAY/2aj4jHoJRKTL20luDS9bdcwRidRc7LM+ TIfYLPS8LqeHHuI5amW914w98JwzVmW62jodYX0b9CurDU+DRrbGFQXqte2Jbgg6Dkui daBA== 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=1rjiXL/zkiQk4/HFMSO7oZzEWlgbBggAlCR4wiSCkgo=; b=NajvuQTUomWucqrmDvTBIiVThWUo7NTg7UaYMufk4rN3X3tng5I2bv+yEPdp4DkKao XxO3QBbCB0/Rj7ijcELzc21MZm+BnKx2i+blcLl6BtUjnsVzbKyUVVpTT3FZhQ7XufER on50Y3/68bhpiXVunrm+KelFVXLvjNl/XW9CCV+DTM9F7pZEyFInAIX1jYGju8+sG/gg rkphrIRq2uiDFfo0/Nhkezbjf70eiH13Z06E64EXggSKbJtBp6anlPwYY1+EOxPBocil AlMJ+Nqf9wYWuXgUx+XuhgOUXwYutcvSLm6XaWqFYAO7GvT6ls1uoZlnX7CzTGhrsp1P 9rew== 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 xg10-20020a170907320a00b00781f51771b6si24323571ejb.900.2023.01.14.00.51.37; Sat, 14 Jan 2023 00:52:00 -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 S229735AbjANIuq (ORCPT + 99 others); Sat, 14 Jan 2023 03:50:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbjANIuo (ORCPT ); Sat, 14 Jan 2023 03:50:44 -0500 Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5131959E6 for ; Sat, 14 Jan 2023 00:50:42 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id GcFKpBC5RvDxRGcFKplSye; Sat, 14 Jan 2023 09:50:39 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 14 Jan 2023 09:50:39 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , nvdimm@lists.linux.dev Subject: [PATCH v2] nvdimm: Use kstrtobool() instead of strtobool() Date: Sat, 14 Jan 2023 09:50:21 +0100 Message-Id: <7565f107952e31fad2bc825b8c533df70c498537.1673686195.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?1754987306883861987?= X-GMAIL-MSGID: =?utf-8?q?1754987306883861987?= 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 Reviewed-by: Vishal Verma --- 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 #include #include #include @@ -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 #include #include +#include #include #include #include @@ -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 #include #include +#include #include #include #include @@ -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)