From patchwork Tue Dec 8 20:19:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7802201 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 C2CE29F1C2 for ; Tue, 8 Dec 2015 20:22:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E121420462 for ; Tue, 8 Dec 2015 20:22:06 +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 0C73F20398 for ; Tue, 8 Dec 2015 20:22:06 +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 1a6Ok4-0002ME-VY; Tue, 08 Dec 2015 20:20:08 +0000 Received: from mail-by2on0077.outbound.protection.outlook.com ([207.46.100.77] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6Ojf-0001kr-Qa for linux-arm-kernel@lists.infradead.org; Tue, 08 Dec 2015 20:19:44 +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 CY1PR12MB0443.namprd12.prod.outlook.com (10.163.91.21) with Microsoft SMTP Server (TLS) id 15.1.337.19; Tue, 8 Dec 2015 20:19:21 +0000 From: Suravee Suthikulpanit To: , , , Subject: [PATCH v4 2/5] irqdomain: introduce is_fwnode_irqchip helper Date: Tue, 8 Dec 2015 12:19:02 -0800 Message-ID: <1449605945-10707-3-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1449605945-10707-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1449605945-10707-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BLUPR01CA061.prod.exchangelabs.com (25.160.23.51) To CY1PR12MB0443.namprd12.prod.outlook.com (25.163.91.21) X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0443; 2:meSfNsp89b/QvGkGFBNx33l2/7ZQUE6/fw9Dm7JHHvM1tfBR14K/w4HtjEgeEAEOrWG2Sbaq6K098+yT8JWqFhNXzz0XtLbLSnBraRzyrMbpFGFYegt+7y2kq1gnyaVfOqN8Ywi8b4/jYsF+lwF7PQ==; 3:Vl0PwPjwn40r0gmgsnVUHTPPT8XEk9CMqY8AvnF0aKnMmuZyML0DHhsaECgEpRNKLUY+iUFOEPa7fVfCQorQxrl2r18BAqaB91xZpCwTQcLppJshjIb2jUMr37Vk5zoj; 25:rxAIfmwVJNbQvScqRKKiC2U/g5sA2znCBshHPkYYaDHPQKChYemJcNHKeHtRV4umciLjEzevLv1fRL+A7ptq7JnHuMbMyqHvGuIVJi/iU4y21CeZfl9lPoiCDDCGtUbs3l/mbm39eVM34gLCMWy6gVwTCEcEL8/O10wRlSi/sb+c0YBj7IPv1VYgNGxdzDFIKUDr2e9nme23PCR/Abn5A0hgXmkZYFDun04Sfp35d0yNUL3uIpNtN/o64Fc+v7vQWGntV2pIrKHj2OuOYB+NZg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR12MB0443; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0443; 20:lHSpKKdXr7x87PO76zidHfZYhfPHS2s336L6RhZm9NWTvOlhawaGTK/YmiwSCqsS/+Z/tAFPneHaktRpo1ZKwbks0PQfRAX/MINr+n6aArWK7dcY69G1oARjhY1jtsNY+4MbA1xbPCBUIPrz34KkHDrVF0IrsOqiztyxHgWwjoDc/qewBKWYAiKwbqVhxBTnNbrq96pxCVjXNmSbeYF/ydHF7VIztkmcA022OErWpZ/Syz79ERG9lAFrMU7jPOMumu0bL4QYEY8yAMRCbzWa8xoEa/FnOUgLV9VKt6AlPUAVFJBMDzAESb0En/Yxq8Rhpc8ueo2ZeaKrEAg0HnN7LXZWvGokiwtER4PJkfQRrmNJyGwQLQ3Z407JumIG4X2ILfoMG0R+LeZWM7rwswcJpZGm5ZZFUJG882CS2kEkcqMw8de997aPu9qXWY8h6Vf0AZYlyfPDAh9QYH+WkZsW0ylLhvS3jZnymM0qxdqk2Vx+lBSV8jaey7WfcuXl/L56; 4:sD1jdPUAmZasOf1NzlU3QlvV1ML77yJ8JUAPio6FDbbkfX5CuMNsNYVSZIYXEjGUWNxkzvKG7gcyEaLoPeesqSMN1no7n9YiOhDm0miZIXG96Pl3mDNVvQ+HLBAiCYybN58ClbhERIYBBPECU1nd1/T1gmZL5McnvsWeUhBeK5jDpaORkklHtIJaDBKxMFvztCNXq3/cW2ktpjT/YT4bNKe7cfyaAH+EclMi5s2Cs5xdDrklc4q2JDtsaFfUtBjIfFYuhup+hEvSVCTaYhFoW3qDfF2iUc9nLrEcbDjkiEqiBg+mQG7FT4qKydn3DduL3cY37NXdQK/JxDujn6VPdkdBUsbZkIt870TuypjVEyeDKLayjs4WbRG6uMwOEYKlU4B5gfGqP0ZzvBq91bkH0KLg/YeT8sBoeJ6DfVMwFQ4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(520078)(3002001)(10201501046); SRVR:CY1PR12MB0443; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0443; X-Forefront-PRVS: 0784C803FD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(189002)(199003)(76176999)(3846002)(6116002)(87976001)(5003940100001)(5008740100001)(48376002)(122386002)(189998001)(77096005)(2950100001)(586003)(5004730100002)(105586002)(229853001)(1096002)(5001770100001)(106356001)(19580405001)(53416004)(36756003)(42186005)(50986999)(50226001)(19580395003)(2201001)(97736004)(86362001)(47776003)(40100003)(50466002)(66066001)(101416001)(92566002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0443; 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; CY1PR12MB0443; 23:vVI7HS02qFidCBkM/df3G1SZgzxPPi5vcOGZAq+O1?= =?us-ascii?Q?MHrjrpOAPr1ccyymaqrk+zT3kKTaj3Rf79ZsbMNGf1jZbNOFg4swSxYJdgZZ?= =?us-ascii?Q?rQ9Cn7y+eJeMv+XhCnztc9OY4W0/gn0+WLpHXymNLyeHrbBXS+WV46sdovrF?= =?us-ascii?Q?sTbdRj5VdJFaA7fZRpTH0cx71eex5cwZkz692j5MW4R0kIef9vtY+dfDrSsd?= =?us-ascii?Q?6xjIg3Ods3OuikX46o+x6uuLf9KCUUI5RALEq4QW3xUKVQxXjF8jI0TBZW6T?= =?us-ascii?Q?2LaKKOvb072K1D6zZffrdravQ6kXMagGevD4KZW4mhxNWW4Of67a89ruGaln?= =?us-ascii?Q?jzKYOM1/BuVwMlzAMclL7b1H7NzdoGHttdvoqT4ZDw8pXX+6XlGH+/ya84fC?= =?us-ascii?Q?CkzpFK1VYvljILv1KpM8GbGhWtxC/5tYNEx16UX3UxLDR6+X/jrTjvhpRFp6?= =?us-ascii?Q?fqKV4omp9nlve0KnQnThX1n1K63oRHOhj010IBEKrD/mRjlgOfbCRBrKapi/?= =?us-ascii?Q?eP0EoJVPKPW+/wb9bg3tNfkZl+Qd2X5s7MfaUexlXj7MYthEa9+H1tgBD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F/vml/0GiA8lGbX33OlftFWJ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2015 20:19:21.2945 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151208_121943_954829_38534EF3 X-CRM114-Status: GOOD ( 10.61 ) 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 --- 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 d5e5c5b..4950a71 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);