From patchwork Tue Nov 1 21:13:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3212673wru; Tue, 1 Nov 2022 14:16:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6YC8ITU3+NrZ03/4dCWIlE0ly+xnX++MiugS/WNaxbxY6UMtU6VFO78/frOLrKF6cXQQ44 X-Received: by 2002:a05:6402:1cca:b0:460:7d72:8f2 with SMTP id ds10-20020a0564021cca00b004607d7208f2mr21310133edb.205.1667337390650; Tue, 01 Nov 2022 14:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667337390; cv=none; d=google.com; s=arc-20160816; b=L8fmrSQejuym/AfbpVWnWgia3WaziYxfOokGffQdjssGDIQJoSZnxeV+fFviR2rlhj wkG59Eccnq42rm4GrnTlkLhPe8Td4y3+ak8bpItsAUqGc1B+wEI6h2g4C7rvYQ7gYJDK n886KHHtd9K/etiaO+z2StLsqYUipYlusU63EttVgIp/ZwzmmjwvNBvv4jscUzEIMQX6 bdxpBjlXkyl20QMMDDo/swW5GPvW9id95X2z/71wOSKPSdhVQ20qiRW4pEvHujik2DJI ku/PRE7fViU6DP/+S2KNdCivtRmIFhPzd1zogowhyrUtBmMjQ2kvVyGa3S3FJzNjwb3y 8tlA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3xBtJ8pQKFtz9jtaEmbilqS3n6653RcIyv4R6Xmmccg=; b=VfUVZNISNuBiu8Z6vDym7aqrNl/EJ90nQYU4vBtjCIZWqdWXhuDohkJN+mx466thhq R6QQzR+tRNu/V3xAPrSdkiZ+t600jCaBpPYAriTKWclBX+IipYt6CU4mIXt1MQmLrv+/ sp5UrnoKliFGcv2efWel3dNg/CRZydISplWXNDtehtUCaRLndueGeQBINYliwqpwknXF a/yN8PFwd+z4Rk/zEtzoQHC0x8hfjXPcOUqy2k4PO+yP91Bp9yBkaigFKSsO8C55DMEY idpt+6Nd9fJlREc9xB9zyjl1Wzm2VsG75TchRzbZs6RaJPB4wJRfwCL9s3VhjSUDhFhP 94bQ== 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 k11-20020a170906128b00b0078d0f57b0e2si9197808ejb.412.2022.11.01.14.16.06; Tue, 01 Nov 2022 14:16:30 -0700 (PDT) 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 S230302AbiKAVPg (ORCPT + 99 others); Tue, 1 Nov 2022 17:15:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230106AbiKAVPM (ORCPT ); Tue, 1 Nov 2022 17:15:12 -0400 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAB6E1EC77 for ; Tue, 1 Nov 2022 14:15:09 -0700 (PDT) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id pyanoKD2rsfCIpyb8oWfHr; Tue, 01 Nov 2022 22:15:03 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 01 Nov 2022 22:15:03 +0100 X-ME-IP: 86.243.100.34 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 05/30] nvdimm: Use kstrtobool() instead of strtobool() Date: Tue, 1 Nov 2022 22:13:53 +0100 Message-Id: <5990e1eadd81a25026e6f04fdda96bd43ff23a07.1667336095.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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?1748329972121279245?= X-GMAIL-MSGID: =?utf-8?q?1748329972121279245?= 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 is part of a serie that axes all usages of strtobool(). Each patch can be applied independently from the other ones. The last patch of the serie removes the definition of strtobool(). You may not be in copy of the cover letter. So, if needed, it is available at [1]. [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 3c63dc2cdc81..46475d146f64 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 e0875d369762..76e1ae6f830a 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -229,7 +230,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) @@ -484,7 +485,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)