suspend: switch the Asus Pundit P1-AH2 to old ACPI sleep ordering
[safe/jmp/linux-2.6] / drivers / parisc / superio.c
index ad6d3b2..4fa3bb2 100644 (file)
@@ -12,6 +12,7 @@
  *      (C) Copyright 2001 John Marvin <jsm fc hp com>
  *      (C) Copyright 2003 Grant Grundler <grundler parisc-linux org>
  *     (C) Copyright 2005 Kyle McMartin <kyle@parisc-linux.org>
+ *     (C) Copyright 2006 Helge Deller <deller@gmx.de>
  *
  *     This program is free software; you can redistribute it and/or
  *     modify it under the terms of the GNU General Public License as
@@ -72,6 +73,7 @@
 #include <linux/termios.h>
 #include <linux/tty.h>
 #include <linux/serial_core.h>
+#include <linux/serial_8250.h>
 #include <linux/delay.h>
 
 #include <asm/io.h>
@@ -93,7 +95,7 @@ static struct superio_device sio_dev;
 #define PFX    SUPERIO ": "
 
 static irqreturn_t
-superio_interrupt(int parent_irq, void *devp, struct pt_regs *regs)
+superio_interrupt(int parent_irq, void *devp)
 {
        u8 results;
        u8 local_irq;
@@ -137,7 +139,7 @@ superio_interrupt(int parent_irq, void *devp, struct pt_regs *regs)
        }
 
        /* Call the appropriate device's interrupt */
-       __do_IRQ(local_irq, regs);
+       __do_IRQ(local_irq);
 
        /* set EOI - forces a new interrupt if a lower priority device
         * still needs service.
@@ -153,8 +155,9 @@ superio_init(struct pci_dev *pcidev)
        struct superio_device *sio = &sio_dev;
        struct pci_dev *pdev = sio->lio_pdev;
        u16 word;
+       int ret;
 
-        if (sio->suckyio_irq_enabled)                                       
+       if (sio->suckyio_irq_enabled)
                return;
 
        BUG_ON(!pdev);
@@ -193,12 +196,13 @@ superio_init(struct pci_dev *pcidev)
        request_region (sio->acpi_base, 0x1f, "acpi");
 
        /* Enable the legacy I/O function */
-        pci_read_config_word (pdev, PCI_COMMAND, &word);
+       pci_read_config_word (pdev, PCI_COMMAND, &word);
        word |= PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_IO;
        pci_write_config_word (pdev, PCI_COMMAND, word);
 
        pci_set_master (pdev);
-       pci_enable_device(pdev);
+       ret = pci_enable_device(pdev);
+       BUG_ON(ret < 0);        /* not too much we can do about this... */
 
        /*
         * Next project is programming the onboard interrupt controllers.
@@ -270,7 +274,7 @@ superio_init(struct pci_dev *pcidev)
        else
                printk(KERN_ERR PFX "USB regulator not initialized!\n");
 
-       if (request_irq(pdev->irq, superio_interrupt, SA_INTERRUPT,
+       if (request_irq(pdev->irq, superio_interrupt, IRQF_DISABLED,
                        SUPERIO, (void *)sio)) {
 
                printk(KERN_ERR PFX "could not get irq\n");
@@ -359,7 +363,9 @@ int superio_fixup_irq(struct pci_dev *pcidev)
 #endif
 
        for (i = 0; i < 16; i++) {
-               irq_desc[i].handler = &superio_interrupt_type;
+               struct irq_desc *desc = irq_to_desc(i);
+
+               desc->chip = &superio_interrupt_type;
        }
 
        /*
@@ -388,50 +394,40 @@ int superio_fixup_irq(struct pci_dev *pcidev)
        return local_irq;
 }
 
-static struct uart_port serial[] = {
-       {
-               .iotype         = UPIO_PORT,
-               .line           = 0,
-               .type           = PORT_16550A,
-               .uartclk        = 115200*16,
-               .fifosize       = 16,
-       },
-       {
-               .iotype         = UPIO_PORT,
-               .line           = 1,
-               .type           = PORT_16550A,
-               .uartclk        = 115200*16,
-               .fifosize       = 16,
-       }
-};
-
-static void __devinit superio_serial_init(void)
+static void __init superio_serial_init(void)
 {
 #ifdef CONFIG_SERIAL_8250
        int retval;
-        
-       serial[0].iobase = sio_dev.sp1_base;
-       serial[0].irq = SP1_IRQ;
-       spin_lock_init(&serial[0].lock);
-
-       retval = early_serial_setup(&serial[0]);
+       struct uart_port serial_port;
+
+       memset(&serial_port, 0, sizeof(serial_port));
+       serial_port.iotype      = UPIO_PORT;
+       serial_port.type        = PORT_16550A;
+       serial_port.uartclk     = 115200*16;
+       serial_port.fifosize    = 16;
+
+       /* serial port #1 */
+       serial_port.iobase      = sio_dev.sp1_base;
+       serial_port.irq         = SP1_IRQ;
+       serial_port.line        = 0;
+       retval = early_serial_setup(&serial_port);
        if (retval < 0) {
                printk(KERN_WARNING PFX "Register Serial #0 failed.\n");
                return;
        }
 
-       serial[1].iobase = sio_dev.sp2_base;
-       serial[1].irq = SP2_IRQ;
-       spin_lock_init(&serial[1].lock);
-       retval = early_serial_setup(&serial[1]);
-
+       /* serial port #2 */
+       serial_port.iobase      = sio_dev.sp2_base;
+       serial_port.irq         = SP2_IRQ;
+       serial_port.line        = 1;
+       retval = early_serial_setup(&serial_port);
        if (retval < 0)
                printk(KERN_WARNING PFX "Register Serial #1 failed.\n");
 #endif /* CONFIG_SERIAL_8250 */
 }
 
 
-static void __devinit superio_parport_init(void)
+static void __init superio_parport_init(void)
 {
 #ifdef CONFIG_PARPORT_PC
        if (!parport_pc_probe_port(sio_dev.pp_base,
@@ -458,7 +454,7 @@ static void superio_fixup_pci(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, superio_fixup_pci);
 
 
-static int __devinit
+static int __init
 superio_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
        struct superio_device *sio = &sio_dev;
@@ -493,7 +489,7 @@ superio_probe(struct pci_dev *dev, const struct pci_device_id *id)
        return -ENODEV;
 }
 
-static struct pci_device_id superio_tbl[] = {
+static const struct pci_device_id superio_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO) },
        { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_USB) },
        { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415) },