Merge branches 'x86/acpi', 'x86/asm', 'x86/cpudetect', 'x86/crashdump', 'x86/debug...
[safe/jmp/linux-2.6] / drivers / parport / parport_serial.c
index e06223c..032db81 100644 (file)
@@ -64,12 +64,19 @@ struct parport_pc_pci {
 
 static int __devinit netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *card, int autoirq, int autodma)
 {
+       /* the rule described below doesn't hold for this device */
+       if (dev->device == PCI_DEVICE_ID_NETMOS_9835 &&
+                       dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
+                       dev->subsystem_device == 0x0299)
+               return -ENODEV;
        /*
         * Netmos uses the subdevice ID to indicate the number of parallel
         * and serial ports.  The form is 0x00PS, where <P> is the number of
         * parallel ports and <S> is the number of serial ports.
         */
        card->numports = (dev->subsystem_device & 0xf0) >> 4;
+       if (card->numports > ARRAY_SIZE(card->addr))
+               card->numports = ARRAY_SIZE(card->addr);
        return 0;
 }
 
@@ -77,7 +84,7 @@ static struct parport_pc_pci cards[] __devinitdata = {
        /* titan_110l */                { 1, { { 3, -1 }, } },
        /* titan_210l */                { 1, { { 3, -1 }, } },
        /* netmos_9xx5_combo */         { 1, { { 2, -1 }, }, netmos_parallel_init },
-       /* netmos_9855 */               { 1, { { 0, -1 }, }, netmos_parallel_init },
+       /* netmos_9855 */               { 1, { { 2, -1 }, }, netmos_parallel_init },
        /* avlab_1s1p     */            { 1, { { 1, 2}, } },
        /* avlab_1s2p     */            { 2, { { 1, 2}, { 3, 4 },} },
        /* avlab_2s1p     */            { 1, { { 2, 3}, } },
@@ -185,7 +192,7 @@ static struct pciserial_board pci_parport_serial_boards[] __devinitdata = {
                .uart_offset    = 8,
        },
        [netmos_9855] = {
-               .flags          = FL_BASE2 | FL_BASE_BARS,
+               .flags          = FL_BASE4 | FL_BASE_BARS,
                .num_ports      = 1,
                .base_baud      = 115200,
                .uart_offset    = 8,
@@ -324,10 +331,9 @@ static int __devinit parport_serial_pci_probe (struct pci_dev *dev,
        struct parport_serial_private *priv;
        int err;
 
-       priv = kmalloc (sizeof *priv, GFP_KERNEL);
+       priv = kzalloc (sizeof *priv, GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
-       memset(priv, 0, sizeof(struct parport_serial_private));
        pci_set_drvdata (dev, priv);
 
        err = pci_enable_device (dev);
@@ -392,6 +398,7 @@ static int parport_serial_pci_suspend(struct pci_dev *dev, pm_message_t state)
 static int parport_serial_pci_resume(struct pci_dev *dev)
 {
        struct parport_serial_private *priv = pci_get_drvdata(dev);
+       int err;
 
        pci_set_power_state(dev, PCI_D0);
        pci_restore_state(dev);
@@ -399,7 +406,12 @@ static int parport_serial_pci_resume(struct pci_dev *dev)
        /*
         * The device may have been disabled.  Re-enable it.
         */
-       pci_enable_device(dev);
+       err = pci_enable_device(dev);
+       if (err) {
+               printk(KERN_ERR "parport_serial: %s: error enabling "
+                       "device for resume (%d)\n", pci_name(dev), err);
+               return err;
+       }
 
        if (priv->serial)
                pciserial_resume_ports(priv->serial);