Commit ab76085e authored by Thomas Gleixner's avatar Thomas Gleixner

x86,ioapic: Cleanup irq_trigger/polarity()

These functions are full of pointless indentations, useless comments
and even more useless printks.

Clean them up.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: David Cohen <david.a.cohen@linux.intel.com>
Cc: Sander Eikelenboom <linux@eikelenboom.it>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dimitri Sivanich <sivanich@sgi.com>
Cc: Grant Likely <grant.likely@linaro.org>
Link: http://lkml.kernel.org/r/1428978610-28986-31-git-send-email-jiang.liu@linux.intel.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: x86@kernel.org
Signed-off-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
parent 335efdf5
...@@ -796,44 +796,46 @@ static int EISA_ELCR(unsigned int irq) ...@@ -796,44 +796,46 @@ static int EISA_ELCR(unsigned int irq)
static int irq_polarity(int idx) static int irq_polarity(int idx)
{ {
int bus = mp_irqs[idx].srcbus; int bus = mp_irqs[idx].srcbus;
int polarity;
/* /*
* Determine IRQ line polarity (high active or low active): * Determine IRQ line polarity (high active or low active):
*/ */
switch (mp_irqs[idx].irqflag & 3) switch (mp_irqs[idx].irqflag & 0x03) {
{ case 0:
case 0: /* conforms, ie. bus-type dependent polarity */ /* conforms to spec, ie. bus-type dependent polarity */
if (test_bit(bus, mp_bus_not_pci)) if (test_bit(bus, mp_bus_not_pci))
polarity = default_ISA_polarity(idx); return default_ISA_polarity(idx);
else else
polarity = default_PCI_polarity(idx); return default_PCI_polarity(idx);
break; case 1:
case 1: /* high active */ return IOAPIC_POL_HIGH;
{ case 2:
polarity = IOAPIC_POL_HIGH; pr_warn("IOAPIC: Invalid polarity: 2, defaulting to low\n");
break; case 3:
} default: /* Pointless default required due to do gcc stupidity */
case 2: /* reserved */ return IOAPIC_POL_LOW;
{
pr_warn("broken BIOS!!\n");
polarity = IOAPIC_POL_LOW;
break;
}
case 3: /* low active */
{
polarity = IOAPIC_POL_LOW;
break;
}
default: /* invalid */
{
pr_warn("broken BIOS!!\n");
polarity = IOAPIC_POL_LOW;
break;
} }
}
#ifdef CONFIG_EISA
static int eisa_irq_trigger(int idx, int bus, int trigger)
{
switch (mp_bus_id_to_type[bus]) {
case MP_BUS_PCI:
case MP_BUS_ISA:
return trigger;
case MP_BUS_EISA:
return default_EISA_trigger(idx);
} }
return polarity; pr_warn("IOAPIC: Invalid srcbus: %d defaulting to level\n", bus);
return IOAPIC_LEVEL;
}
#else
static inline int eisa_irq_trigger(int idx, int bus, int trigger)
{
return trigger;
} }
#endif
static int irq_trigger(int idx) static int irq_trigger(int idx)
{ {
...@@ -843,63 +845,23 @@ static int irq_trigger(int idx) ...@@ -843,63 +845,23 @@ static int irq_trigger(int idx)
/* /*
* Determine IRQ trigger mode (edge or level sensitive): * Determine IRQ trigger mode (edge or level sensitive):
*/ */
switch ((mp_irqs[idx].irqflag>>2) & 3) switch ((mp_irqs[idx].irqflag >> 2) & 0x03) {
{ case 0:
case 0: /* conforms, ie. bus-type dependent */ /* conforms to spec, ie. bus-type dependent trigger mode */
if (test_bit(bus, mp_bus_not_pci)) if (test_bit(bus, mp_bus_not_pci))
trigger = default_ISA_trigger(idx); trigger = default_ISA_trigger(idx);
else else
trigger = default_PCI_trigger(idx); trigger = default_PCI_trigger(idx);
#ifdef CONFIG_EISA /* Take EISA into account */
switch (mp_bus_id_to_type[bus]) { return eisa_irq_trigger(idx, bus, trigger);
case MP_BUS_ISA: /* ISA pin */ case 1:
{ return IOAPIC_EDGE;
/* set before the switch */ case 2:
break; pr_warn("IOAPIC: Invalid trigger mode 2 defaulting to level\n");
} case 3:
case MP_BUS_EISA: /* EISA pin */ default: /* Pointless default required due to do gcc stupidity */
{ return IOAPIC_LEVEL;
trigger = default_EISA_trigger(idx);
break;
}
case MP_BUS_PCI: /* PCI pin */
{
/* set before the switch */
break;
}
default:
{
pr_warn("broken BIOS!!\n");
trigger = IOAPIC_LEVEL;
break;
}
}
#endif
break;
case 1: /* edge */
{
trigger = IOAPIC_EDGE;
break;
}
case 2: /* reserved */
{
pr_warn("broken BIOS!!\n");
trigger = IOAPIC_LEVEL;
break;
}
case 3: /* level */
{
trigger = IOAPIC_LEVEL;
break;
} }
default: /* invalid */
{
pr_warn("broken BIOS!!\n");
trigger = IOAPIC_EDGE;
break;
}
}
return trigger;
} }
void ioapic_set_alloc_attr(struct irq_alloc_info *info, int node, void ioapic_set_alloc_attr(struct irq_alloc_info *info, int node,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment