atm: remove deprecated use of pci api
[firefly-linux-kernel-4.4.55.git] / drivers / atm / zatm.c
index 969c3c29000c3622094068d940b854d251393673..cecfb943762f6a1be4c7973e64583767a54edce6 100644 (file)
@@ -1306,19 +1306,20 @@ static int zatm_start(struct atm_dev *dev)
 
                if (!mbx_entries[i])
                        continue;
-               mbx = pci_alloc_consistent(pdev, 2*MBX_SIZE(i), &mbx_dma);
+               mbx = dma_alloc_coherent(&pdev->dev,
+                                        2 * MBX_SIZE(i), &mbx_dma, GFP_KERNEL);
                if (!mbx) {
                        error = -ENOMEM;
                        goto out;
                }
                /*
-                * Alignment provided by pci_alloc_consistent() isn't enough
+                * Alignment provided by dma_alloc_coherent() isn't enough
                 * for this device.
                 */
                if (((unsigned long)mbx ^ mbx_dma) & 0xffff) {
                        printk(KERN_ERR DEV_LABEL "(itf %d): system "
                               "bus incompatible with driver\n", dev->number);
-                       pci_free_consistent(pdev, 2*MBX_SIZE(i), mbx, mbx_dma);
+                       dma_free_coherent(&pdev->dev, 2*MBX_SIZE(i), mbx, mbx_dma);
                        error = -ENODEV;
                        goto out;
                }
@@ -1354,9 +1355,9 @@ out_tx:
        kfree(zatm_dev->tx_map);
 out:
        while (i-- > 0) {
-               pci_free_consistent(pdev, 2*MBX_SIZE(i), 
-                                   (void *)zatm_dev->mbx_start[i],
-                                   zatm_dev->mbx_dma[i]);
+               dma_free_coherent(&pdev->dev, 2 * MBX_SIZE(i),
+                                 (void *)zatm_dev->mbx_start[i],
+                                 zatm_dev->mbx_dma[i]);
        }
        free_irq(zatm_dev->irq, dev);
        goto done;
@@ -1608,6 +1609,10 @@ static int zatm_init_one(struct pci_dev *pci_dev,
        if (ret < 0)
                goto out_disable;
 
+       ret = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32));
+       if (ret < 0)
+               goto out_disable;
+
        zatm_dev->pci_dev = pci_dev;
        dev->dev_data = zatm_dev;
        zatm_dev->copper = (int)ent->driver_data;