media: ttusb-budget: Remove pci_zalloc_coherent() abuse
authorChristoph Hellwig <hch@lst.de>
Wed, 10 Jan 2018 18:03:19 +0000 (19:03 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 18 Jan 2018 00:01:35 +0000 (18:01 -0600)
Switch to a plain kzalloc() instead of pci_zalloc_coherent() to allocate
memory for the USB DMA.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c

index a142b9d..ea40a24 100644 (file)
@@ -102,7 +102,6 @@ struct ttusb {
        unsigned int isoc_in_pipe;
 
        void *iso_buffer;
-       dma_addr_t iso_dma_handle;
 
        struct urb *iso_urb[ISO_BUF_COUNT];
 
@@ -792,26 +791,17 @@ static void ttusb_free_iso_urbs(struct ttusb *ttusb)
 
        for (i = 0; i < ISO_BUF_COUNT; i++)
                usb_free_urb(ttusb->iso_urb[i]);
-
-       pci_free_consistent(NULL,
-                           ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF *
-                           ISO_BUF_COUNT, ttusb->iso_buffer,
-                           ttusb->iso_dma_handle);
+       kfree(ttusb->iso_buffer);
 }
 
 static int ttusb_alloc_iso_urbs(struct ttusb *ttusb)
 {
        int i;
 
-       ttusb->iso_buffer = pci_zalloc_consistent(NULL,
-                                                 ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF * ISO_BUF_COUNT,
-                                                 &ttusb->iso_dma_handle);
-
-       if (!ttusb->iso_buffer) {
-               dprintk("%s: pci_alloc_consistent - not enough memory\n",
-                       __func__);
+       ttusb->iso_buffer = kcalloc(FRAMES_PER_ISO_BUF * ISO_BUF_COUNT,
+                       ISO_FRAME_SIZE, GFP_KERNEL);
+       if (!ttusb->iso_buffer)
                return -ENOMEM;
-       }
 
        for (i = 0; i < ISO_BUF_COUNT; i++) {
                struct urb *urb;