diff options
-rw-r--r-- | linux/drivers/media/dvb/b2c2/skystar2.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/linux/drivers/media/dvb/b2c2/skystar2.c b/linux/drivers/media/dvb/b2c2/skystar2.c index 775b3a37a..000c84a76 100644 --- a/linux/drivers/media/dvb/b2c2/skystar2.c +++ b/linux/drivers/media/dvb/b2c2/skystar2.c @@ -1725,27 +1725,25 @@ static int init_dma_queue(struct adapter *adapter) return (adapter->dma_status & 0x30000000) ? 0 : -ENOMEM; } -static void free_dma_queue(struct adapter *adapter) +static void free_dma_queue_one(struct adapter *adapter, struct dmaq *dmaq) { - if (adapter->dmaq1.buffer != 0) { - pci_free_consistent(adapter->pdev, SIZE_OF_BUF_DMA1 + 0x80, adapter->dmaq1.buffer, adapter->dmaq1.bus_addr); - - adapter->dmaq1.bus_addr = 0; - adapter->dmaq1.head = 0; - adapter->dmaq1.tail = 0; - adapter->dmaq1.buffer_size = 0; - adapter->dmaq1.buffer = NULL; + if (dmaq->buffer) { + pci_free_consistent(adapter->pdev, dmaq->buffer_size + 0x80, + dmaq->buffer, dmaq->bus_addr); + memset(dmaq, 0, sizeof(*dmaq)); } +} - if (adapter->dmaq2.buffer != 0) { - pci_free_consistent(adapter->pdev, SIZE_OF_BUF_DMA2 + 0x80, adapter->dmaq2.buffer, adapter->dmaq2.bus_addr); +static void free_dma_queue(struct adapter *adapter) +{ + struct dmaq *dmaq[] = { + &adapter->dmaq1, + &adapter->dmaq2, + NULL + }, **p; - adapter->dmaq2.bus_addr = 0; - adapter->dmaq2.head = 0; - adapter->dmaq2.tail = 0; - adapter->dmaq2.buffer_size = 0; - adapter->dmaq2.buffer = NULL; - } + for (p = dmaq; *p; p++) + free_dma_queue_one(adapter, *p); } static void free_adapter_object(struct adapter *adapter) |