]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/serial/jsm/jsm_driver.c
Serial: Allow port type to be specified when calling serial8250_register_port.
[mv-sheeva.git] / drivers / serial / jsm / jsm_driver.c
index 244f63be3a03f777819ba5471563af8bd7e4a936..338cf8a08b436db85c1b9d11b10b2f868e93fd24 100644 (file)
@@ -71,25 +71,27 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto out_disable_device;
        }
 
-       brd = kmalloc(sizeof(struct jsm_board), GFP_KERNEL);
+       brd = kzalloc(sizeof(struct jsm_board), GFP_KERNEL);
        if (!brd) {
                dev_err(&pdev->dev,
                        "memory allocation for board structure failed\n");
                rc = -ENOMEM;
                goto out_release_regions;
        }
-       memset(brd, 0, sizeof(struct jsm_board));
 
        /* store the info for the board we've found */
        brd->boardnum = adapter_count++;
        brd->pci_dev = pdev;
-       brd->maxports = 2;
+       if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM)
+               brd->maxports = 4;
+       else
+               brd->maxports = 2;
 
        spin_lock_init(&brd->bd_lock);
        spin_lock_init(&brd->bd_intr_lock);
 
        /* store which revision we have */
-       pci_read_config_byte(pdev, PCI_REVISION_ID, &brd->rev);
+       brd->rev = pdev->revision;
 
        brd->irq = pdev->irq;
 
@@ -152,7 +154,7 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
         * Okay to malloc with GFP_KERNEL, we are not at interrupt
         * context, and there are no locks held.
         */
-       brd->flipbuf = kmalloc(MYFLIPLEN, GFP_KERNEL);
+       brd->flipbuf = kzalloc(MYFLIPLEN, GFP_KERNEL);
        if (!brd->flipbuf) {
                /* XXX: leaking all resources from jsm_tty_init and
                        jsm_uart_port_init here! */
@@ -160,7 +162,6 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                retval = -ENOMEM;
                goto out_free_irq;
        }
-       memset(brd->flipbuf, 0, MYFLIPLEN);
 
        pci_set_drvdata(pdev, brd);
 
@@ -210,6 +211,7 @@ static struct pci_device_id jsm_pci_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2DB9PRI), 0, 0, 1 },
        { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 },
        { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 },
+       { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 },
        { 0, }
 };
 MODULE_DEVICE_TABLE(pci, jsm_pci_tbl);