From patchwork Sat Jan 14 17:21:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 43783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp376539wrn; Sat, 14 Jan 2023 09:23:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXslepbu6ubd7L+t/+Y8wX7obWFe+RKqc01RkJrmmXiV7YMR5ypzsqZIoAJOMzI7ZZdvhBSp X-Received: by 2002:a17:906:474a:b0:869:8f64:25af with SMTP id j10-20020a170906474a00b008698f6425afmr7154700ejs.16.1673717000276; Sat, 14 Jan 2023 09:23:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673717000; cv=none; d=google.com; s=arc-20160816; b=jvlaiRDNeAnmS53Z4YOqqlbmRt8si2QGg6XPztYHSbdoY54P9mVc1QQg3oUAtSEsTj AqxhJrUK+/n2WPAUB2j8fll5NhqlcZxnd617wQ2zD/BeTNP36RvXm8wlsLQBYA6+mlIJ CaFKMFP+t/HoOF61Tm5Qkd0hxuDlWOVEtcfDZc13iGTZFyJzSatFj1m3oj5NQngfYxum VT+tCp4wuCIdG+H44DBWja2nM9xJTBuxOX8wNyevj1wbTVpnbCxa1G703b0cIhmzaRzs xqJuouSMRy6bYJWZ8Q+CCWvq7V5dQhaconDKc6ldBLlWILYS6FE3bXfWE+uvHHaow0Ye f3Vg== 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=ZFyILBXJ2nM5b/7SCzceDNtgjYyli1NPttiCdR1PYjs=; b=OjZJen54gSN762/Rfw57NjZBJLECMmAuxMXE72h18XcPVQPmXU/e5tz086IoRDUOfF y6e0nvqXBxZR36T4YEtx0uvryU8kMbliEEaRRDLzDA9IdyLA2cidoiT4+SewiCnuNJmF B6P3A1ptQF9BSMeEF7OvzYk+gnU/Dgv3Vz553QTjhZb1ZoB7i/NkALuWeFWTNYxOKuN3 1ZloE95XI6FmBuN0JP8UoU25iZFrQl0FS3Lh5DAdeJ8Ew45mwNfH3ujDcsoNJeraL5FV lF0lqTG3ZdY9/YNtdFOQgF30qlmU/5qUZT/XXpD6nGDpY0Ufqym9XWWDkq68LRxnD7aD 17jA== 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 gb23-20020a170907961700b007bbf9652314si4466859ejc.435.2023.01.14.09.22.56; Sat, 14 Jan 2023 09:23:20 -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 S230340AbjANRV6 (ORCPT + 99 others); Sat, 14 Jan 2023 12:21:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbjANRVv (ORCPT ); Sat, 14 Jan 2023 12:21:51 -0500 Received: from smtp.smtpout.orange.fr (smtp-21.smtpout.orange.fr [80.12.242.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D38583CD for ; Sat, 14 Jan 2023 09:21:48 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id GkDwpTOYE2zC1GkDwp5Jc6; Sat, 14 Jan 2023 18:21:47 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 14 Jan 2023 18:21:47 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: akpm@linux-foundation.org, ddiss@suse.de, mwilck@suse.com, brauner@kernel.org, wuchi.zero@gmail.com, ebiederm@xmission.com, xupengfei@nfschina.com Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH v2] initramfs: Use kstrtobool() instead of strtobool() Date: Sat, 14 Jan 2023 18:21:38 +0100 Message-Id: <2597e80cb7059ec6ad63a01b77d7c944dcc99195.1673716768.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_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?1755019477558579429?= X-GMAIL-MSGID: =?utf-8?q?1755019477558579429?= 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 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. This patch slightly changes the existing code with an additional error handling. Note that the first version was sent to no-one, only mailing lists, because "get_maintainer.pl --nogit-fallback" returns an empty list. Changes in v2: - Re-write to code to be more consistent with other kstrtobool() usage in __setup() functions [1]: https://lore.kernel.org/all/cover.1667336095.git.christophe.jaillet@wanadoo.fr/ --- init/initramfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/initramfs.c b/init/initramfs.c index 62321883fe61..f6c112e30bd4 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -571,8 +572,7 @@ __setup("keepinitrd", keepinitrd_setup); static bool __initdata initramfs_async = true; static int __init initramfs_async_setup(char *str) { - strtobool(str, &initramfs_async); - return 1; + return kstrtobool(str, &initramfs_async) == 0; } __setup("initramfs_async=", initramfs_async_setup);