[RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support

Benjamin Herrenschmidt benh at kernel.crashing.org
Thu Nov 26 16:18:14 EST 2009


On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:

> +static void flipper_pic_mask_and_ack(unsigned int virq)
> +{
> +	int irq = virq_to_hw(virq);
> +	void __iomem *io_base = get_irq_chip_data(virq);
> +
> +	clear_bit(irq, io_base + FLIPPER_IMR);
> +	set_bit(irq, io_base + FLIPPER_ICR);
> +}

Do not use clear_bit and set_bit on IOs. They will do lwarx/stwcx. which
is really not what you want. You can use __clear_bit and __set_bit but
it's still fishy. Those operate on unsigned long, so the size vary
between 32 and 64 bit etc... not something you care that much about, but
it's still the wrong tool for the job.

Do those guys have more than 32 interrupts ? If not, just hand
code the msak & shifts. If they do, then maybe stick with __clear_bit()
and __set_bit() which are the non atomic variants.

Cheers,
Ben.




More information about the Linuxppc-dev mailing list