From patchwork Thu Mar 30 16:24:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13194534 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2098FC77B77 for ; Thu, 30 Mar 2023 16:28:51 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.516803.801526 (Exim 4.92) (envelope-from ) id 1phv8b-0004La-B3; Thu, 30 Mar 2023 16:28:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 516803.801526; Thu, 30 Mar 2023 16:28:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1phv8b-0004LR-7o; Thu, 30 Mar 2023 16:28:33 +0000 Received: by outflank-mailman (input) for mailman id 516803; Thu, 30 Mar 2023 16:28:31 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1phv8Z-0003qA-LA for xen-devel@lists.xenproject.org; Thu, 30 Mar 2023 16:28:31 +0000 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e829bbd8-cf17-11ed-85db-49a42c6b2330; Thu, 30 Mar 2023 18:28:30 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 09:28:28 -0700 Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 30 Mar 2023 09:28:17 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C528C14B; Thu, 30 Mar 2023 19:24:48 +0300 (EEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e829bbd8-cf17-11ed-85db-49a42c6b2330 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680193710; x=1711729710; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gIQa0UBc6rrUYtPkGDZ1t1xT6zplGxALb8OYgbohTeo=; b=BMtTgumTEElOfhQRh4w1CoFSlfi1IAEExZC2z1RKdIUvoIe6ccOxQVzV Rlksvnz+TcvSvVLgBTVVNHnv3EBmaC9Jdg26SckfEbnntjcaNkiJJkduh m4oUcxXM2199ksPs7gvzF+1LgO9qQToWjlEGN6L8oBajTJAuOKW2GgO8N bFBgi8gxJySCKoYEYvHJW0k0FHYB/J1zvzOvZ+OHAFlDGBrAbqdQ6itQ6 FlBGGA05YlYApYayjV7BP6ISso81/5cVOkvzXSErGBro1mVIKHNLLSFH9 fXvfsJRlgeuDd0n4MFFAh5vkidqwRdCSRQMSHS+pe5vQG+7X0A0wF0TNd w==; X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="427495985" X-IronPort-AV: E=Sophos;i="5.98,305,1673942400"; d="scan'208";a="427495985" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="858971548" X-IronPort-AV: E=Sophos;i="5.98,305,1673942400"; d="scan'208";a="858971548" From: Andy Shevchenko To: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , Andy Shevchenko , =?utf-8?q?Krzysztof_Wi?= =?utf-8?q?lczy=C5=84ski?= , Mika Westerberg , Michael Ellerman , Randy Dunlap , Arnd Bergmann , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Niklas Schnelle , Bjorn Helgaas , "Rafael J. Wysocki" , =?utf-8?q?Pali_Roh=C3=A1r?= , "Maciej W. Rozycki" , Juergen Gross , Dominik Brodowski , linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org Cc: Miguel Ojeda , Richard Henderson , Ivan Kokshaysky , Matt Turner , Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Thomas Bogendoerfer , Nicholas Piggin , Christophe Leroy , Anatolij Gustschin , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , "David S. Miller" , Bjorn Helgaas , Stefano Stabellini , Oleksandr Tyshchenko Subject: [PATCH v8 1/7] kernel.h: Split out COUNT_ARGS() and CONCATENATE() Date: Thu, 30 Mar 2023 19:24:28 +0300 Message-Id: <20230330162434.35055-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230330162434.35055-1-andriy.shevchenko@linux.intel.com> References: <20230330162434.35055-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 kernel.h is being used as a dump for all kinds of stuff for a long time. The COUNT_ARGS() and CONCATENATE() macros may be used in some places without need of the full kernel.h dependency train with it. Here is the attempt on cleaning it up by splitting out these macros(). Signed-off-by: Andy Shevchenko --- include/linux/args.h | 13 +++++++++++++ include/linux/kernel.h | 8 +------- 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 include/linux/args.h diff --git a/include/linux/args.h b/include/linux/args.h new file mode 100644 index 000000000000..16ef6fad8add --- /dev/null +++ b/include/linux/args.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _LINUX_ARGS_H +#define _LINUX_ARGS_H + +/* This counts to 12. Any more, it will return 13th argument. */ +#define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _n, X...) _n +#define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) + +#define __CONCAT(a, b) a ## b +#define CONCATENATE(a, b) __CONCAT(a, b) + +#endif /* _LINUX_ARGS_H */ diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 0d91e0af0125..fa675d50d7b7 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -457,13 +458,6 @@ ftrace_vprintk(const char *fmt, va_list ap) static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } #endif /* CONFIG_TRACING */ -/* This counts to 12. Any more, it will return 13th argument. */ -#define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _n, X...) _n -#define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) - -#define __CONCAT(a, b) a ## b -#define CONCATENATE(a, b) __CONCAT(a, b) - /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ #ifdef CONFIG_FTRACE_MCOUNT_RECORD # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD