Merge branch 'x86-pmem-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / drivers / atm / lanai.c
index 93eaf8d944926a706c3fe5b5bf1baac6a49c5c7c..ce43ae3e87b3513245cf5b322d5a4b4984ec9dfa 100644 (file)
@@ -346,7 +346,8 @@ static void lanai_buf_allocate(struct lanai_buffer *buf,
                 * everything, but the way the lanai uses DMA memory would
                 * make that a terrific pain.  This is much simpler.
                 */
-               buf->start = pci_alloc_consistent(pci, size, &buf->dmaaddr);
+               buf->start = dma_alloc_coherent(&pci->dev,
+                                               size, &buf->dmaaddr, GFP_KERNEL);
                if (buf->start != NULL) {       /* Success */
                        /* Lanai requires 256-byte alignment of DMA bufs */
                        APRINTK((buf->dmaaddr & ~0xFFFFFF00) == 0,
@@ -372,8 +373,8 @@ static void lanai_buf_deallocate(struct lanai_buffer *buf,
        struct pci_dev *pci)
 {
        if (buf->start != NULL) {
-               pci_free_consistent(pci, lanai_buf_size(buf),
-                   buf->start, buf->dmaaddr);
+               dma_free_coherent(&pci->dev, lanai_buf_size(buf),
+                                 buf->start, buf->dmaaddr);
                buf->start = buf->end = buf->ptr = NULL;
        }
 }
@@ -681,15 +682,6 @@ static inline int aal5_size(int size)
        return cells * 48;
 }
 
-/* How many bytes can we send if we have "space" space, assuming we have
- * to send full cells
- */
-static inline int aal5_spacefor(int space)
-{
-       int cells = space / 48;
-       return cells * 48;
-}
-
 /* -------------------- FREE AN ATM SKB: */
 
 static inline void lanai_free_skb(struct atm_vcc *atmvcc, struct sk_buff *skb)
@@ -1953,12 +1945,7 @@ static int lanai_pci_start(struct lanai_dev *lanai)
                return -ENXIO;
        }
        pci_set_master(pci);
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) != 0) {
-               printk(KERN_WARNING DEV_LABEL
-                   "(itf %d): No suitable DMA available.\n", lanai->number);
-               return -EBUSY;
-       }
-       if (pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) != 0) {
+       if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32)) != 0) {
                printk(KERN_WARNING DEV_LABEL
                    "(itf %d): No suitable DMA available.\n", lanai->number);
                return -EBUSY;