Commit a27dca64 authored by Thomas Gleixner's avatar Thomas Gleixner

x86/io_apic: Cleanup trigger/polarity helpers

'trigger' and 'polarity' are used throughout the I/O-APIC code for handling
the trigger type (edge/level) and the active low/high configuration. While
there are defines for initializing these variables and struct members, they
are not used consequently and the meaning of 'trigger' and 'polarity' is
opaque and confusing at best.

Rename them to 'is_level' and 'active_low' and make them boolean in various
structs so it's entirely clear what the meaning is.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201024213535.443185-20-dwmw2@infradead.org
parent 0c1883c1
......@@ -47,9 +47,9 @@ enum irq_alloc_type {
struct ioapic_alloc_info {
int pin;
int node;
u32 trigger : 1;
u32 polarity : 1;
u32 valid : 1;
u32 is_level : 1;
u32 active_low : 1;
u32 valid : 1;
struct IO_APIC_route_entry *entry;
};
......
This diff is collapsed.
......@@ -215,7 +215,7 @@ static int pci_write(struct pci_bus *bus, unsigned int devfn, int where,
static int intel_mid_pci_irq_enable(struct pci_dev *dev)
{
struct irq_alloc_info info;
int polarity;
bool polarity_low;
int ret;
u8 gsi;
......@@ -230,7 +230,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
switch (intel_mid_identify_cpu()) {
case INTEL_MID_CPU_CHIP_TANGIER:
polarity = IOAPIC_POL_HIGH;
polarity_low = false;
/* Special treatment for IRQ0 */
if (gsi == 0) {
......@@ -252,11 +252,11 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
}
break;
default:
polarity = IOAPIC_POL_LOW;
polarity_low = true;
break;
}
ioapic_set_alloc_attr(&info, dev_to_node(&dev->dev), 1, polarity);
ioapic_set_alloc_attr(&info, dev_to_node(&dev->dev), 1, polarity_low);
/*
* MRST only have IOAPIC, the PCI irq lines are 1:1 mapped to
......
......@@ -3687,13 +3687,11 @@ static void irq_remapping_prepare_irte(struct amd_ir_data *data,
entry = info->ioapic.entry;
info->ioapic.entry = NULL;
memset(entry, 0, sizeof(*entry));
entry->vector = index;
entry->mask = 0;
entry->trigger = info->ioapic.trigger;
entry->polarity = info->ioapic.polarity;
entry->vector = index;
entry->trigger = info->ioapic.is_level;
entry->polarity = info->ioapic.active_low;
/* Mask level triggered irqs. */
if (info->ioapic.trigger)
entry->mask = 1;
entry->mask = info->ioapic.is_level;
break;
case X86_IRQ_ALLOC_TYPE_HPET:
......
......@@ -1306,11 +1306,10 @@ static void intel_irq_remapping_prepare_irte(struct intel_ir_data *data,
* irq handler will do the explicit EOI to the io-apic.
*/
entry->vector = info->ioapic.pin;
entry->mask = 0; /* enable IRQ */
entry->trigger = info->ioapic.trigger;
entry->polarity = info->ioapic.polarity;
if (info->ioapic.trigger)
entry->mask = 1; /* Mask level triggered irqs. */
entry->trigger = info->ioapic.is_level;
entry->polarity = info->ioapic.active_low;
/* Mask level triggered irqs. */
entry->mask = info->ioapic.is_level;
break;
case X86_IRQ_ALLOC_TYPE_HPET:
......
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