From patchwork Thu Jul 13 04:50:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 119542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1598755vqm; Wed, 12 Jul 2023 22:15:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlEJJBHKqMNFFNjI2jzXbUQNDpPhIpAqtmsM2w/88m6JDpfgg07lX1Jo//4wepxuSYq+Im9k X-Received: by 2002:a17:902:7c04:b0:1b9:e1d6:7c30 with SMTP id x4-20020a1709027c0400b001b9e1d67c30mr316834pll.39.1689225307997; Wed, 12 Jul 2023 22:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689225307; cv=none; d=google.com; s=arc-20160816; b=maYBmU6Tf5GjuQ03Aq4PEUA8XOz5l5BRMmJc2UbTgPKrFV1ghCxYcODqkm+1kW8++q rxzz31ZUfsFEIhfiDVf93pSEhdymYmPL2tL13Mw7ZPENJLT9KHqHXOP09hCTucM7ZIxz INtgPCYYEixyk4k+yHjB4j/RgyGQpde861ZrqI8virwOzFGj4I4zhy3gU5j9lTXuEeLr 6ydXOIC/6LQ2dgWhKoLRj7PaFJj3NBmKNBS7m6moR8DR6C72tg3mmMrVs62wm2U9o+ZA kvDtRAmQ9/kULnObjt9bHqbTBggkTNTvKwdDQ/t6qNfVX7riNlyvDp59e4mcPyNVnpla WVeQ== 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:dkim-signature; bh=OIO6SGvjdu5q95AKttYaweX2kv13SEJFYyGhl5Ix5MU=; fh=HL92lzZDZrnxbU4d+ciul4+wQpJQ07sP68/aOpacS+M=; b=jfCibqEPkuk0AdYfwP9RgZMcw11//xC8SXd839U9eBSJrwsLCT8YENRzOciyw+pqLE ESIlDiSfbpjEVg6Tl8Z3vNtxA7No3gJ0wSbzJ4QoX94qlKV26jOeDLdZ7uADeiUrZZv6 seUq9djYbQwWHAO3BP/KGbg4ykSI7mN9YDmsgjF5VbJ8kPOAXLJpqd40uvTU+0eRQqoJ OlIHwDB4JLInwIGqCOyvArHFJ1qcu/077/Nd028hRdY5GLyrXt+DZgfz9tvEma/h6d/D uiQxwtrhlMKJD2veQm8BCzUUalgoolFHl0tASB5Ji04GeWQjezZb6PaK7chNpzrBoWVh wgvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=D6aJTxES; 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 kg14-20020a170903060e00b001b6b369bfeesi310725plb.401.2023.07.12.22.14.53; Wed, 12 Jul 2023 22:15:07 -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; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=D6aJTxES; 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 S231935AbjGMEuV (ORCPT + 99 others); Thu, 13 Jul 2023 00:50:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbjGMEuU (ORCPT ); Thu, 13 Jul 2023 00:50:20 -0400 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 572E3210A for ; Wed, 12 Jul 2023 21:50:16 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id JoHLqljqIGqNMJoHLqvxHU; Thu, 13 Jul 2023 06:50:13 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1689223813; bh=OIO6SGvjdu5q95AKttYaweX2kv13SEJFYyGhl5Ix5MU=; h=From:To:Cc:Subject:Date; b=D6aJTxES5TE1G/CFp5XvTb2PZdxCaLGx3SH+sJG8S/01CDdGPONxOBpZdrpkunkVD j2kIr5AYo6oMJzAvJbwvk0DJDXE5C+EsU9AyXbFAbOfHIvzC+MPVDTQkWPjZk04DIf Gm7jJdIsKKaR58N13iaubLsUn4Drc61jYeOkFihkH7U5KF0FWVIuzjD/tmrTsy4cFM 8TbqmO9/Jc6cEhaSpSYy/ZeAbXfbzYKzK8ZLPHM8+MsxLZ1/5nOdK5s6cgYn+iMGao OQU5UJ3u2F9WP4iraRqwd1vwuu+9Kp0ZAH2ct02IXzMDxCdlX1p+oXGFmKzkIitESW 8ecSApggwqb0Q== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 13 Jul 2023 06:50:13 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: akpm@linux-foundation.org, 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 v3] nvdimm: Use kstrtobool() instead of strtobool() Date: Thu, 13 Jul 2023 06:50:09 +0200 Message-Id: <75a5ff07902e34fad9bc821b8c533d070c498537.1673686195.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1771281116296693345 X-GMAIL-MSGID: 1771281116296693345 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 () Reviewed-by: Vishal Verma Signed-off-by: Christophe JAILLET --- 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. Even if R-b and told that it was applied for v6.3, it is still not in -next. This is the very last patch of the initial serie that remains un-applied. After it, strtobool() can be removed from linux/kstrtox.h. Changes in v3: - synch with latest -next. - Adding R-b tag - Adding in cc: akpm@linux-foundation.org Changes in v2: - synch with latest -next. - https://lore.kernel.org/all/7565f107952e31fad2bc825b8c533df70c498537.1673686195.git.christophe.jaillet@wanadoo.fr/ [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 @@ -385,7 +386,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)