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: "Suthikulpanit, Suravee" X-Patchwork-Id: 57901 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp253550lbb; Tue, 8 Dec 2015 12:19:33 -0800 (PST) X-Received: by 10.98.16.71 with SMTP id y68mr7748480pfi.108.1449605973522; Tue, 08 Dec 2015 12:19:33 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fb3si7178910pab.106.2015.12.08.12.19.32; Tue, 08 Dec 2015 12:19:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752689AbbLHUT3 (ORCPT + 28 others); Tue, 8 Dec 2015 15:19:29 -0500 Received: from mail-by2on0055.outbound.protection.outlook.com ([207.46.100.55]:2304 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752456AbbLHUTZ (ORCPT ); Tue, 8 Dec 2015 15:19:25 -0500 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: , , , CC: Lorenzo Pieralisi , Will Deacon , Catalin Marinas , , , , , , , , Suravee Suthikulpanit 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+Q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UAi8B5WFS1dKPydUI8ALXnvAE1PpDF/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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ 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);