From patchwork Mon Jun 1 08:05:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 6518651 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 663E99F1CC for ; Mon, 1 Jun 2015 08:12:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6149C205EE for ; Mon, 1 Jun 2015 08:12:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 508FE204EC for ; Mon, 1 Jun 2015 08:12:28 +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 1YzKnl-0001fz-5L; Mon, 01 Jun 2015 08:10:29 +0000 Received: from mga03.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YzKne-0000Hv-U3 for linux-arm-kernel@lists.infradead.org; Mon, 01 Jun 2015 08:10:23 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 01 Jun 2015 01:09:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,531,1427785200"; d="scan'208";a="734801532" Received: from gerry-dev.bj.intel.com ([10.238.158.61]) by fmsmga002.fm.intel.com with ESMTP; 01 Jun 2015 01:09:35 -0700 From: Jiang Liu To: Thomas Gleixner , Bjorn Helgaas , Benjamin Herrenschmidt , Ingo Molnar , "H. Peter Anvin" , Randy Dunlap , Yinghai Lu , Borislav Petkov , Tony Luck , Fenghua Yu , Ralf Baechle , Linus Walleij , Alexandre Courbot , Michal Simek , =?UTF-8?q?S=C3=B6ren=20Brinkmann?= , James Hogan , Jason Cooper , Jiang Liu , Manuel Lauss , Marc Zyngier Subject: [Patch v3 35/36] genirq: Pass irq_data to helper function __irq_set_chip_handler_name_locked() Date: Mon, 1 Jun 2015 16:05:44 +0800 Message-Id: <1433145945-789-36-git-send-email-jiang.liu@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1433145945-789-1-git-send-email-jiang.liu@linux.intel.com> References: <1433145945-789-1-git-send-email-jiang.liu@linux.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150601_011023_116333_1357EE5A X-CRM114-Status: GOOD ( 15.71 ) X-Spam-Score: -5.0 (-----) Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, Konrad Rzeszutek Wilk , linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 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=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 For most cases, callers pass irq_data->irq to helper function __irq_set_chip_handler_name_locked() and __irq_set_chip_handler_name_locked() looks up irq_data again by calling irq_get_irq_data(irq_data->irq). So pass irq_data directly instead of irq_data->irq to __irq_set_chip_handler_name_locked(). This also helps to better support hierarchy irqdomain in irq core. Signed-off-by: Jiang Liu Acked-by: Ralf Baechle --- arch/ia64/kernel/iosapic.c | 6 +++--- arch/mips/alchemy/common/irq.c | 4 ++-- drivers/gpio/gpio-zynq.c | 9 ++++----- drivers/irqchip/irq-metag-ext.c | 5 ++--- drivers/irqchip/irq-mips-gic.c | 11 ++++------- include/linux/irqdesc.h | 7 +++---- 6 files changed, 18 insertions(+), 24 deletions(-) diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c index 4d2698d43c39..317993e92cba 100644 --- a/arch/ia64/kernel/iosapic.c +++ b/arch/ia64/kernel/iosapic.c @@ -610,9 +610,9 @@ register_intr (unsigned int gsi, int irq, unsigned char delivery, chip->name, irq_type->name); chip = irq_type; } - __irq_set_chip_handler_name_locked(irq, chip, trigger == IOSAPIC_EDGE ? - handle_edge_irq : handle_level_irq, - NULL); + __irq_set_chip_handler_name_locked(irq_get_irq_data(irq), chip, + trigger == IOSAPIC_EDGE ? handle_edge_irq : handle_level_irq, + NULL); return 0; } diff --git a/arch/mips/alchemy/common/irq.c b/arch/mips/alchemy/common/irq.c index 6cb60abfdcc9..026c4eed37d5 100644 --- a/arch/mips/alchemy/common/irq.c +++ b/arch/mips/alchemy/common/irq.c @@ -491,7 +491,7 @@ static int au1x_ic_settype(struct irq_data *d, unsigned int flow_type) default: ret = -EINVAL; } - __irq_set_chip_handler_name_locked(d->irq, chip, handler, name); + __irq_set_chip_handler_name_locked(d, chip, handler, name); wmb(); @@ -703,7 +703,7 @@ static int au1300_gpic_settype(struct irq_data *d, unsigned int type) return -EINVAL; } - __irq_set_chip_handler_name_locked(d->irq, &au1300_gpic, hdl, name); + __irq_set_chip_handler_name_locked(d, &au1300_gpic, hdl, name); au1300_gpic_chgcfg(d->irq - ALCHEMY_GPIC_INT_BASE, GPIC_CFG_IC_MASK, s); diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c index 184c4b1b2558..aea6075e5b2e 100644 --- a/drivers/gpio/gpio-zynq.c +++ b/drivers/gpio/gpio-zynq.c @@ -422,13 +422,12 @@ static int zynq_gpio_set_irq_type(struct irq_data *irq_data, unsigned int type) writel_relaxed(int_any, gpio->base_addr + ZYNQ_GPIO_INTANY_OFFSET(bank_num)); - if (type & IRQ_TYPE_LEVEL_MASK) { - __irq_set_chip_handler_name_locked(irq_data->irq, + if (type & IRQ_TYPE_LEVEL_MASK) + __irq_set_chip_handler_name_locked(irq_data, &zynq_gpio_level_irqchip, handle_fasteoi_irq, NULL); - } else { - __irq_set_chip_handler_name_locked(irq_data->irq, + else + __irq_set_chip_handler_name_locked(irq_data, &zynq_gpio_edge_irqchip, handle_level_irq, NULL); - } return 0; } diff --git a/drivers/irqchip/irq-metag-ext.c b/drivers/irqchip/irq-metag-ext.c index 2cb474ad8809..52e501d8c8f0 100644 --- a/drivers/irqchip/irq-metag-ext.c +++ b/drivers/irqchip/irq-metag-ext.c @@ -404,7 +404,6 @@ static int meta_intc_irq_set_type(struct irq_data *data, unsigned int flow_type) #ifdef CONFIG_METAG_SUSPEND_MEM struct meta_intc_priv *priv = &meta_intc_priv; #endif - unsigned int irq = data->irq; irq_hw_number_t hw = data->hwirq; unsigned int bit = 1 << meta_intc_offset(hw); void __iomem *level_addr = meta_intc_level_addr(hw); @@ -413,10 +412,10 @@ static int meta_intc_irq_set_type(struct irq_data *data, unsigned int flow_type) /* update the chip/handler */ if (flow_type & IRQ_TYPE_LEVEL_MASK) - __irq_set_chip_handler_name_locked(irq, &meta_intc_level_chip, + __irq_set_chip_handler_name_locked(data, &meta_intc_level_chip, handle_level_irq, NULL); else - __irq_set_chip_handler_name_locked(irq, &meta_intc_edge_chip, + __irq_set_chip_handler_name_locked(data, &meta_intc_edge_chip, handle_edge_irq, NULL); /* and clear/set the bit in HWLEVELEXT */ diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index 09257c301bd2..fb2e64b1f414 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -365,15 +365,12 @@ static int gic_set_type(struct irq_data *d, unsigned int type) break; } - if (is_edge) { - __irq_set_chip_handler_name_locked(d->irq, - &gic_edge_irq_controller, + if (is_edge) + __irq_set_chip_handler_name_locked(d, &gic_edge_irq_controller, handle_edge_irq, NULL); - } else { - __irq_set_chip_handler_name_locked(d->irq, - &gic_level_irq_controller, + else + __irq_set_chip_handler_name_locked(d, &gic_level_irq_controller, handle_level_irq, NULL); - } spin_unlock_irqrestore(&gic_lock, flags); return 0; diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index 41544024f464..4dfa46b99a14 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h @@ -177,15 +177,14 @@ static inline void __irq_set_handler_locked(unsigned int irq, /* caller has locked the irq_desc and both params are valid */ static inline void -__irq_set_chip_handler_name_locked(unsigned int irq, struct irq_chip *chip, +__irq_set_chip_handler_name_locked(struct irq_data *data, struct irq_chip *chip, irq_flow_handler_t handler, const char *name) { - struct irq_desc *desc; + struct irq_desc *desc = irq_data_to_desc(data); - desc = irq_to_desc(irq); - irq_desc_get_irq_data(desc)->chip = chip; desc->handle_irq = handler; desc->name = name; + data->chip = chip; } static inline int irq_balancing_disabled(unsigned int irq)