Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / arm / mach-sa1100 / neponset.c
index 1405383..af6d277 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/tty.h>
 #include <linux/ioport.h>
 #include <linux/serial_core.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/slab.h>
 
 #include <asm/hardware.h>
@@ -59,14 +59,22 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg
                if (irr & (IRR_ETHERNET | IRR_USAR)) {
                        desc->chip->mask(irq);
 
+                       /*
+                        * Ack the interrupt now to prevent re-entering
+                        * this neponset handler.  Again, this is safe
+                        * since we'll check the IRR register prior to
+                        * leaving.
+                        */
+                       desc->chip->ack(irq);
+
                        if (irr & IRR_ETHERNET) {
                                d = irq_desc + IRQ_NEPONSET_SMC9196;
-                               d->handle(IRQ_NEPONSET_SMC9196, d, regs);
+                               desc_handle_irq(IRQ_NEPONSET_SMC9196, d, regs);
                        }
 
                        if (irr & IRR_USAR) {
                                d = irq_desc + IRQ_NEPONSET_USAR;
-                               d->handle(IRQ_NEPONSET_USAR, d, regs);
+                               desc_handle_irq(IRQ_NEPONSET_USAR, d, regs);
                        }
 
                        desc->chip->unmask(irq);
@@ -74,7 +82,7 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg
 
                if (irr & IRR_SA1111) {
                        d = irq_desc + IRQ_NEPONSET_SA1111;
-                       d->handle(IRQ_NEPONSET_SA1111, d, regs);
+                       desc_handle_irq(IRQ_NEPONSET_SA1111, d, regs);
                }
        }
 }
@@ -137,7 +145,7 @@ static struct sa1100_port_fns neponset_port_fns __initdata = {
        .get_mctrl      = neponset_get_mctrl,
 };
 
-static int neponset_probe(struct device *dev)
+static int neponset_probe(struct platform_device *dev)
 {
        sa1100_register_uart_fns(&neponset_port_fns);
 
@@ -178,33 +186,27 @@ static int neponset_probe(struct device *dev)
 /*
  * LDM power management.
  */
-static int neponset_suspend(struct device *dev, pm_message_t state, u32 level)
+static int neponset_suspend(struct platform_device *dev, pm_message_t state)
 {
        /*
         * Save state.
         */
-       if (level == SUSPEND_SAVE_STATE ||
-           level == SUSPEND_DISABLE ||
-           level == SUSPEND_POWER_DOWN) {
-               if (!dev->power.saved_state)
-                       dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
-               if (!dev->power.saved_state)
-                       return -ENOMEM;
-
-               *(unsigned int *)dev->power.saved_state = NCR_0;
-       }
+       if (!dev->dev.power.saved_state)
+               dev->dev.power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
+       if (!dev->dev.power.saved_state)
+               return -ENOMEM;
+
+       *(unsigned int *)dev->dev.power.saved_state = NCR_0;
 
        return 0;
 }
 
-static int neponset_resume(struct device *dev, u32 level)
+static int neponset_resume(struct platform_device *dev)
 {
-       if (level == RESUME_RESTORE_STATE || level == RESUME_ENABLE) {
-               if (dev->power.saved_state) {
-                       NCR_0 = *(unsigned int *)dev->power.saved_state;
-                       kfree(dev->power.saved_state);
-                       dev->power.saved_state = NULL;
-               }
+       if (dev->dev.power.saved_state) {
+               NCR_0 = *(unsigned int *)dev->dev.power.saved_state;
+               kfree(dev->dev.power.saved_state);
+               dev->dev.power.saved_state = NULL;
        }
 
        return 0;
@@ -215,12 +217,13 @@ static int neponset_resume(struct device *dev, u32 level)
 #define neponset_resume  NULL
 #endif
 
-static struct device_driver neponset_device_driver = {
-       .name           = "neponset",
-       .bus            = &platform_bus_type,
+static struct platform_driver neponset_device_driver = {
        .probe          = neponset_probe,
        .suspend        = neponset_suspend,
        .resume         = neponset_resume,
+       .driver         = {
+               .name   = "neponset",
+       },
 };
 
 static struct resource neponset_resources[] = {
@@ -299,7 +302,7 @@ static struct platform_device *devices[] __initdata = {
 
 static int __init neponset_init(void)
 {
-       driver_register(&neponset_device_driver);
+       platform_driver_register(&neponset_device_driver);
 
        /*
         * The Neponset is only present on the Assabet machine type.
@@ -331,9 +334,17 @@ static int __init neponset_init(void)
 subsys_initcall(neponset_init);
 
 static struct map_desc neponset_io_desc[] __initdata = {
- /* virtual     physical    length type */
-  { 0xf3000000, 0x10000000, SZ_1M, MT_DEVICE }, /* System Registers */
-  { 0xf4000000, 0x40000000, SZ_1M, MT_DEVICE }  /* SA-1111 */
+       {       /* System Registers */
+               .virtual        =  0xf3000000,
+               .pfn            = __phys_to_pfn(0x10000000),
+               .length         = SZ_1M,
+               .type           = MT_DEVICE
+       }, {    /* SA-1111 */
+               .virtual        =  0xf4000000,
+               .pfn            = __phys_to_pfn(0x40000000),
+               .length         = SZ_1M,
+               .type           = MT_DEVICE
+       }
 };
 
 void __init neponset_map_io(void)