From patchwork Wed Dec 9 01:48:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7803261 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0C2DE9F349 for ; Wed, 9 Dec 2015 01:51:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2908320453 for ; Wed, 9 Dec 2015 01:50:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 35A73203FB for ; Wed, 9 Dec 2015 01:50:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6TsQ-0004O0-LL; Wed, 09 Dec 2015 01:49:06 +0000 Received: from mail-by2on0075.outbound.protection.outlook.com ([207.46.100.75] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6Ts5-0004HX-VK for linux-arm-kernel@lists.infradead.org; Wed, 09 Dec 2015 01:48:47 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; Received: from ssuthiku-fedora-lt.amd.com (165.204.77.1) by BY1PR12MB0437.namprd12.prod.outlook.com (10.162.147.139) with Microsoft SMTP Server (TLS) id 15.1.337.19; Wed, 9 Dec 2015 01:48:24 +0000 From: Suravee Suthikulpanit To: , , , Subject: [PATCH v5 2/5] irqdomain: introduce is_fwnode_irqchip helper Date: Tue, 8 Dec 2015 17:48:03 -0800 Message-ID: <1449625686-5594-3-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1449625686-5594-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1449625686-5594-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BLUPR05CA0068.namprd05.prod.outlook.com (10.141.20.38) To BY1PR12MB0437.namprd12.prod.outlook.com (25.162.147.139) X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0437; 2:6v5mo6DchcNpug1+HqUT3hAgg6bdpWO385u1lFl9UepYHq6oLMguFTues8qZQ8ISH2gLUM4NNRgmZfuWFOAQ0CuNZuYy2z5k5nKzBYp2krpZl4psgbY5zuVV32Bgka6/4YDkLadkQFXrMYmWeU03Wg==; 3:RD+c9Dp7XJmT4AEXGxZYcVLgG9AM11xNGZkL4JkbHMkOlhroD4BE80bJulbWhMvmLIEbmkP5ywGFvi2sxDsP9SWWUHxoAV3/QNYZUurw0x8JBXPXTcsZh0KSvv1Jv6TB; 25:S1mqLJP1pW0RCrRdiktisX/0C3Gylxuci0HeK8dRX8UeQhmjjAYOU+j9zO21PCrUqEiFaKgCagE+m6szdWDnK3lOM5mOFdCstuv4ka5grWdYtI1dMDhTmClHHr/uqKdR9cJJb0MO/dFM/4ff88RekX86e2MGtD1yGZ+lLkse7XQVIu06CZgVct6E0ol7jONM1tMcckWMpYgtxB4EpFRZb0nmNOX/E2EXAXQCh09iPwZNjSCNgKNpSlItTvX+f1hxpPYRu08llkj5uI6H1vZJVQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR12MB0437; X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0437; 20:9lhlS8Q+EEvFFezdJG8Nif+jL/dJlIyGYH9SWnfJEoroZCcFpQhGJGV97eCjuyttZHPJiUM8HH6vOaoKnRu9TuLKxX3jwdUX258EYFibZuqcuBO5KRvMHNNdQZ8PT4cUAkiMlkYmFDPx3orxFGaZHoLFE+MR/hhfTF72BhVLv2t8NphMFPCaLlckT1XLKlcuJUTCjz1jQ8HElK8m0lzH9wngmr1heG08GnBcGbaN+m5roL1eBOje7+ojS56CclfGuoY8uIJFLmE1iaDNt+kJAi0zb47cPpqtMjXo75U1zVuWXffA0ENQVpOi6L5e1SduIx5Sumyy8tO1vGfziNj2yLc3unaRgjix1YxnBX40LqsFTp72DibWhlmuz3RR3ciXlL9snRw0FAfB9x9c0PstP55pXuFxaVkvBGwCayXc3sJW7SVEpagpX5ObbqeE2du01NpNl5fwiVRDM4Ui6HGtYbHoWD17kyDaUVmhtK/EubQfr276OTnds7LgPK+gr1Y5; 4:qnSZBq6tTBfg0ndTgfdx3MJaXJi4cpbw74Tk30SOPFA9v4/lT8Rddvj/y9VoBomsFrMCcNjBA2M2K4XjnAP7WIigwl8VPi/rm6REt2UsCtNDSV5+9fWV7zB2jtuGPvB3QuW1AaCd6cN5kxij9JClRUn/rXN53WvlUkWbgRCN1P+RZgpOLJvF2sF+j/qvaLZlRbmWr3jBk1rTdXDJeyRl/Ey3WDQU6pCTH0moDIIKMMRrfqSBzStKT2tgNRBnhNkrVhopMi31vS0u6eQdPTg/MbQIQ2yFMMZAPOXPuYr4UqVTlb1ZEFk8G3Pg7J9xwawFVUJ/SqhIWrxDTemKmOXbo0dlG0e5QF9ngGbXn7zpnivllTCR2Eir6vC3YG1j8qNBIx1R2hGN9t/QCitNszxAjWiHP3MWicBktDH7LReSO4s= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046); SRVR:BY1PR12MB0437; BCL:0; PCL:0; RULEID:; SRVR:BY1PR12MB0437; X-Forefront-PRVS: 0785459C39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(189002)(199003)(36756003)(77096005)(2950100001)(86362001)(229853001)(92566002)(101416001)(53416004)(122386002)(97736004)(2201001)(42186005)(87976001)(5001770100001)(19580405001)(5004730100002)(50226001)(48376002)(19580395003)(1096002)(47776003)(189998001)(50986999)(66066001)(5003940100001)(106356001)(5008740100001)(6116002)(50466002)(3846002)(586003)(76176999)(105586002)(40100003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR12MB0437; H:ssuthiku-fedora-lt.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR12MB0437; 23:2HLKp2NVBmjxUWFwzWWK0XKZWdY5yWFwLNA0e/Qcu?= =?us-ascii?Q?E0BNGg/VH9HnpE7/sB6vEvc/6wwY7uqIcKn4oU8VLnXC0rGxI0GQarMDMlcc?= =?us-ascii?Q?RByDqWhcIryGD8AW9P7FxFKYAPm2/sNuYyiIeuhELVxS0nSaDvlWVLeWFBXF?= =?us-ascii?Q?PDluA33DLhWPpu+0V5FDMwj9MPGBuvvktV733sARkozuqGm7lBHGgx792dM4?= =?us-ascii?Q?+I0B+QuDb3zcB20F6SJolr98ldbOceyn+1pER4lAfQiy7FcMmMd5uVpiNPVf?= =?us-ascii?Q?5sHov//CchR6AD+bFRg9qj6v++eIIg94pfoWuuVJm2fQxwbSL1pp2rCIXuUT?= =?us-ascii?Q?52HMaKK4SkHYyWcpVQ5vZmRWOaDEFPsf6SKa8nGs6Oudg0kMSF7a7Hcj7YH6?= =?us-ascii?Q?/NnDIK8g7woosBM2UwTCScIfBKY3BCQeY8aBIkp0v+mcNIHinirvulzW8L+k?= =?us-ascii?Q?N8GzptDanNWY3Wo1vwgK/KFmXZXj8akgPWDkdXwSp+1Tfu6/IJUeTgiNzEQ7?= =?us-ascii?Q?FhqJOFgNIfR4zRsmnpbxEvbuKPNYlhBHXsDf4Rq7JjSpcED1369xUP6N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JDlgUdCJ6MswbtBVXfLiAgUEQAPoCBARBbdEfgqK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2015 01:48:24.4285 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR12MB0437 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151208_174846_073945_B20694A1 X-CRM114-Status: GOOD ( 10.92 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , graeme.gregory@linaro.org, Catalin Marinas , dhdang@apm.com, Will Deacon , linux-kernel@vger.kernel.org, tomasz.nowicki@linaro.org, linux-acpi@vger.kernel.org, hanjun.guo@linaro.org, Suravee Suthikulpanit , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since there will be several places checking if fwnode.type is equal FWNODE_IRQCHIP, this patch adds a convenient function for this purpose. Signed-off-by: Suravee Suthikulpanit Acked-by: Marc Zyngier --- drivers/irqchip/irq-gic.c | 2 +- include/linux/irqdomain.h | 5 +++++ kernel/irq/irqdomain.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index abf2ffa..fcd327f 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c @@ -972,7 +972,7 @@ static int gic_irq_domain_translate(struct irq_domain *d, return 0; } - if (fwspec->fwnode->type == FWNODE_IRQCHIP) { + if (is_fwnode_irqchip(fwspec->fwnode)) { if(fwspec->param_count != 2) return -EINVAL; diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index a06feda..d72fabc 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -211,6 +211,11 @@ static inline struct fwnode_handle *of_node_to_fwnode(struct device_node *node) return node ? &node->fwnode : NULL; } +static inline bool is_fwnode_irqchip(struct fwnode_handle *fwnode) +{ + return fwnode && fwnode->type == FWNODE_IRQCHIP; +} + static inline struct irq_domain *irq_find_matching_host(struct device_node *node, enum irq_domain_bus_token bus_token) { diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 22aa961..7f34d98 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -70,7 +70,7 @@ void irq_domain_free_fwnode(struct fwnode_handle *fwnode) { struct irqchip_fwid *fwid; - if (WARN_ON(fwnode->type != FWNODE_IRQCHIP)) + if (WARN_ON(!is_fwnode_irqchip(fwnode))) return; fwid = container_of(fwnode, struct irqchip_fwid, fwnode);