]> git.karo-electronics.de Git - linux-beck.git/commitdiff
x86: ioapic: Add io_apic_setup_irq_pin()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 23 Feb 2011 12:00:56 +0000 (13:00 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 23 Feb 2011 16:26:49 +0000 (17:26 +0100)
There are about four places in the ioapic code which do exactly the
same setup sequence. Also the OF based ioapic setup needs that
function to avoid putting the OF specific code into ioapic.c

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/include/asm/io_apic.h
arch/x86/kernel/apic/io_apic.c

index 56dcf08bde626f01e5517ba17058565e716acff1..37dbb3fae395d40237399ade0c15299c29fc20df 100644 (file)
@@ -151,6 +151,8 @@ void setup_IO_APIC_irq_extra(u32 gsi);
 extern void ioapic_and_gsi_init(void);
 extern void ioapic_insert_resources(void);
 
+int io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr);
+
 extern struct IO_APIC_route_entry **alloc_ioapic_entries(void);
 extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries);
 extern int save_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries);
index f751a82d4cb4a17be5391e4ec71ec45748419664..6deb3ca62fd68dce3a6a71f19a76cec3f5c4444f 100644 (file)
@@ -3607,6 +3607,21 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
 }
 #endif /* CONFIG_HT_IRQ */
 
+int
+io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr)
+{
+       struct irq_cfg *cfg = alloc_irq_and_cfg_at(irq, node);
+       int ret;
+
+       if (!cfg)
+               return -EINVAL;
+       ret = __add_pin_to_irq_node(cfg, node, attr->ioapic, attr->ioapic_pin);
+       if (!ret)
+               setup_ioapic_irq(attr->ioapic, attr->ioapic_pin, irq, cfg,
+                                attr->trigger, attr->polarity);
+       return ret;
+}
+
 int __init io_apic_get_redir_entries (int ioapic)
 {
        union IO_APIC_reg_01    reg_01;