From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Gleixner Subject: [patch 46/47] powerpc: Use new irq allocator Date: Thu, 30 Sep 2010 23:18:28 -0000 Message-ID: <20100930221743.014571381@linutronix.de> References: <20100930221351.682772535@linutronix.de> Return-path: Content-Disposition: inline; filename=powerpc-use-new-allocator.patch Sender: linux-kernel-owner@vger.kernel.org To: LKML Cc: linux-arch@vger.kernel.org, Linus Torvalds , Andrew Morton , x86@kernel.org, Peter Zijlstra , Benjamin Herrenschmidt , Paul Mundt , Russell King , David Woodhouse , Jesse Barnes , Yinghai Lu , Grant Likely , "Eric W. Biederman" List-Id: linux-arch.vger.kernel.org Use the new functions and free the descriptor when the virq is destroyed. Signed-off-by: Thomas Gleixner --- arch/powerpc/kernel/irq.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) Index: linux-2.6-tip/arch/powerpc/kernel/irq.c =================================================================== --- linux-2.6-tip.orig/arch/powerpc/kernel/irq.c +++ linux-2.6-tip/arch/powerpc/kernel/irq.c @@ -676,16 +676,15 @@ void irq_set_virq_count(unsigned int cou static int irq_setup_virq(struct irq_host *host, unsigned int virq, irq_hw_number_t hwirq) { - struct irq_desc *desc; + int res; - desc = irq_to_desc_alloc_node(virq, 0); - if (!desc) { + res = irq_alloc_desc_at(virq, 0); + if (res != virq) { pr_debug("irq: -> allocating desc failed\n"); goto error; } - /* Clear IRQ_NOREQUEST flag */ - desc->status &= ~IRQ_NOREQUEST; + irq_clear_status_flags(virq, IRQ_NOREQUEST); /* map it */ smp_wmb(); @@ -694,11 +693,13 @@ static int irq_setup_virq(struct irq_hos if (host->ops->map(host, virq, hwirq)) { pr_debug("irq: -> mapping failed, freeing\n"); - goto error; + goto errdesc; } return 0; +errdesc: + irq_free_descs(virq, 1); error: irq_free_virt(virq, 1); return -1; @@ -877,9 +878,9 @@ void irq_dispose_mapping(unsigned int vi smp_mb(); irq_map[virq].hwirq = host->inval_irq; - /* Set some flags */ - irq_to_desc(virq)->status |= IRQ_NOREQUEST; + irq_set_status_flags(virq, IRQ_NOREQUEST); + irq_free_descs(virq, 1); /* Free it */ irq_free_virt(virq, 1); } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from www.tglx.de ([62.245.132.106]:43610 "EHLO www.tglx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756974Ab0I3XSq (ORCPT ); Thu, 30 Sep 2010 19:18:46 -0400 Message-ID: <20100930221743.014571381@linutronix.de> Date: Thu, 30 Sep 2010 23:18:28 -0000 From: Thomas Gleixner Subject: [patch 46/47] powerpc: Use new irq allocator References: <20100930221351.682772535@linutronix.de> Content-Disposition: inline; filename=powerpc-use-new-allocator.patch Sender: linux-arch-owner@vger.kernel.org List-ID: To: LKML Cc: linux-arch@vger.kernel.org, Linus Torvalds , Andrew Morton , x86@kernel.org, Peter Zijlstra , Benjamin Herrenschmidt , Paul Mundt , Russell King , David Woodhouse , Jesse Barnes , Yinghai Lu , Grant Likely , "Eric W. Biederman" Message-ID: <20100930231828.HGCWMck2TUJmPx5YfATDthYOrz-EgNelG3kVCoXyqhE@z> Use the new functions and free the descriptor when the virq is destroyed. Signed-off-by: Thomas Gleixner --- arch/powerpc/kernel/irq.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) Index: linux-2.6-tip/arch/powerpc/kernel/irq.c =================================================================== --- linux-2.6-tip.orig/arch/powerpc/kernel/irq.c +++ linux-2.6-tip/arch/powerpc/kernel/irq.c @@ -676,16 +676,15 @@ void irq_set_virq_count(unsigned int cou static int irq_setup_virq(struct irq_host *host, unsigned int virq, irq_hw_number_t hwirq) { - struct irq_desc *desc; + int res; - desc = irq_to_desc_alloc_node(virq, 0); - if (!desc) { + res = irq_alloc_desc_at(virq, 0); + if (res != virq) { pr_debug("irq: -> allocating desc failed\n"); goto error; } - /* Clear IRQ_NOREQUEST flag */ - desc->status &= ~IRQ_NOREQUEST; + irq_clear_status_flags(virq, IRQ_NOREQUEST); /* map it */ smp_wmb(); @@ -694,11 +693,13 @@ static int irq_setup_virq(struct irq_hos if (host->ops->map(host, virq, hwirq)) { pr_debug("irq: -> mapping failed, freeing\n"); - goto error; + goto errdesc; } return 0; +errdesc: + irq_free_descs(virq, 1); error: irq_free_virt(virq, 1); return -1; @@ -877,9 +878,9 @@ void irq_dispose_mapping(unsigned int vi smp_mb(); irq_map[virq].hwirq = host->inval_irq; - /* Set some flags */ - irq_to_desc(virq)->status |= IRQ_NOREQUEST; + irq_set_status_flags(virq, IRQ_NOREQUEST); + irq_free_descs(virq, 1); /* Free it */ irq_free_virt(virq, 1); }