[linux-yocto] [PATCH 20/39] kernel/irq/manage.c: Fix irq_set_affinity to allow use with buslocks

Bruce Ashfield bruce.ashfield at windriver.com
Sat Apr 12 21:04:57 PDT 2014


On 2014-04-11, 5:13 PM, Charlie Paul wrote:
> From: David Mercado <david.mercado at windriver.com>
>
>      Fix irq_set_affinity() to allow usage of buslocks with "slow bus"
>      IRQ controllers, such as the LSI Axxia GIC.  Otherwise, a device
>      having its IRQ affinity changed will hang.

This is a common kernel file, so we need more explanation here. What
is the overhead of this call ? What does it do to existing users of
irq_set_affinity ? Generally speaking, these are routines that a BSP
should never be patching.

Bruce

>
> Signed-off-by: David Mercado <david.mercado at windriver.com>
> ---
>   kernel/irq/manage.c |   16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 9bd5c8a..81afc6d 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -195,16 +195,16 @@ int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask)
>    */
>   int irq_set_affinity(unsigned int irq, const struct cpumask *mask)
>   {
> -	struct irq_desc *desc = irq_to_desc(irq);
>   	unsigned long flags;
> +	struct irq_desc *desc = irq_get_desc_buslock(irq, &flags,
> +						     IRQ_GET_DESC_CHECK_GLOBAL);
>   	int ret;
>
>   	if (!desc)
>   		return -EINVAL;
>
> -	raw_spin_lock_irqsave(&desc->lock, flags);
>   	ret =  __irq_set_affinity_locked(irq_desc_get_irq_data(desc), mask);
> -	raw_spin_unlock_irqrestore(&desc->lock, flags);
> +	irq_put_desc_busunlock(desc, flags);
>   	return ret;
>   }
>
> @@ -1101,8 +1101,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
>   				goto out_mask;
>   		}
>
> -		desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | \
> -				  IRQS_ONESHOT | IRQS_WAITING);
> +		desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED |
> +				IRQS_ONESHOT | IRQS_WAITING);
>   		irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
>
>   		if (new->flags & IRQF_PERCPU) {
> @@ -1134,7 +1134,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
>
>   		if (nmsk != omsk)
>   			/* hope the handler works with current  trigger mode */
> -			pr_warning("irq %d uses trigger mode %u; requested %u\n",
> +			pr_warn("irq %d uses trigger mode %u; requested %u\n",
>   				   irq, nmsk, omsk);
>   	}
>
> @@ -1313,7 +1313,7 @@ void remove_irq(unsigned int irq, struct irqaction *act)
>   	struct irq_desc *desc = irq_to_desc(irq);
>
>   	if (desc && !WARN_ON(irq_settings_is_per_cpu_devid(desc)))
> -	    __free_irq(irq, act->dev_id);
> +		__free_irq(irq, act->dev_id);
>   }
>   EXPORT_SYMBOL_GPL(remove_irq);
>
> @@ -1595,7 +1595,7 @@ void remove_percpu_irq(unsigned int irq, struct irqaction *act)
>   	struct irq_desc *desc = irq_to_desc(irq);
>
>   	if (desc && irq_settings_is_per_cpu_devid(desc))
> -	    __free_percpu_irq(irq, act->percpu_dev_id);
> +		__free_percpu_irq(irq, act->percpu_dev_id);
>   }
>
>   /**
>



More information about the linux-yocto mailing list