diff mbox

[2/6] powerpc/pseries: Use irq_has_action() in eeh_disable_irq()

Message ID 1dc0d81f3202c61cbd1bb1508cb3a2ed04dc036a.1255499081.git.michael@ellerman.id.au (mailing list archive)
State Accepted, archived
Commit 59e3f837023d446924791f76fbdd4bcf8e09efcc
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Michael Ellerman Oct. 14, 2009, 5:44 a.m. UTC
Rather than open-coding our own check, use irq_has_action()
to check if an irq has an action - ie. is "in use".

irq_has_action() doesn't take the descriptor lock, but it
shouldn't matter - we're just using it as an indicator
that the irq is in use. disable_irq_nosync() will take
the descriptor lock before doing anything also.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/eeh_driver.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

Comments

Grant Likely Oct. 14, 2009, 6:33 p.m. UTC | #1
On Tue, Oct 13, 2009 at 11:44 PM, Michael Ellerman
<michael@ellerman.id.au> wrote:
> Rather than open-coding our own check, use irq_has_action()
> to check if an irq has an action - ie. is "in use".
>
> irq_has_action() doesn't take the descriptor lock, but it
> shouldn't matter - we're just using it as an indicator
> that the irq is in use. disable_irq_nosync() will take
> the descriptor lock before doing anything also.
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Looks good to me
Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/powerpc/platforms/pseries/eeh_driver.c |   18 +-----------------
>  1 files changed, 1 insertions(+), 17 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
> index 0e8db67..ef8e454 100644
> --- a/arch/powerpc/platforms/pseries/eeh_driver.c
> +++ b/arch/powerpc/platforms/pseries/eeh_driver.c
> @@ -63,22 +63,6 @@ static void print_device_node_tree(struct pci_dn *pdn, int dent)
>  }
>  #endif
>
> -/**
> - * irq_in_use - return true if this irq is being used
> - */
> -static int irq_in_use(unsigned int irq)
> -{
> -       int rc = 0;
> -       unsigned long flags;
> -   struct irq_desc *desc = irq_desc + irq;
> -
> -       spin_lock_irqsave(&desc->lock, flags);
> -       if (desc->action)
> -               rc = 1;
> -       spin_unlock_irqrestore(&desc->lock, flags);
> -       return rc;
> -}
> -
>  /**
>  * eeh_disable_irq - disable interrupt for the recovering device
>  */
> @@ -93,7 +77,7 @@ static void eeh_disable_irq(struct pci_dev *dev)
>        if (dev->msi_enabled || dev->msix_enabled)
>                return;
>
> -       if (!irq_in_use(dev->irq))
> +       if (!irq_has_action(dev->irq))
>                return;
>
>        PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED;
> --
> 1.6.2.1
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
diff mbox

Patch

diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 0e8db67..ef8e454 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -63,22 +63,6 @@  static void print_device_node_tree(struct pci_dn *pdn, int dent)
 }
 #endif
 
-/** 
- * irq_in_use - return true if this irq is being used 
- */
-static int irq_in_use(unsigned int irq)
-{
-	int rc = 0;
-	unsigned long flags;
-   struct irq_desc *desc = irq_desc + irq;
-
-	spin_lock_irqsave(&desc->lock, flags);
-	if (desc->action)
-		rc = 1;
-	spin_unlock_irqrestore(&desc->lock, flags);
-	return rc;
-}
-
 /**
  * eeh_disable_irq - disable interrupt for the recovering device
  */
@@ -93,7 +77,7 @@  static void eeh_disable_irq(struct pci_dev *dev)
 	if (dev->msi_enabled || dev->msix_enabled)
 		return;
 
-	if (!irq_in_use(dev->irq))
+	if (!irq_has_action(dev->irq))
 		return;
 
 	PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED;