From patchwork Tue Nov 1 21:14:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3216278wru; Tue, 1 Nov 2022 14:23:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SLgS+I6UYtOFNjp3rvuIWHm9A6tj20v9wBo3xItkmQn5QUKBjRJn7guUTBmt9tHHPSHO1 X-Received: by 2002:a05:6402:344:b0:461:7d4:9c9 with SMTP id r4-20020a056402034400b0046107d409c9mr21486489edw.141.1667337802052; Tue, 01 Nov 2022 14:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667337802; cv=none; d=google.com; s=arc-20160816; b=T8+Fnn7rXDjqm7SlTVyoUVNkXTotVsy3BMDnF9oy1dRQZ1h8By0hbNybyOWfwF/3s9 /ngZbGaBS38pp2yLdDgmLCjdyluO20OBFOnzP75XMite+VLC2E1U4Xb+OU7EE/vib6pt oOJ8S1/KJgmmSwmaIp0orjeVHOdYRLF9W+Hkyo/4dpD/8SLVqy7xUIASKacxjtOhOQzf 6Uxu7JV41ihM31J64jWj5sZU6Dzwai5T+tLA/w/Sv0B73CEfTckPw+iQpoirTMosJ7zd u5P0CtTEjtX00BNBoDEQKZyss8S4BiA4m015rS7lYyHwgdUNqmsPt2dhkgPFsBGhojvg TY4A== 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=qJY692Bw6zDUt1IK51abn9LCTZncm8baAhRqzYeVnyk=; b=IbEm5ulusrZFBOk19bueWRp9YfVrVdfTSl6EXipI6etRied26jiyLutESa3sEek/dT 92RS3XzO+4HW0yZI00G6yWeMqx9pmsGMADR9iCaPZWrK2aV1RUZhmBdw9HEakRXis9+l ESzj5AH/+dg1spUPtQv6DlZar4FeFfse1b3FioRzNDlpZcw7C+lPc3lkKZmdCmtSx8GE LJaaoJlDdO0n44yzTxxmzl/hCLQUh9SppQF3GLu6NiNZo+0n/VvoGMRgzZR8ymqLRyaD U4CJFiIogymLuTK7eQsi0KvCduokORiTf8kZl0uGtmRPdJCg86XlFsRQ8OmlL6BXFiAR P6/g== 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 hc15-20020a170907168f00b0078e0fd161dasi15370486ejc.87.2022.11.01.14.22.58; Tue, 01 Nov 2022 14:23:22 -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 S231202AbiKAVRY (ORCPT + 99 others); Tue, 1 Nov 2022 17:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230353AbiKAVQO (ORCPT ); Tue, 1 Nov 2022 17:16:14 -0400 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD6E41DF02 for ; Tue, 1 Nov 2022 14:15:35 -0700 (PDT) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id pyanoKD2rsfCIpybdoWfMe; Tue, 01 Nov 2022 22:15:34 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 01 Nov 2022 22:15:34 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 29/30] driver core: Use kstrtobool() instead of strtobool() Date: Tue, 1 Nov 2022 22:14:17 +0100 Message-Id: <02ba683a5c0716638ad8ca11e8b0fdca97c4f294.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?1748330403161430116?= X-GMAIL-MSGID: =?utf-8?q?1748330403161430116?= 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/base/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index d02501933467..5f6b80329cf1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1628,7 +1629,7 @@ early_param("fw_devlink", fw_devlink_setup); static bool fw_devlink_strict; static int __init fw_devlink_strict_setup(char *arg) { - return strtobool(arg, &fw_devlink_strict); + return kstrtobool(arg, &fw_devlink_strict); } early_param("fw_devlink.strict", fw_devlink_strict_setup); @@ -2280,7 +2281,7 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, { struct dev_ext_attribute *ea = to_ext_attr(attr); - if (strtobool(buf, ea->var) < 0) + if (kstrtobool(buf, ea->var) < 0) return -EINVAL; return size; @@ -2534,7 +2535,7 @@ static ssize_t online_store(struct device *dev, struct device_attribute *attr, bool val; int ret; - ret = strtobool(buf, &val); + ret = kstrtobool(buf, &val); if (ret < 0) return ret;