Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2166733rdb; Mon, 20 Nov 2023 04:09:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdwYaEhgyxIciCoOC9wL2m+v/vXz1B4hQmpGB9PdykRVPBX0ECILsFL6+4Bvo7f6oxIW6u X-Received: by 2002:a17:902:c40c:b0:1cc:22db:cf3d with SMTP id k12-20020a170902c40c00b001cc22dbcf3dmr20227032plk.15.1700482177841; Mon, 20 Nov 2023 04:09:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700482177; cv=none; d=google.com; s=arc-20160816; b=NYJmyjH9POA5u8DubRm4wVB2CMIwzWR0b2T7t+Co29ojbH/KUeMU5Tri6fBdATkFV5 T5TSjuzw9sR0Umf+yVWU2bPN7lfQBJAcVb01vHwwU1QEa9t20CRuc5eb4RzotE9TDIG5 JSWh2uRynnlDNX6m/I/ZUVDh/kReL7UQnfruWR0mSerVLMgeKTIOBqlCdgsozYlM2MEw f06Wojlz/JvbDLaWJdz2F9oVsb8VFL7OLnTPwWMnY3evAM0yqyO5fRishItL7NZrEe9z sIMypQdpCYlGmyLn+Moa5YuEVysehsDzwuSFfBiiw9tUFNPJf3hCRTZyPtrsf7YKAvdL XMxQ== 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=QgfjRORpP8S4D1OK8z9vN+j/d/Nl3EXZi2RkAS7KJywkAxoD5zu1vSnL/fNICBJGdy zKXoKgITIRr+Z/Xns4XQo5X04TXJawDNe8zrQOU6LxRmoXWQ3oRVeSzBiiOZEsm5jv4k 2SfbsgDFx8dc4k4FSKvywr5qt8vSi9r392zY7SlprO+kCpcONeMMWfDFDSlDYDcc0bMz EYfxsY39GdbNNiH67tWkc4BZf+Ke5KogpgOO6fgjJf/hBj/Ep+T/sGEjqi/GfYK3I7PI Nu6bEjU1TMq2IWGoHzI3BX9iqdRr5w9k7bd+EiiGyJFZJSe8BO1An+OZu7cxug+3wB0b G7ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B1iz5Ukj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id z128-20020a636586000000b005b95e508b6bsi7976994pgb.58.2023.11.20.04.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 04:09:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B1iz5Ukj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id BB98680417F3; Mon, 20 Nov 2023 04:09:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233422AbjKTMJI (ORCPT + 99 others); Mon, 20 Nov 2023 07:09:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233368AbjKTMJH (ORCPT ); Mon, 20 Nov 2023 07:09:07 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EEBEB8; Mon, 20 Nov 2023 04:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700482144; x=1732018144; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=vkKEZYR1JQ2LvJYNE9fzcULsL9BK72aBp+vTKNFQKvk=; b=B1iz5UkjXDwEa8/UYKwt1OymeZS/ABVIOAby1SDCXxcEynrwyownkitZ vgdJEkXBhylfj5NLMfnQ7NS+B+TzZ0xk6/9hnjVLAZe5elZ9xAYqLpC6T ug2zzoLBulTiDemdnA4PTOUCwf9vh/UM44DrcfA5xP04Dej/Ls1A/PHET QG+sbymJFBe+zic379ofxHJQpslT+YKVz2ehKl65dhCUUn6P/wDk8jkwa Gxy0LtRDH7zpvlOK5mPEBwXVHMpF/zea42eO2PwG5Y86Q/Cyyjxf5B/En UypVouAXGIxO+FmboiG2CaytrT0ijHsXAFRzhFrJTgbHX7zAdFGEdKYU0 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10899"; a="394455651" X-IronPort-AV: E=Sophos;i="6.04,213,1695711600"; d="scan'208";a="394455651" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 04:08:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10899"; a="769878583" X-IronPort-AV: E=Sophos;i="6.04,213,1695711600"; d="scan'208";a="769878583" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga007.fm.intel.com with ESMTP; 20 Nov 2023 04:08:50 -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 v1 1/6] compiler.h: Introduce helpers for identifying array and pointer types Date: Mon, 20 Nov 2023 17:38:32 +0530 Message-Id: <20231120120837.3002-2-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231120120837.3002-1-raag.jadav@intel.com> References: <20231120120837.3002-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 20 Nov 2023 04:09:29 -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