Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp283748rdf; Tue, 21 Nov 2023 02:39:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUoieVEXt6Ot1L6vsi6KfJVAEJQr801nAsV7c9cJ7MqXcOYRQfTRufcJk7BdtUr3zcm5Qu X-Received: by 2002:a05:6808:178c:b0:3ae:50f7:e3a4 with SMTP id bg12-20020a056808178c00b003ae50f7e3a4mr14671670oib.22.1700563175618; Tue, 21 Nov 2023 02:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700563175; cv=none; d=google.com; s=arc-20160816; b=0t4KpTX3hhg30pzX7/n6GuMFtUjtCmNyjURd8RMaAx+TD6Z5WD+1WK8lCk02klcwhx gbxtO3Km8D0P6fpIughoJsp6BwsEBrd14nRYV+JkTmHz89la1sWPauv+M44w4gKMwqTw O3WPpF2Gc+dkIe929mKh7suCMEScDyZ8kj0RNDiH0rxI7iGimcM3ovi5ZEaaOfZMyqUx 5GC0zleodVTo41Js+L6x52kc809+oVZRipMPc+USb1rZ9h8GmkxSbgs9kkE/0pgwzN2Q y7z9LYVDqNGTGkZhbAujvldNYrmYws6Z5kOexG9f1oOk8BrJ7+XIW7gY9a1rzAxU2HgX KbxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=UYuaGZUjxfzdAuLhB5OcrH7ivs9adYa42PE9cf+S7zQ=; fh=LrjGCQr9k+7CYyd6XEdJgJkCFIUW/cPwqK3zW8PbdHI=; b=qDwxtllONj6vPQG9L9sHCD8ywVkXXu4CTFNcwHy5Iy+pVKRw9nqp4KVhPZc3LdTI1U Sm/RjPOEnXud4LvzF7Ij01/rsy6l8x/UCOL3+024s197Y34gIIrKDLhTUsnzyFwN1HMI R9ooyQglOg0XyUl9bB7QNItCo6UkL5LyKeje8HkDsm9Xywjl71ywc35o7J/1L3kGk96I 2SWcVN0UgEEuoTMTx2qfHzyluL3mT+FUtMQvXcvw42krK3tfM5eEy1Zysyn+aZBlU9PK j6c+qXjY3AC12HSMdsGDFGgONP2tXc6vppph3wiar4n3x1mW/9Qy5ytvwOOpQ7Fj1Ao5 iqrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=V0ATkxLA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 194-20020a6300cb000000b005b8f38f9976si10040543pga.765.2023.11.21.02.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:39:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=V0ATkxLA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A37DC8044398; Tue, 21 Nov 2023 02:39:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233819AbjKUKit (ORCPT + 99 others); Tue, 21 Nov 2023 05:38:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233815AbjKUKip (ORCPT ); Tue, 21 Nov 2023 05:38:45 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D9FF12A; Tue, 21 Nov 2023 02:38:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700563122; x=1732099122; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=vkKEZYR1JQ2LvJYNE9fzcULsL9BK72aBp+vTKNFQKvk=; b=V0ATkxLAX2zb5epvwIRWvnnIjc7K4gP1JADnDtvS9t7ZJ/28zKIY+boV Qx8qVfTtmeYJtA49bBwArz1yXAaiHOgwxsKTuRvGW5IeSCBB1TNlyKToI fJUDeraEm2hV9mZZ8IoY0gDsxdTVICfoS0S8H8OCqlEt/uLkLk1rFWkYl gbhRXGxXV20s/BfQvvSdm8AIehMSuQFqJT3CbgIrSb2BnrAxql98vlHQ8 y0zgT7S3NbHklZJzJnhF5QHbt8ejAdTSVm/oRn3cBXEidMIRz3HPfHw5g KTQnDECW6GJaik9bfczUU0Emhuyfxg7dQ2lV6gZlnjF6JYRdHz6k2F+py A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="371986859" X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="371986859" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 02:38:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="14871920" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmviesa001.fm.intel.com with ESMTP; 21 Nov 2023 02:38:38 -0800 From: Raag Jadav To: mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, rafael@kernel.org, lenb@kernel.org, robert.moore@intel.com, ardb@kernel.org, will@kernel.org, mark.rutland@arm.com Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, acpica-devel@lists.linuxfoundation.org, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mallikarjunappa.sangannavar@intel.com, bala.senthil@intel.com, Raag Jadav Subject: [PATCH v2 1/6] compiler.h: Introduce helpers for identifying array and pointer types Date: Tue, 21 Nov 2023 16:08:24 +0530 Message-Id: <20231121103829.10027-2-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231121103829.10027-1-raag.jadav@intel.com> References: <20231121103829.10027-1-raag.jadav@intel.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 02:39:32 -0800 (PST) Introduce is_array_type() and is_pointer_type() helpers, which compare the data type of provided argument against the enumeration values defined in typeclass.h using __builtin_classify_type() function and identify array and pointer types respectively. Signed-off-by: Raag Jadav --- include/linux/compiler.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index bb1339c7057b..b4f656002c0f 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -242,6 +242,11 @@ static inline void *offset_to_ptr(const int *off) #define is_signed_type(type) (((type)(-1)) < (__force type)1) #define is_unsigned_type(type) (!is_signed_type(type)) +/* Classify data type based on enum values in typeclass.h */ +#define is_array_type(x) (__builtin_classify_type(x) == 14) +#define is_pointer_type(x) (__builtin_classify_type(x) == 5) +#define is_array_or_pointer_type(x) (is_array_type(x) || is_pointer_type(x)) + /* * This is needed in functions which generate the stack canary, see * arch/x86/kernel/smpboot.c::start_secondary() for an example. -- 2.17.1