Commit ceb96398 authored by Alexandre Bounine's avatar Alexandre Bounine Committed by Linus Torvalds

rapidio/tsi721: switch to dma_zalloc_coherent

Replace the pair dma_alloc_coherent()+memset() with the new
dma_zalloc_coherent() added by Andrew Morton for kernel version 3.2
Signed-off-by: default avatarAlexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2a95ea6c
...@@ -851,14 +851,12 @@ static int tsi721_doorbell_init(struct tsi721_device *priv) ...@@ -851,14 +851,12 @@ static int tsi721_doorbell_init(struct tsi721_device *priv)
INIT_WORK(&priv->idb_work, tsi721_db_dpc); INIT_WORK(&priv->idb_work, tsi721_db_dpc);
/* Allocate buffer for inbound doorbells queue */ /* Allocate buffer for inbound doorbells queue */
priv->idb_base = dma_alloc_coherent(&priv->pdev->dev, priv->idb_base = dma_zalloc_coherent(&priv->pdev->dev,
IDB_QSIZE * TSI721_IDB_ENTRY_SIZE, IDB_QSIZE * TSI721_IDB_ENTRY_SIZE,
&priv->idb_dma, GFP_KERNEL); &priv->idb_dma, GFP_KERNEL);
if (!priv->idb_base) if (!priv->idb_base)
return -ENOMEM; return -ENOMEM;
memset(priv->idb_base, 0, IDB_QSIZE * TSI721_IDB_ENTRY_SIZE);
dev_dbg(&priv->pdev->dev, "Allocated IDB buffer @ %p (phys = %llx)\n", dev_dbg(&priv->pdev->dev, "Allocated IDB buffer @ %p (phys = %llx)\n",
priv->idb_base, (unsigned long long)priv->idb_dma); priv->idb_base, (unsigned long long)priv->idb_dma);
...@@ -904,7 +902,7 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) ...@@ -904,7 +902,7 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum)
*/ */
/* Allocate space for DMA descriptors */ /* Allocate space for DMA descriptors */
bd_ptr = dma_alloc_coherent(&priv->pdev->dev, bd_ptr = dma_zalloc_coherent(&priv->pdev->dev,
bd_num * sizeof(struct tsi721_dma_desc), bd_num * sizeof(struct tsi721_dma_desc),
&bd_phys, GFP_KERNEL); &bd_phys, GFP_KERNEL);
if (!bd_ptr) if (!bd_ptr)
...@@ -913,8 +911,6 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) ...@@ -913,8 +911,6 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum)
priv->bdma[chnum].bd_phys = bd_phys; priv->bdma[chnum].bd_phys = bd_phys;
priv->bdma[chnum].bd_base = bd_ptr; priv->bdma[chnum].bd_base = bd_ptr;
memset(bd_ptr, 0, bd_num * sizeof(struct tsi721_dma_desc));
dev_dbg(&priv->pdev->dev, "DMA descriptors @ %p (phys = %llx)\n", dev_dbg(&priv->pdev->dev, "DMA descriptors @ %p (phys = %llx)\n",
bd_ptr, (unsigned long long)bd_phys); bd_ptr, (unsigned long long)bd_phys);
...@@ -922,7 +918,7 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) ...@@ -922,7 +918,7 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum)
sts_size = (bd_num >= TSI721_DMA_MINSTSSZ) ? sts_size = (bd_num >= TSI721_DMA_MINSTSSZ) ?
bd_num : TSI721_DMA_MINSTSSZ; bd_num : TSI721_DMA_MINSTSSZ;
sts_size = roundup_pow_of_two(sts_size); sts_size = roundup_pow_of_two(sts_size);
sts_ptr = dma_alloc_coherent(&priv->pdev->dev, sts_ptr = dma_zalloc_coherent(&priv->pdev->dev,
sts_size * sizeof(struct tsi721_dma_sts), sts_size * sizeof(struct tsi721_dma_sts),
&sts_phys, GFP_KERNEL); &sts_phys, GFP_KERNEL);
if (!sts_ptr) { if (!sts_ptr) {
...@@ -938,8 +934,6 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) ...@@ -938,8 +934,6 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum)
priv->bdma[chnum].sts_base = sts_ptr; priv->bdma[chnum].sts_base = sts_ptr;
priv->bdma[chnum].sts_size = sts_size; priv->bdma[chnum].sts_size = sts_size;
memset(sts_ptr, 0, sts_size);
dev_dbg(&priv->pdev->dev, dev_dbg(&priv->pdev->dev,
"desc status FIFO @ %p (phys = %llx) size=0x%x\n", "desc status FIFO @ %p (phys = %llx) size=0x%x\n",
sts_ptr, (unsigned long long)sts_phys, sts_size); sts_ptr, (unsigned long long)sts_phys, sts_size);
...@@ -1400,7 +1394,7 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id, ...@@ -1400,7 +1394,7 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id,
/* Outbound message descriptor status FIFO allocation */ /* Outbound message descriptor status FIFO allocation */
priv->omsg_ring[mbox].sts_size = roundup_pow_of_two(entries + 1); priv->omsg_ring[mbox].sts_size = roundup_pow_of_two(entries + 1);
priv->omsg_ring[mbox].sts_base = dma_alloc_coherent(&priv->pdev->dev, priv->omsg_ring[mbox].sts_base = dma_zalloc_coherent(&priv->pdev->dev,
priv->omsg_ring[mbox].sts_size * priv->omsg_ring[mbox].sts_size *
sizeof(struct tsi721_dma_sts), sizeof(struct tsi721_dma_sts),
&priv->omsg_ring[mbox].sts_phys, GFP_KERNEL); &priv->omsg_ring[mbox].sts_phys, GFP_KERNEL);
...@@ -1412,9 +1406,6 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id, ...@@ -1412,9 +1406,6 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id,
goto out_desc; goto out_desc;
} }
memset(priv->omsg_ring[mbox].sts_base, 0,
entries * sizeof(struct tsi721_dma_sts));
/* /*
* Configure Outbound Messaging Engine * Configure Outbound Messaging Engine
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment