Subject: [PATCH 14/29] ARM: orion: switch to a per-platform handle_irq() function

From: [email-masked] (Thomas Petazzoni)
Date: Sat, 19 Apr 2014 09:27:08 +0200

Dear Sebastian Hesselbarth,

On Mon, 14 Apr 2014 12:40:48 +0200, Sebastian Hesselbarth wrote:

> > +static asmlinkage void
> > +__exception_irq_entry dove_legacy_handle_irq(struct pt_regs *regs)
> > +{
> > +	u32 stat;
> > +
> > +	stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_LOW_OFF);
> > +	stat &= readl_relaxed(dove_irq_base + IRQ_MASK_LOW_OFF);
> > +	if (stat) {
> > +		unsigned int hwirq = __fls(stat);
> > +		handle_IRQ(hwirq, regs);
> > +		return;
> > +	}
> 
> I remember we talked about it already, but IMHO copying the multi-irq
> handler to mach-{kirkwood,dove} isn't necessary. The only situation we
> need this is when you compile _one_ mach-{kirkwood,dove,orion5x} with
> both DT and non-DT.
> 
> So, I think it is fine to just add
> 
> #if !defined(CONFIG_MACH_ORION5X)
> > +	stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_HIGH_OFF);
> > +	stat &= readl_relaxed(dove_irq_base + IRQ_MASK_HIGH_OFF);
> > +	if (stat) {
> > +		unsigned int hwirq = 32 + __fls(stat);
> > +		handle_IRQ(hwirq, regs);
> > +		return;
> > +	}
> #endif
> 
> in the original handler?

Nope, it doesn't work, because mach-orion5x doesn't define
IRQ_VIRT_BASE, IRQ_CAUSE_LOW_OFF and IRQ_MASK_LOW_OFF, so the common
handler does not build, even after compiling-out the part you mention
here.

Of course, Orion5x code can be changed to define those values, but I
found it was not worth the effort, and Arnd Bergmann during an IRC
discussion, also suggested to move the handle_irq() function to each
individual mach-<foo> directory. And it actually makes sense, because
it's only the same between Kirkwood and Dove: Orion5x and mv78xx0 need
different implementations.

Also, this approach goes towards the goal of reducing plat-orion/ code.
Having the code closer to each SoC is going to make it easier to
progressively get rid of it I believe.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com