x86, ioapic: Add proper legacy interrupt check to mp_map_pin_to_irq()

Since commit bfa644bfa9e3 (x86, irq: Convert IOAPIC to use hierarchy
irqdomain interfaces) Intel MID platforms crashes on boot:

 Enabling APIC mode:  Flat.  Using 1 I/O APICs
 BUG: unable to handle kernel NULL pointer dereference at 00000018
 IP: [<c107bdc6>] __irq_domain_alloc_irqs+0xff/0x250

The reason is that mp_map_pin_to_irq() assumes blindly that any non
PCI interrupt is legacy, but thats wrong for MID platforms as they
have no legacy interrupt support.

alloc_irq_from_domain() and mp_init_irq_at_boot() have checks for
this, but mp_map_pin_to_irq() is lacking one.

Instead of copying the same code another time, move the check to an
inline function and use it everywhere.

[ tglx: Massaged changelog ]

Fixes: bfa644bfa9e3 'x86, irq: Convert IOAPIC to use hierarchy irqdomain interfaces'
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: David Cohen <david.a.cohen@linux.intel.com>
Link: http://lkml.kernel.org/r/1418236165-13961-1-git-send-email-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 file changed