Commit 6f2a011a authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

atm: use pci_zalloc_consistent

Remove the now unnecessary memset too.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Chas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 82bf0baa
...@@ -533,14 +533,13 @@ static void he_init_tx_lbfp(struct he_dev *he_dev) ...@@ -533,14 +533,13 @@ static void he_init_tx_lbfp(struct he_dev *he_dev)
static int he_init_tpdrq(struct he_dev *he_dev) static int he_init_tpdrq(struct he_dev *he_dev)
{ {
he_dev->tpdrq_base = pci_alloc_consistent(he_dev->pci_dev, he_dev->tpdrq_base = pci_zalloc_consistent(he_dev->pci_dev,
CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), &he_dev->tpdrq_phys); CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq),
&he_dev->tpdrq_phys);
if (he_dev->tpdrq_base == NULL) { if (he_dev->tpdrq_base == NULL) {
hprintk("failed to alloc tpdrq\n"); hprintk("failed to alloc tpdrq\n");
return -ENOMEM; return -ENOMEM;
} }
memset(he_dev->tpdrq_base, 0,
CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq));
he_dev->tpdrq_tail = he_dev->tpdrq_base; he_dev->tpdrq_tail = he_dev->tpdrq_base;
he_dev->tpdrq_head = he_dev->tpdrq_base; he_dev->tpdrq_head = he_dev->tpdrq_base;
...@@ -804,13 +803,13 @@ static int he_init_group(struct he_dev *he_dev, int group) ...@@ -804,13 +803,13 @@ static int he_init_group(struct he_dev *he_dev, int group)
goto out_free_rbpl_virt; goto out_free_rbpl_virt;
} }
he_dev->rbpl_base = pci_alloc_consistent(he_dev->pci_dev, he_dev->rbpl_base = pci_zalloc_consistent(he_dev->pci_dev,
CONFIG_RBPL_SIZE * sizeof(struct he_rbp), &he_dev->rbpl_phys); CONFIG_RBPL_SIZE * sizeof(struct he_rbp),
&he_dev->rbpl_phys);
if (he_dev->rbpl_base == NULL) { if (he_dev->rbpl_base == NULL) {
hprintk("failed to alloc rbpl_base\n"); hprintk("failed to alloc rbpl_base\n");
goto out_destroy_rbpl_pool; goto out_destroy_rbpl_pool;
} }
memset(he_dev->rbpl_base, 0, CONFIG_RBPL_SIZE * sizeof(struct he_rbp));
INIT_LIST_HEAD(&he_dev->rbpl_outstanding); INIT_LIST_HEAD(&he_dev->rbpl_outstanding);
...@@ -843,13 +842,13 @@ static int he_init_group(struct he_dev *he_dev, int group) ...@@ -843,13 +842,13 @@ static int he_init_group(struct he_dev *he_dev, int group)
/* rx buffer ready queue */ /* rx buffer ready queue */
he_dev->rbrq_base = pci_alloc_consistent(he_dev->pci_dev, he_dev->rbrq_base = pci_zalloc_consistent(he_dev->pci_dev,
CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), &he_dev->rbrq_phys); CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq),
&he_dev->rbrq_phys);
if (he_dev->rbrq_base == NULL) { if (he_dev->rbrq_base == NULL) {
hprintk("failed to allocate rbrq\n"); hprintk("failed to allocate rbrq\n");
goto out_free_rbpl; goto out_free_rbpl;
} }
memset(he_dev->rbrq_base, 0, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq));
he_dev->rbrq_head = he_dev->rbrq_base; he_dev->rbrq_head = he_dev->rbrq_base;
he_writel(he_dev, he_dev->rbrq_phys, G0_RBRQ_ST + (group * 16)); he_writel(he_dev, he_dev->rbrq_phys, G0_RBRQ_ST + (group * 16));
...@@ -867,13 +866,13 @@ static int he_init_group(struct he_dev *he_dev, int group) ...@@ -867,13 +866,13 @@ static int he_init_group(struct he_dev *he_dev, int group)
/* tx buffer ready queue */ /* tx buffer ready queue */
he_dev->tbrq_base = pci_alloc_consistent(he_dev->pci_dev, he_dev->tbrq_base = pci_zalloc_consistent(he_dev->pci_dev,
CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), &he_dev->tbrq_phys); CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
&he_dev->tbrq_phys);
if (he_dev->tbrq_base == NULL) { if (he_dev->tbrq_base == NULL) {
hprintk("failed to allocate tbrq\n"); hprintk("failed to allocate tbrq\n");
goto out_free_rbpq_base; goto out_free_rbpq_base;
} }
memset(he_dev->tbrq_base, 0, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq));
he_dev->tbrq_head = he_dev->tbrq_base; he_dev->tbrq_head = he_dev->tbrq_base;
...@@ -1460,13 +1459,13 @@ static int he_start(struct atm_dev *dev) ...@@ -1460,13 +1459,13 @@ static int he_start(struct atm_dev *dev)
/* host status page */ /* host status page */
he_dev->hsp = pci_alloc_consistent(he_dev->pci_dev, he_dev->hsp = pci_zalloc_consistent(he_dev->pci_dev,
sizeof(struct he_hsp), &he_dev->hsp_phys); sizeof(struct he_hsp),
&he_dev->hsp_phys);
if (he_dev->hsp == NULL) { if (he_dev->hsp == NULL) {
hprintk("failed to allocate host status page\n"); hprintk("failed to allocate host status page\n");
return -ENOMEM; return -ENOMEM;
} }
memset(he_dev->hsp, 0, sizeof(struct he_hsp));
he_writel(he_dev, he_dev->hsp_phys, HSP_BA); he_writel(he_dev, he_dev->hsp_phys, HSP_BA);
/* initialize framer */ /* initialize framer */
......
...@@ -641,13 +641,11 @@ alloc_scq(struct idt77252_dev *card, int class) ...@@ -641,13 +641,11 @@ alloc_scq(struct idt77252_dev *card, int class)
scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL); scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL);
if (!scq) if (!scq)
return NULL; return NULL;
scq->base = pci_alloc_consistent(card->pcidev, SCQ_SIZE, scq->base = pci_zalloc_consistent(card->pcidev, SCQ_SIZE, &scq->paddr);
&scq->paddr);
if (scq->base == NULL) { if (scq->base == NULL) {
kfree(scq); kfree(scq);
return NULL; return NULL;
} }
memset(scq->base, 0, SCQ_SIZE);
scq->next = scq->base; scq->next = scq->base;
scq->last = scq->base + (SCQ_ENTRIES - 1); scq->last = scq->base + (SCQ_ENTRIES - 1);
...@@ -972,13 +970,12 @@ init_rsq(struct idt77252_dev *card) ...@@ -972,13 +970,12 @@ init_rsq(struct idt77252_dev *card)
{ {
struct rsq_entry *rsqe; struct rsq_entry *rsqe;
card->rsq.base = pci_alloc_consistent(card->pcidev, RSQSIZE, card->rsq.base = pci_zalloc_consistent(card->pcidev, RSQSIZE,
&card->rsq.paddr); &card->rsq.paddr);
if (card->rsq.base == NULL) { if (card->rsq.base == NULL) {
printk("%s: can't allocate RSQ.\n", card->name); printk("%s: can't allocate RSQ.\n", card->name);
return -1; return -1;
} }
memset(card->rsq.base, 0, RSQSIZE);
card->rsq.last = card->rsq.base + RSQ_NUM_ENTRIES - 1; card->rsq.last = card->rsq.base + RSQ_NUM_ENTRIES - 1;
card->rsq.next = card->rsq.last; card->rsq.next = card->rsq.last;
...@@ -3400,14 +3397,14 @@ static int init_card(struct atm_dev *dev) ...@@ -3400,14 +3397,14 @@ static int init_card(struct atm_dev *dev)
writel(0, SAR_REG_GP); writel(0, SAR_REG_GP);
/* Initialize RAW Cell Handle Register */ /* Initialize RAW Cell Handle Register */
card->raw_cell_hnd = pci_alloc_consistent(card->pcidev, 2 * sizeof(u32), card->raw_cell_hnd = pci_zalloc_consistent(card->pcidev,
2 * sizeof(u32),
&card->raw_cell_paddr); &card->raw_cell_paddr);
if (!card->raw_cell_hnd) { if (!card->raw_cell_hnd) {
printk("%s: memory allocation failure.\n", card->name); printk("%s: memory allocation failure.\n", card->name);
deinit_card(card); deinit_card(card);
return -1; return -1;
} }
memset(card->raw_cell_hnd, 0, 2 * sizeof(u32));
writel(card->raw_cell_paddr, SAR_REG_RAWHND); writel(card->raw_cell_paddr, SAR_REG_RAWHND);
IPRINTK("%s: raw cell handle is at 0x%p.\n", card->name, IPRINTK("%s: raw cell handle is at 0x%p.\n", card->name,
card->raw_cell_hnd); card->raw_cell_hnd);
......
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