From patchwork Sat Aug 31 09:58:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13786009 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 4F3B0CD1293 for ; Sat, 31 Aug 2024 09:50:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 45D9E8D0021; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 408BA8D0008; 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 259BD8D0021; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0B5918D0008 for ; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8778140B6C for ; Sat, 31 Aug 2024 09:50:33 +0000 (UTC) X-FDA: 82512070746.01.AD72B73 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf28.hostedemail.com (Postfix) with ESMTP id 272E1C0007 for ; Sat, 31 Aug 2024 09:50:30 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.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=1725097740; 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=xevtnFxrFNx+IxIvJSXWm1eWTJiUmJBGup/yMvpHDhE=; b=oz5SA1CEjEXVvRFuglDYHOA3Vo57okoi48aTSDP7LaYWMRDS/1KFrnAPb6Pd1xVf37V6LV HOfpb8acFizhjHhadaprXXGDKQcIx/K87Kfz1As+fyg4tDoEcpoMdWDxqltG0Q/9SkM1J6 i5hfIxyVjXLGjPg6lLrx1B0u7ZCCfIs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725097740; a=rsa-sha256; cv=none; b=nCiOdUqvOXXOClB3PR0mutFnh02fzuIzyy2xuQwhA9tq7VF/PikMFeHGVO/e7GAzXvZXMQ kmR5xvzM8bcCedcElnwIj0NzFoXe7bSUXT4Ph/CMEhgS5SLLuuf4+jmk9tWAJZFhR7eQxR D7Whm/5mdiotsuC6hLko+XohQfkYoyo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.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 Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WwqxY3TBzzyRJF; Sat, 31 Aug 2024 17:49:53 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 19283180100; Sat, 31 Aug 2024 17:50:27 +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:26 +0800 From: Hongbo Li To: , , , , , , , , CC: , , , Subject: [PATCH -next 1/4] lib/string_choices: Introduce several opposite string choice helpers Date: Sat, 31 Aug 2024 17:58:37 +0800 Message-ID: <20240831095840.4173362-2-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240831095840.4173362-1-lihongbo22@huawei.com> References: <20240831095840.4173362-1-lihongbo22@huawei.com> 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: f99dbu4zcqswyctjzkypad7iky9x4pqx X-Rspamd-Queue-Id: 272E1C0007 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1725097830-452095 X-HE-Meta: U2FsdGVkX19cS+eR/VH2WrwacgXTk2Zfl0COYJ+Sq0dmupdhJiUaArLUBbdQa91V24+236T0Qk8jrbOFrCAV6zvWmR3W6WlFjlEU9tJjYPqovJaZn0HoXh/4hi6hN2qfPtVl87avSN8zJcwI1muofJMBLixrsW92WfsXG9u9vDfsLJ7/3DcAmaUPqpOq1VKTW5ll6+nTXqz7MjXqIX1oGyFnmnJ7h8Yj0pPdFb5+vrx7EdH4YU1+pYhUn+mcRSH/qeSK0y0oJFMMCYmPdUr2kWmUfliPDwKVuTHNQ/349Q/+VMubETgjg5zOgqCm3VEZAGQEf1A577XdvHBKJg4t7yBy+fP2ki1Ra6jZI2mpd0kG9zcGQ0WXvtiLNSbn9ev3Z/U9Mac6dcx9wAI4HPMn4ijPr/pqVvNXZEszmWEaILJ2Anxctg+rJNP3eUB90JB/nTmlLkZOfyMLgOkivEs32qI0SKPaMP5MpmSY8WbHooZBkMUa9NoT4ZVtyD0ux16o/BqAfJNZo0L2y2skwW6Ur6QAmSP9Fcgm1Mz4rFItwDWSbVJx7CLwu04ReNdZlNLrVYX1goGLzJJiSWZocP8CECy0qj2WEiH8q6xZKHxE18JEifasgUkHkOXI0D/d10RnsB3yeBd8XnGtGpj5EAW1u7t1n/T9JfT/AeAenUocvLAZf/VXW0g/WpgcOLMr+9VXOxty1YSyr2z1YU84LoRWjISPY27RhoeCO3NvbP0oYclEgFDdq3CaPuAh6sLvvTUSSksdnfyz48EqxvdF2J630tSi5GeG9iNnylkYmHvUG52e3JT7tXsiGJad/brRcwTb5Q3vxkbVCpA+pj8hw42RG3PQvU5nuAodqsQ9AItWfe5KF7Rc2Gp257IR6+1ms7QWbSuMWiMBekIVTbmnJ4bEtcPQauVQQEStEPdYQjfudpiG3G85c/xLj00PteDe9ENo+y7Mk9ZFagVp3et5of7 6EtLmpEn MUrb/RXRmBpyBdRI4evtZoLjIrbzSloQorMsld40foJ5KmcPWXZZ37doR105m4bP00UnfaGomyrPliJl1Z4EsnDDDL17GR6QItQS84ORnINAE5Uoh3O2c21/m8g05rFIKykFk7QgGtDYunCCbOZ+5Zj1wfOysuYNiTh/XlTyiR0Sc+jx1yNpiqcqoGFMUlUzVF5b/UYv1/UgSikiQo0YsJ89iLndb1pUbAuT41jdRm1S9Ukfo6trDjveiS78a2eEgq6fjPxLno/fk55k= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000143, 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. Signed-off-by: Hongbo Li --- include/linux/string_choices.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h index f3670dbd1169..c2134eeda1fd 100644 --- a/include/linux/string_choices.h +++ b/include/linux/string_choices.h @@ -8,11 +8,13 @@ static inline const char *str_enable_disable(bool v) { return v ? "enable" : "disable"; } +#define str_disable_enable(v) str_enable_disable(!(v)) static inline const char *str_enabled_disabled(bool v) { return v ? "enabled" : "disabled"; } +#define str_disabled_enabled(v) str_enabled_disabled(!(v)) static inline const char *str_hi_lo(bool v) { @@ -36,11 +38,13 @@ static inline const char *str_on_off(bool v) { return v ? "on" : "off"; } +#define str_off_on(v) str_on_off(!(v)) static inline const char *str_yes_no(bool v) { return v ? "yes" : "no"; } +#define str_no_yes(v) str_yes_no(!(v)) static inline const char *str_true_false(bool v) { From patchwork Sat Aug 31 09:58:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13786012 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 38F9DCD1293 for ; Sat, 31 Aug 2024 09:50:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD0538D0020; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D5B968D0022; 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 963E38D0020; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 53E018D0022 for ; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0440CA0AAA for ; Sat, 31 Aug 2024 09:50:33 +0000 (UTC) X-FDA: 82512070788.18.7C34B09 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf27.hostedemail.com (Postfix) with ESMTP id E44A24000D for ; Sat, 31 Aug 2024 09:50:30 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.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=1725097740; 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=RAX3qFzXZZq5vuuJDClx2gAZYh+9Y7N02op5JW99ayQ=; b=jie3gxrNpK3apPJ33optpApKYcP7w0Q4yGelsXsuL/0VEXeH5ielhlzV5k0vBxRS8LvdZH 0gSIAZFVBqOOkwOQCReUnoMS9TmcS12DD5oht/znOQo0MTuCdnS+/qkWGKnmnm5DKwXY5V o9Homn02C2j8biBXV+yeHjrxeB2A0qE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725097740; a=rsa-sha256; cv=none; b=Dcv/moC7q6jyuA1gQKN+SkGxMoSPiXYWo3AJyFOL8H97i6DU8CUtO++8b8R11pFcQgeUD4 bbaawqYBeY5czoPc9tb3exuufsLgSZDwnobJrLR72RLBvfTnKtXpRzfyPgcUGh5ZFQCQxy MVb4bM8bFG/0nlD6Fwzh5J4YN/s37xQ= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.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 Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WwqxB6N7fzyQxV; Sat, 31 Aug 2024 17:49:34 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 439BD1800CF; Sat, 31 Aug 2024 17:50:27 +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:27 +0800 From: Hongbo Li To: , , , , , , , , CC: , , , Subject: [PATCH -next 2/4] tun: Make use of str_disabled_enabled helper Date: Sat, 31 Aug 2024 17:58:38 +0800 Message-ID: <20240831095840.4173362-3-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240831095840.4173362-1-lihongbo22@huawei.com> References: <20240831095840.4173362-1-lihongbo22@huawei.com> 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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E44A24000D X-Stat-Signature: utjjqdcsgiint7h3ucwynuy8gst3p66z X-HE-Tag: 1725097830-149539 X-HE-Meta: U2FsdGVkX19Tq0+SfrzgzGVqyTR/i3+vr4N1eZP1HcdxNF0+Tbwcl4rEiXAKfPLeDpdggjVFpN8oeYi9W8RtjCucCAORzwuACDY1W+AFFs+dbHoLjyplPm9C02u3zS+52L2VVwJ2QecyWsZV5Ca0wM6MoQKxvFm1JW93Wr1wNKTv/b2NHK90YmULRu4WuGOMPQQAUzOrKYR23DIKyGzBd3XmOcJv22c4+AqTyp1nX25TxixSRuPU4i1khUgv35HpgFrc3PJ61JgPwHH7F72lY0cog6NEk/G5PUiJrvrR2cS2aoN0Je/+qWLyp30xzHyyPgKhfc36y+7a9Mje9cLJ5AfSxilrylZfZ9WIc3SgQxkx/fExVq+m+P8yKSgD7nr3wvnbesCddQ+jvTg2abWuVUHtUroH2JRBPkHskZmUSXB03bq8iN6Ke/5iRYT2OVOHrofkvYle15mck1zEAecTEZR4yR1yf6Dck5/hZ3lnZlGBtfVeoXOW4LQtnFY9mpif3FW2ywkFoifxmr0Ldrq5oANnysHGMs/li1OLn1rd6AHNfDMGPF1pt3r2mKPqXGlfHPXRtv7kkCgr0aTkXcpY1QN86MhpqeStkge2NE7FKxlt97nlM9+44KDbd1HrZq7YUhUtQ+szp6SQCsehnhEPAyzuJLFqX980jaKLFjHzYZ2dNw0PsIaswmfrSm06Y8ryuZgfV0Y/v0K4UQETlVl7fIKeyfZoKRiA027iJYduyY/NCw+YKJv6G/0LJbng4XJ6+dPpPBIYoQcrbbqzRYC1qAKZV/LPoc0oHSi60/Lzy4QiF38elJ4L4gFmzx+7EZ56FXm9kRn65XBnjcI/rOFaHoeBuuRsURGBls8+ZgCmcztYDzu0HiCQCY2NRjRdP/ToeI5YcL5NIBaRlO6Jg0vV96qEBuVkSus+JbFqx0RZGtP29kdXQ9Auq0ZDwMaSFj3IShbOpFmaEy6GQLSQ0bt CBZ/mpuh murAEuExy9ObdzF9eAfHx/JyKW1Fd07IHiRPT9zYMG5h62MptEV5sbbdih1/wlrT7QMSgS4oMvr0D9kPmWz3RT344cqf9XFgMwKEkkmI2GNFykj/qdpLwrwaVGwb68cYdYLKqspUzszt2k5U/YxI82jRepp5ILtNxKYJj7G4FFuwQfcSgYvNfaoERmUx13Q2yY0MEuIx+mWdROg7/5V4Uw6M5HqF9TXR+EUIXxcJi4vTdueQXtf0IeMpNHSpjYCshdblIyPHm7LLtGYA= 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: Use str_disabled_enabled() helper instead of open coding the same. Signed-off-by: Hongbo Li --- drivers/net/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 6fe5e8f7017c..29647704bda8 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -3178,7 +3178,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, /* [unimplemented] */ netif_info(tun, drv, tun->dev, "ignored: set checksum %s\n", - arg ? "disabled" : "enabled"); + str_disabled_enabled(arg)); break; case TUNSETPERSIST: From patchwork Sat Aug 31 09:58:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13786008 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 4F17CCA1018 for ; Sat, 31 Aug 2024 09:50:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CE2A88D001E; Sat, 31 Aug 2024 05:50:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C92768D0008; Sat, 31 Aug 2024 05:50:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B80ED8D001E; Sat, 31 Aug 2024 05:50:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 99C8F8D0008 for ; Sat, 31 Aug 2024 05:50:33 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4AD1F1A0AF4 for ; Sat, 31 Aug 2024 09:50:33 +0000 (UTC) X-FDA: 82512070746.28.78E3680 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf13.hostedemail.com (Postfix) with ESMTP id E7F0420019 for ; Sat, 31 Aug 2024 09:50:30 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.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=1725097786; 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=y9if3zmfeMcziZM6wufVrOqmRX3ZiZJiol82Vgq8GGs=; b=bzDTolxM2I1B4GKN1nuGLwj25g5IQYa4+Q5KkbfC4+dLlg1faKWjtCDrmTlgCtaZ1Rxe2x y39tkzVIjBJaDRKV6ZjRszvBELoIcWSNCQfKLTsi2hNs2TOe5aVkbCwIvdDGP2kwCmNsDn Hq3+7iWyHesqEqYG/oD4Q/NaSrZaVt8= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.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=1725097786; a=rsa-sha256; cv=none; b=I4hkq02PejpjcI2zgq+Hu9+fg+gOe6QDQeY6bhk/DSsx7IG5DkZOKFB0YduaAm8eokCuoZ XklqpFC/cvGNQghatOTIJ//J1K4IPNrwAu86CQuS222DGuKYNQbvM598lpuPTWYby4lab+ xhJpuD4WiJ+jPxBjFjkcChw3Uqijo24= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WwqxC0Vg7zyQxW; Sat, 31 Aug 2024 17:49:35 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 6D07D18006C; Sat, 31 Aug 2024 17:50:27 +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:27 +0800 From: Hongbo Li To: , , , , , , , , CC: , , , Subject: [PATCH -next 3/4] mm: page_alloc: Make use of str_off_on helper Date: Sat, 31 Aug 2024 17:58:39 +0800 Message-ID: <20240831095840.4173362-4-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240831095840.4173362-1-lihongbo22@huawei.com> References: <20240831095840.4173362-1-lihongbo22@huawei.com> 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-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: E7F0420019 X-Stat-Signature: 4zesx696u9j8xazthmy98imdsj3socbj X-HE-Tag: 1725097830-208056 X-HE-Meta: U2FsdGVkX1/lbgyGhV8kZAcvouqGramn++TKX1/n1gPaFVjJsrwufTPTyMcUEcNwZbKbPu/ThYRQpdh+mLEhSIAsDHWwj/w8l3ORfTBDET5vSHxAp5xKcgVv1fLUwye/aJsGd8iYUyTZAFCYK8V1vMWpqCdwEHyGYyoFcD5bnZWj6vfyRbm1QMiJGcCKBOaZqqSgaT0eNIrVTLnC5Pv/Lj08NqKIBvEC8toW2pPzWh1eseB/8Jw+So3IlpQYzzdcipfqanrYSOj7vs69L+8DDIhiGWsmqItIHOYGWdj4qoWflgFIp8xcu59U3sZGmNCYJEoqB+KvxCJ+2/PbNm/jgUUjOclY+tlT9N0rmqwJGhCV+GJ4jAk/CAFkE0OidWPOA8qq9AnA3h5soFbmaLxqfzW4mPds0wibUgoiDbogUDLukEGHchQCPLRWh3596Lhpu6W8E5uHpbLlxyvv81T1/pc7qBDiUqwjB2goesiXzIootqSV71qRSpM1g3v/8XQaLmikZnGkqfeExi7GO97p/cNiO0R3TBrQCEmSTLzDTxQjSfKeA23l5idVm2qwySy33x3au6QU4JDPpHZrnmg5LCoPFyEG69VWQ/8cJV4zgJKJ694foNj4ct0JwyN71KF2anHMVGs1B61Yh1tjJwuLaYxW9wZPOiG/c9djyEce47SBoAWjt+DfLqMql+3LVzPDEOd7bd7UFh8cckaU4O+AndRf+tL3oO9XoVCsHVfgpod1uSPp4HuJRiyKi0lzzUus/qA9rLZKflUF6/Tpan2e4vklaUod5LE+uj4HKdjx9uHXwKIFcyVNngcm+ne7zR/RsiovqtoytR0mj6dIc+O0l+Hc6reafgJLUbz9+9EmcmgxIe94KS8npzNxfgLlSAyYHEuLacZ/IMBzRF5T2JKFX7HyaqKxlucbnWkDOcEcTIc/9tTN508gavN+8ptP4cJ7Q33v53LxYpoSHOX41ee zNcrIe1A 6IXeym/CBUMApE9ML/EnQZErEljtR1qRLBUIDa6jVIb8M9cfjkzwhA7qiQHTCCBy3E6FdEHg7p/fjm+ttbPZ1jm73mSauJ7er8PX7lqUuMNTj3Uzd3K/LO35Zk+9BT+p558Eo347hr6vgHAZe2jepvIpuH3RCmOFCNnsutepCz+S+mOcW5riyNGN3Mhp8aZ256TqFFxwhXr/i08bOVK4vghIJ39WORXimVrcHP8OFzy4spz5mmN2jEBTvZnFmvhyD3JsTMZrXDm8TZ4k= 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: The helper str_off_on is introduced to reback "off/on" string literal. We can use str_off_on() helper instead of open coding the same. Signed-off-by: Hongbo Li --- mm/page_alloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 04a90dfbce09..8adda0b67253 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5517,10 +5517,9 @@ void __ref build_all_zonelists(pg_data_t *pgdat) page_group_by_mobility_disabled = 1; else page_group_by_mobility_disabled = 0; - pr_info("Built %u zonelists, mobility grouping %s. Total pages: %ld\n", nr_online_nodes, - page_group_by_mobility_disabled ? "off" : "on", + str_off_on(page_group_by_mobility_disabled), vm_total_pages); #ifdef CONFIG_NUMA pr_info("Policy zone: %s\n", zone_names[policy_zone]); From patchwork Sat Aug 31 09:58:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13786011 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 D56FFCA1018 for ; Sat, 31 Aug 2024 09:50:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B86808D0008; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 987598D0024; 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 5EB1A8D0023; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1647A8D0020 for ; Sat, 31 Aug 2024 05:50:34 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A2C45C0AB4 for ; Sat, 31 Aug 2024 09:50:33 +0000 (UTC) X-FDA: 82512070746.23.B006D00 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf26.hostedemail.com (Postfix) with ESMTP id 366CF140004 for ; Sat, 31 Aug 2024 09:50:30 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; spf=pass (imf26.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.35 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=1725097740; 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=m9NPSHcWaQsc5IMGueNrHTfHwUDvg5vR8DXdOHsWQG4=; b=LI/TFpyJPD8bVYEy+BMsLuxpMYpnBkCfLdBimEtTY0GzwXA5S67bTCHl0gl3gYTyVZWJX/ 2YahCDZxspM7ZvOyG1K8goquv1Wmdds8CX5LCT2NKA7sA1NkYMNxy/gOmLppcgcpccmLiH RAVSjVKmv9XmWbVQof825QNcN4BahhQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725097740; a=rsa-sha256; cv=none; b=fqLaXpDjSH8UIFMjKxEMLujMdNlNDKiTg2Ne+qE1ko7jeKdRyKewi7o8H1uE17fsNO4Fl5 P4LvCqJl1pEhknRybcpgciS7NilZKi3V7Sv+BkuO84z+F8QoAW832nsy6bEC/chUr6naK7 1tOGG8aep3c5YUIRNAt6PnjGBH4R2GQ= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; spf=pass (imf26.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Wwqxv6JD6z1S8Kb; Sat, 31 Aug 2024 17:50:11 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 98D901A016C; Sat, 31 Aug 2024 17:50:27 +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:27 +0800 From: Hongbo Li To: , , , , , , , , CC: , , , Subject: [PATCH net-next 4/4] net: sock: Make use of str_no_yes() helper Date: Sat, 31 Aug 2024 17:58:40 +0800 Message-ID: <20240831095840.4173362-5-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240831095840.4173362-1-lihongbo22@huawei.com> References: <20240831095840.4173362-1-lihongbo22@huawei.com> 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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 366CF140004 X-Stat-Signature: spuuiit1dmiuo749gt1cwajtj7ubqyj5 X-HE-Tag: 1725097830-808757 X-HE-Meta: U2FsdGVkX1/MhIXcvnh/H5jbsGuDCNc1U5EEB/c9CH6duO7z3NxfeHZWHLbV+KwRYr66rlnkJSO0s5uwfUd0ljV1uqzgudYU+DoLPKp6R30yi3kKPkyl8MkxCBDThH7stGpsuPwoeJaAh/Dislzh81Q0Qd9q95VVO520e/MHrAJfWniRmlw/fs9qRSGuOpWDP5S6O3zDXyz46BX/sw1OoKbTNNbTL7yoj7r5E040ctU1nhRtM/aqn1loYgnzhzBGHvW9vvLd8rbQnMpyRgdalYBjD66nJpdcgQt7oS+1kmunAMmpnnZYEG7thaZzvNmk5Gw7pRGd347OlRWHtDQLf5liwG5MM05Hqenfa2yDoIsq8Vsmp6KVVhZqyDJ0iX5GCPQLsH+v6tYUPH3bdEOsvbFTpYvjGk5RsJhNSJ00GQr27eu5cxTcMEM1s14+UPrPEtaz8hUncbd4iGkaIH5ISW8MwZSI0cbVrCv9kBwzWdSOUm9PzTn57by0235F/BGmQqzr7WGCAS29Zkd/QT764TLNgPXT8F4XXebHou808FUiTo6JaStxCE+UAEaP8MV7n/Vk0OzYVDOD71flI88p6OXVFe/Lsjv7hldjZ2iemxvm0WUKrq8geF2cjUiI9AWXj4+mo+TxVOgwEqbxjPGGp7c6naq0QJzYvrpWlWEHTey2IT5+KSmTbFwD7sxE1HGkbodKapcNq+N81Rn6a7IfnfY6twYsopkhf1CIL+zR9pwq6RKzhw9Qgf0HMUzIABOAKO99qWAA2iFjvAI+0cC0nZKbvfCA08JDeUt7IykaG9S0dNPqoBq9a+HzSAUxuk7jd4kLDWjTiaesI+QGiKjx3sGFYZ09NGL2UKvGmSkcIPgcVtjJ6W4Sip/Htu94LrkGE9rvNIso2JTJltLcaF0/Idwow6XF8n9phjW6eVAdOINdDWQ31ZPleDLZGbItGxu4EB0FlOZCjmJep3x4O3O UbdmsVbT kU+a7RtpEG0JHYRs7q4FhJMPMYJxgPKsBSGZXnAWjLbnaj1JGJhx87p2mLxnQoAE/VPzP8MJD9bVUE/3HhUIy+cGuYlzviaGrN2HoIywZvq6xk32skhaEK7vPIsUuCwHQLmqo9TeT2wAV4CtnFEJ4lbg5db7basX3izff3nOHq3ahEbQsKtxohEDFM6XSw1bGV7d2MGj+8WdLYttj+Z/B5bB4QF9QYFKB1QMPS2kGGmZUs9XAkQvANaICoC4gX65pi8/OIlcjVudTYOk= 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: The helper str_no_yes is introduced to reback "no/yes" string literal. We can use str_no_yes() helper instead of open coding the same. Signed-off-by: Hongbo Li --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 542bc5462cb5..f976bb4a402f 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -4086,7 +4086,7 @@ static void proto_seq_printf(struct seq_file *seq, struct proto *proto) sock_prot_memory_allocated(proto), sock_prot_memory_pressure(proto), proto->max_header, - proto->slab == NULL ? "no" : "yes", + str_no_yes(proto->slab == NULL), module_name(proto->owner), proto_method_implemented(proto->close), proto_method_implemented(proto->connect),