Re: [PATCH v2 12/29] nios2: Interrupt handling

From: Thomas Gleixner
Date: Tue Jul 15 2014 - 05:52:12 EST


On Tue, 15 Jul 2014, Ley Foon Tan wrote:
> +#ifndef _ASM_NIOS2_IRQ_H
> +#define _ASM_NIOS2_IRQ_H
> +
> +#define NIOS2_CPU_NR_IRQS 32
> +/* Reserve 32 additional interrupts for GPIO IRQs */
> +#define NR_IRQS (NIOS2_CPU_NR_IRQS + 32)

Please use sparse irqs. Hardcoded limits tend to work out really bad.

> +#include <linux/init.h>
> +#include <linux/interrupt.h>
> +#include <linux/of.h>
> +
> +asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
> +{
> + struct pt_regs *oldregs = set_irq_regs(regs);
> + int irq;
> +
> + irq_enter();
> + irq = irq_find_mapping(NULL, hwirq);
> + generic_handle_irq(irq);
> + irq_exit();
> +
> + set_irq_regs(oldregs);
> +}
> +
> +static void chip_unmask(struct irq_data *d)
> +{
> + u32 ien;
> + ien = RDCTL(CTL_IENABLE);
> + ien |= (1 << d->hwirq);
> + WRCTL(CTL_IENABLE, ien);

So this is UP only, right?

Also why don't you cache the register content so spare the extra read
from the hardware?

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/