From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932740AbcIBQPS (ORCPT ); Fri, 2 Sep 2016 12:15:18 -0400 Received: from terminus.zytor.com ([198.137.202.10]:54500 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932236AbcIBQPR (ORCPT ); Fri, 2 Sep 2016 12:15:17 -0400 Date: Fri, 2 Sep 2016 09:14:35 -0700 From: tip-bot for Sebastian Frias Message-ID: Cc: hpa@zytor.com, sf84@laposte.net, mingo@kernel.org, tglx@linutronix.de, marc.zyngier@arm.com, jason@lakedaemon.net, slash.tmp@free.fr, linux-kernel@vger.kernel.org Reply-To: jason@lakedaemon.net, linux-kernel@vger.kernel.org, slash.tmp@free.fr, sf84@laposte.net, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de, marc.zyngier@arm.com In-Reply-To: <579F5C5A.2070507@laposte.net> References: <579F5C5A.2070507@laposte.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/core] genirq/generic_chip: Add irq_unmap callback Git-Commit-ID: ee26c013cdee0b947e29d6cadfb9ff3341c69ff9 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: ee26c013cdee0b947e29d6cadfb9ff3341c69ff9 Gitweb: http://git.kernel.org/tip/ee26c013cdee0b947e29d6cadfb9ff3341c69ff9 Author: Sebastian Frias AuthorDate: Mon, 1 Aug 2016 16:27:38 +0200 Committer: Thomas Gleixner CommitDate: Fri, 2 Sep 2016 18:06:49 +0200 genirq/generic_chip: Add irq_unmap callback Without this patch irq_domain_disassociate() cannot properly release the interrupt. In fact, irq_map_generic_chip() checks a bit on 'gc->installed' but said bit is never cleared, only set. Commit 088f40b7b027 ("genirq: Generic chip: Add linear irq domain support") added irq_map_generic_chip() function and also stated "This lacks a removal function for now". This commit provides an implementation of an unmap function that can be called by irq_domain_disassociate(). [ tglx: Made the function static and removed the export as we have neither a prototype nor a modular user. ] Fixes: 088f40b7b027 ("genirq: Generic chip: Add linear irq domain support") Signed-off-by: Sebastian Frias Cc: Marc Zyngier Cc: Mason Cc: Jason Cooper Link: http://lkml.kernel.org/r/579F5C5A.2070507@laposte.net Signed-off-by: Thomas Gleixner --- kernel/irq/generic-chip.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index 11ad73b..a3a3920 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c @@ -414,8 +414,29 @@ int irq_map_generic_chip(struct irq_domain *d, unsigned int virq, return 0; } +static void irq_unmap_generic_chip(struct irq_domain *d, unsigned int virq) +{ + struct irq_data *data = irq_domain_get_irq_data(d, virq); + struct irq_domain_chip_generic *dgc = d->gc; + unsigned int hw_irq = data->hwirq; + struct irq_chip_generic *gc; + int irq_idx; + + gc = irq_get_domain_generic_chip(d, hw_irq); + if (!gc) + return; + + irq_idx = hw_irq % dgc->irqs_per_chip; + + clear_bit(irq_idx, &gc->installed); + irq_domain_set_info(d, virq, hw_irq, &no_irq_chip, NULL, NULL, NULL, + NULL); + +} + struct irq_domain_ops irq_generic_chip_ops = { .map = irq_map_generic_chip, + .unmap = irq_unmap_generic_chip, .xlate = irq_domain_xlate_onetwocell, }; EXPORT_SYMBOL_GPL(irq_generic_chip_ops);