From patchwork Sat Aug 31 09:58:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13786010 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 6C0EACD13D2 for ; Sat, 31 Aug 2024 09:50:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7909E8D001F; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 746618D0008; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 456588D001F; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1477D8D001F for ; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B18BFA9B7B for ; Sat, 31 Aug 2024 09:50:33 +0000 (UTC) X-FDA: 82512070746.13.EEB55DF Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf04.hostedemail.com (Postfix) with ESMTP id A586F40005 for ; Sat, 31 Aug 2024 09:50:30 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.187 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=1725097759; 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: references; bh=V9ap20M+6FBg04d5yADWrKkXp2yQVTHH9YQtCDQGv6M=; b=lXR1hPxN+fUbe3TAJiOb0EfbNlPJiyNOsmKpmDKZd4tiFzVGAUH7gMoa4YQBnhZg6WKAQt jqOWGNrwz2cxasX8u/0CHDd3z5DApAdVJQivkKuA2pwoevkxYKM8Ku3I6XNP/uvCyv6swS LyKkfta2+4ltygS38TYjzM5/a5r4W2A= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.187 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=1725097759; a=rsa-sha256; cv=none; b=WCgb8XcOVpDMCTzCpkZTtVi8VC6lIA5SfbsflAeI6u6QuFgnThoKGJiQe6SVwIbji7p/Ve CzpXXWzNEsDpJKPg3dqusE2g2fXm+4Rhrggm4PaI3Aw4iOTrvdigU5Q3WIkznTXTlOdodQ 5G+WhCXAmM6wR9a+fOcKVC4Xb0uGusI= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Wwqx95T0BzyQwv; Sat, 31 Aug 2024 17:49:33 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 23B7A18006C; Sat, 31 Aug 2024 17:50:26 +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; Sat, 31 Aug 2024 17:50:25 +0800 From: Hongbo Li To: , , , , , , , , CC: , , , Subject: [PATCH -next 0/4] Introduce several opposite string choice helpers Date: Sat, 31 Aug 2024 17:58:36 +0800 Message-ID: <20240831095840.4173362-1-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500022.china.huawei.com (7.185.36.66) X-Stat-Signature: ospnid3tb96fz1bp7kqs8ny4d6mg56nx X-Rspam-User: X-Rspamd-Queue-Id: A586F40005 X-Rspamd-Server: rspam02 X-HE-Tag: 1725097830-244616 X-HE-Meta: U2FsdGVkX188myLujHlKxKSHmGGVka+4SE7zO+1BM2sVwZEtSukl6TklE2wCA9eJrcPmg8pwN1ZHAhMSoZDM2LA52i+dCq6lYpJakPPWcQioy3loczeOHJXW/Jxprt5sNfNbp5UjGYOwaj6Wp/ldz637//r7s9gZPB+F/E8VkafzwPlhDEQ0l1CEyEZ1kuTWGbaqUn5L5ntidRtGzCZ+ycH3GHn8+PEmhhv6c0i+hcBt66uMhQ62o+5Rlx4wM/YJeGz7p8Yi6r7M2xF7XR1Osp0UtWZcLCRivHMHSyV8DP9UTTrSpvfUSToA1tTvS1qdaRm27o8NtbB35/XDn2HbpWXxyDOrr2A/9VehYyOAid0lja0PSq6sam+Eao+spuipVlBoIxJD/8boRf94D+ur727pLwczKFn4eNZuGTza+aXDi/VYhYKCYf3EyDoYQKDjU90x9cPV/u7zxmxwhp1jvYwxLRULjs2k4Q2MwDKr7jXbpo1qef54bBtb64UnC1Nl1JyKOd+Vz4YIgul5WazpyeLdphQ2Ull3J/tX9HG7SrBcwBeD999aJHsQc7j/4lVZaVP9HgOcPfOLLrukya4khzeuF1EnUm0B5P4xdS30OuPaqkGuUHzsUebPZ4yP8hHfOfJ1yBAEgWCnTGS5rFGH+/ZeHcf6YIwiRQjf6IPwNt/SVNk7sjJxzT+pRe45rDHv679/NTvKaFSclT+wQmBZlTbX/8AvIEJGBk9oqflq3DXXAgPgAsTpqDwXAXGdIuRI66nsvSg3tuHlJplmH5Jelg3ebNOrivZewtlMkHX+D30R07TmYWKtEbmafsAlDXB9rVs3s9oOBkpfW+5UFtbZkAVazoVKFa35lcqOJWJGtHZFOj5OQeg7zHG564YkqMu2q0B9/h96k4PWdaLmeeleSyfj+NYM70YN9gOAVrXzM3aW0WYn87VWLxTIWOMpbymebCYO4Biaxm6XKbBRuBJ CujlZBH8 qoZsWoV5iSeluDw6uJByEO++nP7PosRBvweDwt2CAEOas2JhfX7noljvcLAnxvWxqwNH66RIVST8w0aLwdYq4PUeeRFt8+N3bBzxfIGEih8pKVLHAfhUVL696/Y5jJfg082mO2sUt8XCEyanpB9e1/EFptbRYLUweMI/gBhEgRUs27/0/ZIuygAS2JdOndzPKmpnu X-Bogosity: Ham, tests=bogofilter, spamicity=0.022556, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Similar to the exists helper: str_enable_disable/ str_enabled_disabled/str_on_off/str_yes_no helpers, we can add the opposite helpers. That's str_disable_enable, str_disabled_enabled, str_off_on and str_no_yes. There are more than 10 cases currently (expect str_disable_enable now has 3 use cases) exist in the code can be replaced with these helper. Patch 1: Introduce the string choice helpers Patch 2~4: Give the relative use cases to use these helpers. Hongbo Li (4): lib/string_choices: Introduce several opposite string choice helpers tun: Make use of str_disabled_enabled helper mm: page_alloc: Make use of str_off_on helper net: sock: Make use of str_no_yes() helper drivers/net/tun.c | 2 +- include/linux/string_choices.h | 4 ++++ mm/page_alloc.c | 3 +-- net/core/sock.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-)