[PATCH 01/28] powerpc: mpic irq_data conversion.

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Mar 9 14:22:55 EST 2011


On Tue, 2011-03-08 at 00:59 +0100, Lennert Buytenhek wrote:

> -static void mpic_unmask_ht_irq(unsigned int irq)
> +static void mpic_unmask_ht_irq(struct irq_data *d)
>  {
> -	struct mpic *mpic = mpic_from_irq(irq);
> -	unsigned int src = mpic_irq_to_hw(irq);
> +	struct mpic *mpic = mpic_from_irq(d->irq);
> +	unsigned int src = mpic_irq_to_hw(d->irq);

It's a bit sad to have a pointerm turn it back to a irq number, look it
up just to get back the chip data in there :-)

Either we should create an mpic_from_irqdata() which itself uses
irq_data_get_irq_chip_data() or just change mpic_from_irq() if we decide
we can always call it with "data" instead of "irq"
 
> -	mpic_unmask_irq(irq);
> +	mpic_unmask_irq(d);
>  
> -	if (irq_to_desc(irq)->status & IRQ_LEVEL)
> +	if (irq_to_desc(d->irq)->status & IRQ_LEVEL)
>  		mpic_ht_end_irq(mpic, src);
>  }

Do we really need that gymnastic to get to desc->status from irq_data ?

Again, we're going back to a number and then looking it up again... bad.

I don't see off hand a data -> desc accessor, but it also looks like it
should be trivial to add. Thomas, what do you reckon ?

> -static unsigned int mpic_startup_ht_irq(unsigned int irq)
> +static unsigned int mpic_startup_ht_irq(struct irq_data *d)
>  {
> -	struct mpic *mpic = mpic_from_irq(irq);
> -	unsigned int src = mpic_irq_to_hw(irq);
> +	struct mpic *mpic = mpic_from_irq(d->irq);
> +	unsigned int src = mpic_irq_to_hw(d->irq);
>  
> -	mpic_unmask_irq(irq);
> -	mpic_startup_ht_interrupt(mpic, src, irq_to_desc(irq)->status);
> +	mpic_unmask_irq(d);
> +	mpic_startup_ht_interrupt(mpic, src, irq_to_desc(d->irq)->status);
>  
>  	return 0;
>  }

Similar.

Cheers,
Ben.




More information about the Linuxppc-dev mailing list