From patchwork Thu Dec 10 16:55:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7820021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 255A3BEEE1 for ; Thu, 10 Dec 2015 16:58:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B40320532 for ; Thu, 10 Dec 2015 16:58:39 +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 664A7205B4 for ; Thu, 10 Dec 2015 16:58:38 +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 1a74Wc-0003vl-1l; Thu, 10 Dec 2015 16:57:02 +0000 Received: from mail-bn1bon0072.outbound.protection.outlook.com ([157.56.111.72] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a74Vu-00033C-LC for linux-arm-kernel@lists.infradead.org; Thu, 10 Dec 2015 16:56:21 +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 BLUPR12MB0433.namprd12.prod.outlook.com (10.162.92.139) with Microsoft SMTP Server (TLS) id 15.1.355.16; Thu, 10 Dec 2015 16:55:53 +0000 From: Suravee Suthikulpanit To: , , , , Subject: [PATCH v7 2/4] irqdomain: introduce is_fwnode_irqchip helper Date: Thu, 10 Dec 2015 08:55:28 -0800 Message-ID: <1449766530-16935-3-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1449766530-16935-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1449766530-16935-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY1PR14CA0031.namprd14.prod.outlook.com (25.163.13.169) To BLUPR12MB0433.namprd12.prod.outlook.com (25.162.92.139) X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 2:mK/Fzgit1A4ng7HnV5dBC+3XMMnBq7kHgEEgIbq/vRJ/Si0EXFvANMQNDorK5MUaOkcebmmoXrRRu+59wlNdERdSmA8j75eP8DwtKTCopgZCRp+ftAqJcgfCKArLUUqgiM520do/y02YZ5eoa1gaJw==; 3:1ELG6NaSKkZNTQisnrEaB6al3K5easAKbnBkgYs0od7sd3QOg/hahn17GqR2WW2S17Vk+dl7KjeLXEfc97MsvYHez78ZD6LpdFlLiq9WAG7/fclfUtpcoW4qNZQaZ5zD; 25:G22xMUQodXZbl5jg9cL9X9v3oRsRtxuKlGcSJhCOYpDElzMzNKj+o6iC8lk/913Hx3h2b8gJ6PLndxmJHtxlOB78ssH/vOS/mE9Nsqvgs0CR0INFAU20A8lsN6Wtqz1snB5HuZzBDvTMl+Po74fGanMA0XrmmCbRfZd3hu1x/4XGb0ulB3xjXKpC1iEIyMW3AdYUpl2Gu38jT4661QPF5MjcCUpgmgE+ohPvWixOeGqodUScC+VlpJdVbXucM/UEDpoA+fejFjszW7u+1FqwAg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0433; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 20:u/udDzU0PktJxup4bET64EowmYrAOEvz0e4t3jdjotSFuJSMyDpzli2REKQKdB0fSMTCvR+SUBimPEv7PTvMTZf6fjCqLQVTjjyX+SLakluPIjqruM/kWgnFOh0KeN4/TqEpheTUV9DQkI0bb778Js9yGN0QAdxUQryY5VEC+GaLeWmDgsdN3ItswbAIP+v9YATCY8F0RriqaW29yceUGlLjBvNG1RmFfWmmdXDpg7qKFbDlfx8Y+NEXSpl+dxbdzdbKWVfIUPCRsHPsPbx2moNbU1Yms+p4+UDoLU8Nd0QBgpsSSOw7P1iLBsQXGtcQDRIPx6769XKauh7rVN0TM7vMQJljpMXYtWMEUww5ER/1Uc0YsVWGk1YmTlZF2uIgmzdRR1olkcUbEZUPTXU2lLSSjQ6EhBqBsEymXaqPuNb4QDtw6MwT2pV6bZuYeToV8cdhuqejkmKzH++Go8DmZwiAqlfcYwwoJWfihAXoJO9ETNBP8VWaX4XobhgA9lLb X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(10201501046)(3002001); SRVR:BLUPR12MB0433; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0433; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 4:gCTYoW+zNBx1rATSk58J8Oqa67P/9mne+bX+HxUETfF7pfNI8ocgTszpiKYmMU/29+6JiP1Z9UF7DlUjYesg5zvlkAzHd/D4E6hl37+2o5zX5q13Wm142z5ok1MGaNVsNuyRsnES7oIaXf7wWQMH8l4su2V7JrGbsHdU7BbuQf3xdBZgK6UrDq/ZlZS/J0FFoMCEsonMhLZnU84iZAfcpEZCL+s6FnpsTdgje8BW33RqpvWiDobYWzd3tcZNy+u/wwiu2k4MpxCUWTO6tM0f3gVG/2WjuM99FchqF+S/9XLwt0kWojD/ruhfjs6CkrLv7iDHmb6lm5K/rrALaXkXWvkK+/OyZw1KhtdQyCgvFGtbOz+U9GlCjWt/N+8atSFQpd608QtnHU9C6zod5Gq4O0oeZ0uQJurNU96D7S9EaLscV60pPfWkKP93zifj7ctJjpmld8kKFmUbpfgLO/Cmmg== X-Forefront-PRVS: 078693968A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(97736004)(50226001)(122386002)(5001770100001)(42186005)(229853001)(36756003)(106356001)(47776003)(2201001)(66066001)(5004730100002)(105586002)(53416004)(86362001)(5003940100001)(189998001)(5008740100001)(76176999)(586003)(101416001)(50986999)(50466002)(40100003)(3846002)(1096002)(2950100001)(77096005)(48376002)(6116002)(87976001)(19580395003)(19580405001)(92566002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0433; H:ssuthiku-fedora-lt.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BLUPR12MB0433; 23:gdKDRIOnjl+6IbyIOSUJe4T3XtAiTCpaGK/VVWzRA?= =?us-ascii?Q?yCJVWsvWmnPYs8bQexzBzxPo8v/ScqY20mafrutIottyVQJ/9d/dSiKOdp4r?= =?us-ascii?Q?EYV2O8tBOnro3CfpPIe4ZyezjKVltVSMzkiz+E+gVH1AFiwwoP0rFaVytqEs?= =?us-ascii?Q?YePT6r0vhrvugCLv4tdJ2hiPeHuBY8mizAfpPncPkwABT6NvTExKd6JNCliL?= =?us-ascii?Q?zlWmScW5gGupckYLg2BnUwk/I1QOoy6mvBZ3WyTyb9hb8flxFRq/qXp8DsHO?= =?us-ascii?Q?HHiY99nAY7lFMuP2cNaqIfiAyTYApvP4EzrWaBh4TYYsZ/s9ZjEOpI2hhFDT?= =?us-ascii?Q?iLN98qihqPa5xaAQOqiY/xq1DRPZwRtODtZh8VzvFqT5zYVOH6+BwAbIj+2H?= =?us-ascii?Q?RiO73Ak5XT+9Dn/qftUPvIfAGBmEE7nrrdX9Hqb9/EsJfNOQo6NPyFM6ErZi?= =?us-ascii?Q?Vf5jJ7MiLSWOl9V8Y0Ykp48dC7+7dMN+uYjc1RYui+D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3tyRI+XAzegSjraPWKCBuPE245k86oXA87TACwgw8+0FGYKAoQAdOj3Fllji6jbt/PPKdrcQ2LyFToWn9KXfc+D6v5M5mdJoIH3eeHQo67Ye2lia X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2015 16:55:53.4843 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0433 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151210_085618_890265_53E597F8 X-CRM114-Status: UNSURE ( 9.83 ) X-CRM114-Notice: Please train this message. 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-pci@vger.kernel.org, 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. Acked-by: Marc Zyngier 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 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);