From patchwork Tue Aug 27 02:45:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13778735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D73C7C5472D for ; Tue, 27 Aug 2024 02:37:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4AD3B6B0083; Mon, 26 Aug 2024 22:37:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 45B1F6B0089; Mon, 26 Aug 2024 22:37:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 349BE6B0083; Mon, 26 Aug 2024 22:37:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 10B6F6B0085 for ; Mon, 26 Aug 2024 22:37:30 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B4A4F12154E for ; Tue, 27 Aug 2024 02:37:29 +0000 (UTC) X-FDA: 82496464218.15.253E3BC Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf11.hostedemail.com (Postfix) with ESMTP id 9972540010 for ; Tue, 27 Aug 2024 02:37:26 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724726132; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vj124tQma8w5gl5tYOwdNBQKHz1Qn8ZfMqp9zmIPX3I=; b=hWxjSEjz4vkZXCsWMW4twVZpCIm725cOI7y2fNCT8/urWA60ny+xpvlK1BEEGffJbb+//O Nw1pIrJHJxiu5CeI8YWPMu60AXxcr+Vha8yYfdWTU65H335561TU7fv1EgK5CFsGLrbi3T KY4V2N27SCCALMlzUzLaGloAA+x4FpM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724726132; a=rsa-sha256; cv=none; b=mHORIuQyW9BfKryUL8LwQFbN5iZ9HL8MTUMFHRg+9zoNxNmZl11/VVeHLsyKFhIdBGtg8V hb+Cjp6EDtb6sPJ83FU+MuBFXarTXStX39ZswBjQmrCmcyTMc+UNKf253hPSkhI+nQTQYr /q0K0NfEZsOte/+Ss7V4ix3n514jKYk= Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4WtBXB04wrz1j7HJ; Tue, 27 Aug 2024 10:37:14 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 696DC1A0188; Tue, 27 Aug 2024 10:37:23 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 27 Aug 2024 10:37:23 +0800 From: Hongbo Li To: , , , , , CC: , , , Subject: [PATCH -next v3 1/3] lib/string_choices: Add str_true_false()/str_false_true() helper Date: Tue, 27 Aug 2024 10:45:15 +0800 Message-ID: <20240827024517.914100-2-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240827024517.914100-1-lihongbo22@huawei.com> References: <20240827024517.914100-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500022.china.huawei.com (7.185.36.66) X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 9972540010 X-Stat-Signature: j79cy1fhtt164ob7kz5epn3nzr6ig8ft X-Rspam-User: X-HE-Tag: 1724726246-231020 X-HE-Meta: U2FsdGVkX1/ms5CzxPdCe7sSrGx6ldZgdrxf+H+axGPbtKNd+gua/D9WqZI+nKCDaP2pJzGeNhtCTZG/V8zL9XEt3Y7ZQ1I6kfmvJbkf3W+7st//qfO8KGeads2XijNFzKQBUdeeWwg75v2GugJvSaPlVKtCt/8gOmX4cMRckIoGV8cT9MC9O/AmYBdEQVCkr4YYZRDFU9das4NLxi4x/qIISk2C/qZVYAE0UiG4zTD07zqmCQ0He0ZvXXgwbF4F37mgIuqoWN9VMFyD3gA0Vu69h0i8kEVvOzlhAeNHhDcdMCofN6UPHaFB3cTx+uxiVlPu3Dr55PaGRJuXZFqvHxmgjnkoEtD6woThyThQ57kT4olyWFvQRwcNEOZokmxz2dMPFGostT2qioBKwr9iPFtQAt3Vs45BJbQSXy5UrQVB0SWZKT0bbMIyi0Dse/hElrrD64SmPfJMR4jk/uRDMhmtInueA9MyNgWdedvOXKxAwupeJSPZW/7Nz9LNeiPBXopobF7VKaUd93bUA7TQiE/fDrvx9wVFg1EijwgC/KzRj7TeuzHp+tyBOz92+2HC+ULwJ5Jgib7MImqodv2c63Baw5SHSuk5ELS/O4d9uIBwWd8+78ByGerOkE6v5OZRnl2o9lR08mjyip+996tUyDoCM86vUGtm5CRkZFugcTPitidpn7w/SeQn3j3xGpcatfE/jdzVjPFTPfqsYKKzBq9YdLUUMEbBngjMTdseHWfthvUcrMq2KCBFWre7TU/5tbX91wL1rLnT+XJhH8k7xEpc48uoNOIA1tKtXOAhegI3ZLakKPIa//7l0y0f0newE8A88bHF/DyD/NvQ6HE/9XMmUUwd3k+oZbaDCNhSau0roQeamyxnH55kicO43plaExUYylAOnMyIs2ml9oPt4SKQfcO/Uus0KB5Stk7jPR8ZN/HfaQylF8WrN1cGg+maMN3hzzEOotCwlhzID1t S+ys0Z6k uyxc9cv5bY9//R11exeXCYLHmG2wMvus4mL9hR3hru+EewqQ/mfkXbghRkfagpUgsj9Z3jlvfz0WUARfjNLqVzqGMd84mNydqdLD/fWvl1Fwa94xZo0gEMys3hRd3GDHzGVLBNepkMcM/rsSR2GqDUky7GMxjbAlch2laEbjYkMzrJLf3hWDKWJUSqZhPfcj8aTNv X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add str_true_false()/str_false_true() helper to return "true" or "false" string literal. Signed-off-by: Hongbo Li --- include/linux/string_choices.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h index 1320bcdcb89c..ebcc56b28ede 100644 --- a/include/linux/string_choices.h +++ b/include/linux/string_choices.h @@ -48,6 +48,12 @@ static inline const char *str_up_down(bool v) } #define str_down_up(v) str_up_down(!(v)) +static inline const char *str_true_false(bool v) +{ + return v ? "true" : "false"; +} +#define str_false_true(v) str_true_false(!(v)) + /** * str_plural - Return the simple pluralization based on English counts * @num: Number used for deciding pluralization