From patchwork Wed May 20 09:40:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 6443851 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 EF1C3C0432 for ; Wed, 20 May 2015 09:46:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D8EDE202C8 for ; Wed, 20 May 2015 09:46:18 +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 D6F4E200CF for ; Wed, 20 May 2015 09:46:17 +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 1Yv0Xd-0004ko-8F; Wed, 20 May 2015 09:43:57 +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 1Yv0XY-0004dH-Ez for linux-arm-kernel@lists.infradead.org; Wed, 20 May 2015 09:43:53 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 20 May 2015 02:43:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,464,1427785200"; d="scan'208";a="728902811" Received: from gerry-dev.bj.intel.com ([10.238.158.61]) by fmsmga002.fm.intel.com with ESMTP; 20 May 2015 02:43:24 -0700 From: Jiang Liu To: Thomas Gleixner , Bjorn Helgaas , Benjamin Herrenschmidt , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , 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 v2 14/14] genirq: Pass irq_data to helper function __irq_set_chip_handler_name_locked() Date: Wed, 20 May 2015 17:40:45 +0800 Message-Id: <1432114845-24304-15-git-send-email-jiang.liu@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1432114845-24304-1-git-send-email-jiang.liu@linux.intel.com> References: <1432114845-24304-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-20150520_024353_073232_0F6DF688 X-CRM114-Status: GOOD ( 16.05 ) 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 --- 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 | 12 ++++++++---- 6 files changed, 23 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 8a4044d6efba..8f649e174ed1 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h @@ -94,6 +94,11 @@ struct irq_desc { extern struct irq_desc irq_desc[NR_IRQS]; #endif +static inline struct irq_desc *irq_data_to_desc(struct irq_data *data) +{ + return container_of(data->common, struct irq_desc, irq_common_data); +} + static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc) { return &desc->irq_data; @@ -168,15 +173,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)