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 5da3254..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)
@@ -33,7 +35,8 @@ static void disable_ipr_irq(unsigned int irq)
        struct ipr_data *p = get_irq_chip_data(irq);
        unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx];
        /* Set the priority in IPR to 0 */
-       ctrl_outw(ctrl_inw(addr) & (0xffff ^ (0xf << p->shift)), addr);
+       __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)
@@ -41,7 +44,7 @@ static void enable_ipr_irq(unsigned int irq)
        struct ipr_data *p = get_irq_chip_data(irq);
        unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx];
        /* Set priority in IPR back to original value */
-       ctrl_outw(ctrl_inw(addr) | (p->priority << p->shift), addr);
+       __raw_writew(__raw_readw(addr) | (p->priority << p->shift), addr);
 }
 
 /*
@@ -49,7 +52,6 @@ static void enable_ipr_irq(unsigned int irq)
  * bits/4. This is to make it easier to read the value directly from the
  * datasheets. The IPR address is calculated using the ipr_offset table.
  */
-
 void register_ipr_controller(struct ipr_desc *desc)
 {
        int i;
@@ -60,10 +62,18 @@ void register_ipr_controller(struct ipr_desc *desc)
 
        for (i = 0; i < desc->nr_irqs; i++) {
                struct ipr_data *p = desc->ipr_data + i;
+               struct irq_desc *irq_desc;
 
                BUG_ON(p->ipr_idx >= desc->nr_offsets);
                BUG_ON(!desc->ipr_offsets[p->ipr_idx]);
 
+               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;
+               }
+
                disable_irq_nosync(p->irq);
                set_irq_chip_and_handler_name(p->irq, &desc->chip,
                                      handle_level_irq, "level");
@@ -71,12 +81,4 @@ void register_ipr_controller(struct ipr_desc *desc)
                disable_ipr_irq(p->irq);
        }
 }
-
 EXPORT_SYMBOL(register_ipr_controller);
-
-#if !defined(CONFIG_CPU_HAS_PINT_IRQ)
-int ipr_irq_demux(int irq)
-{
-       return irq;
-}
-#endif