Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6.git] / arch / sh / kernel / cpu / irq / ipr.c
index 6ad40db..9282d96 100644 (file)
  * for more details.
  */
 #include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
 #include <linux/irq.h>
+#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/io.h>
-#include <linux/interrupt.h>
+#include <linux/topology.h>
 
 static inline struct ipr_desc *get_ipr_desc(unsigned int irq)
 {
        struct irq_chip *chip = get_irq_chip(irq);
-       return (void *)((char *)chip - offsetof(struct ipr_desc, chip));
+       return container_of(chip, struct ipr_desc, chip);
 }
 
 static void disable_ipr_irq(unsigned int irq)
@@ -34,6 +36,7 @@ static void disable_ipr_irq(unsigned int irq)
        unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx];
        /* Set the priority in IPR to 0 */
        __raw_writew(__raw_readw(addr) & (0xffff ^ (0xf << p->shift)), addr);
+       (void)__raw_readw(addr);        /* Read back to flush write posting */
 }
 
 static void enable_ipr_irq(unsigned int irq)
@@ -59,21 +62,17 @@ void register_ipr_controller(struct ipr_desc *desc)
 
        for (i = 0; i < desc->nr_irqs; i++) {
                struct ipr_data *p = desc->ipr_data + i;
-#ifdef CONFIG_SPARSE_IRQ
                struct irq_desc *irq_desc;
-#endif
 
                BUG_ON(p->ipr_idx >= desc->nr_offsets);
                BUG_ON(!desc->ipr_offsets[p->ipr_idx]);
 
-#ifdef CONFIG_SPARSE_IRQ
-               irq_desc = irq_to_desc_alloc_cpu(p->irq, smp_processor_id());
+               irq_desc = irq_to_desc_alloc_node(p->irq, numa_node_id());
                if (unlikely(!irq_desc)) {
                        printk(KERN_INFO "can not get irq_desc for %d\n",
                               p->irq);
                        continue;
                }
-#endif
 
                disable_irq_nosync(p->irq);
                set_irq_chip_and_handler_name(p->irq, &desc->chip,