diff options
author | Joe Perches <joe@perches.com> | 2014-08-08 17:24:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-08 18:57:28 -0400 |
commit | 6f2a011afc324260d8e5e2aa480a58c34283c581 (patch) | |
tree | 158516a261527d7866cf83c2a1e88926eb7738a7 /drivers | |
parent | 82bf0baad9768c21850d06ddc24ea47984c4c90f (diff) |
atm: use pci_zalloc_consistent
Remove the now unnecessary memset too.
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Chas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/atm/he.c | 31 | ||||
-rw-r--r-- | drivers/atm/idt77252.c | 15 |
2 files changed, 21 insertions, 25 deletions
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index aa6be2698669..c39702bc279d 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c | |||
@@ -533,14 +533,13 @@ static void he_init_tx_lbfp(struct he_dev *he_dev) | |||
533 | 533 | ||
534 | static int he_init_tpdrq(struct he_dev *he_dev) | 534 | static int he_init_tpdrq(struct he_dev *he_dev) |
535 | { | 535 | { |
536 | he_dev->tpdrq_base = pci_alloc_consistent(he_dev->pci_dev, | 536 | he_dev->tpdrq_base = pci_zalloc_consistent(he_dev->pci_dev, |
537 | CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), &he_dev->tpdrq_phys); | 537 | CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), |
538 | &he_dev->tpdrq_phys); | ||
538 | if (he_dev->tpdrq_base == NULL) { | 539 | if (he_dev->tpdrq_base == NULL) { |
539 | hprintk("failed to alloc tpdrq\n"); | 540 | hprintk("failed to alloc tpdrq\n"); |
540 | return -ENOMEM; | 541 | return -ENOMEM; |
541 | } | 542 | } |
542 | memset(he_dev->tpdrq_base, 0, | ||
543 | CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq)); | ||
544 | 543 | ||
545 | he_dev->tpdrq_tail = he_dev->tpdrq_base; | 544 | he_dev->tpdrq_tail = he_dev->tpdrq_base; |
546 | he_dev->tpdrq_head = he_dev->tpdrq_base; | 545 | 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 | goto out_free_rbpl_virt; | 803 | goto out_free_rbpl_virt; |
805 | } | 804 | } |
806 | 805 | ||
807 | he_dev->rbpl_base = pci_alloc_consistent(he_dev->pci_dev, | 806 | he_dev->rbpl_base = pci_zalloc_consistent(he_dev->pci_dev, |
808 | CONFIG_RBPL_SIZE * sizeof(struct he_rbp), &he_dev->rbpl_phys); | 807 | CONFIG_RBPL_SIZE * sizeof(struct he_rbp), |
808 | &he_dev->rbpl_phys); | ||
809 | if (he_dev->rbpl_base == NULL) { | 809 | if (he_dev->rbpl_base == NULL) { |
810 | hprintk("failed to alloc rbpl_base\n"); | 810 | hprintk("failed to alloc rbpl_base\n"); |
811 | goto out_destroy_rbpl_pool; | 811 | goto out_destroy_rbpl_pool; |
812 | } | 812 | } |
813 | memset(he_dev->rbpl_base, 0, CONFIG_RBPL_SIZE * sizeof(struct he_rbp)); | ||
814 | 813 | ||
815 | INIT_LIST_HEAD(&he_dev->rbpl_outstanding); | 814 | INIT_LIST_HEAD(&he_dev->rbpl_outstanding); |
816 | 815 | ||
@@ -843,13 +842,13 @@ static int he_init_group(struct he_dev *he_dev, int group) | |||
843 | 842 | ||
844 | /* rx buffer ready queue */ | 843 | /* rx buffer ready queue */ |
845 | 844 | ||
846 | he_dev->rbrq_base = pci_alloc_consistent(he_dev->pci_dev, | 845 | he_dev->rbrq_base = pci_zalloc_consistent(he_dev->pci_dev, |
847 | CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), &he_dev->rbrq_phys); | 846 | CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), |
847 | &he_dev->rbrq_phys); | ||
848 | if (he_dev->rbrq_base == NULL) { | 848 | if (he_dev->rbrq_base == NULL) { |
849 | hprintk("failed to allocate rbrq\n"); | 849 | hprintk("failed to allocate rbrq\n"); |
850 | goto out_free_rbpl; | 850 | goto out_free_rbpl; |
851 | } | 851 | } |
852 | memset(he_dev->rbrq_base, 0, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq)); | ||
853 | 852 | ||
854 | he_dev->rbrq_head = he_dev->rbrq_base; | 853 | he_dev->rbrq_head = he_dev->rbrq_base; |
855 | he_writel(he_dev, he_dev->rbrq_phys, G0_RBRQ_ST + (group * 16)); | 854 | 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 | 866 | ||
868 | /* tx buffer ready queue */ | 867 | /* tx buffer ready queue */ |
869 | 868 | ||
870 | he_dev->tbrq_base = pci_alloc_consistent(he_dev->pci_dev, | 869 | he_dev->tbrq_base = pci_zalloc_consistent(he_dev->pci_dev, |
871 | CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), &he_dev->tbrq_phys); | 870 | CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), |
871 | &he_dev->tbrq_phys); | ||
872 | if (he_dev->tbrq_base == NULL) { | 872 | if (he_dev->tbrq_base == NULL) { |
873 | hprintk("failed to allocate tbrq\n"); | 873 | hprintk("failed to allocate tbrq\n"); |
874 | goto out_free_rbpq_base; | 874 | goto out_free_rbpq_base; |
875 | } | 875 | } |
876 | memset(he_dev->tbrq_base, 0, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq)); | ||
877 | 876 | ||
878 | he_dev->tbrq_head = he_dev->tbrq_base; | 877 | he_dev->tbrq_head = he_dev->tbrq_base; |
879 | 878 | ||
@@ -1460,13 +1459,13 @@ static int he_start(struct atm_dev *dev) | |||
1460 | 1459 | ||
1461 | /* host status page */ | 1460 | /* host status page */ |
1462 | 1461 | ||
1463 | he_dev->hsp = pci_alloc_consistent(he_dev->pci_dev, | 1462 | he_dev->hsp = pci_zalloc_consistent(he_dev->pci_dev, |
1464 | sizeof(struct he_hsp), &he_dev->hsp_phys); | 1463 | sizeof(struct he_hsp), |
1464 | &he_dev->hsp_phys); | ||
1465 | if (he_dev->hsp == NULL) { | 1465 | if (he_dev->hsp == NULL) { |
1466 | hprintk("failed to allocate host status page\n"); | 1466 | hprintk("failed to allocate host status page\n"); |
1467 | return -ENOMEM; | 1467 | return -ENOMEM; |
1468 | } | 1468 | } |
1469 | memset(he_dev->hsp, 0, sizeof(struct he_hsp)); | ||
1470 | he_writel(he_dev, he_dev->hsp_phys, HSP_BA); | 1469 | he_writel(he_dev, he_dev->hsp_phys, HSP_BA); |
1471 | 1470 | ||
1472 | /* initialize framer */ | 1471 | /* initialize framer */ |
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index b621f56a36be..2b24ed056728 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c | |||
@@ -641,13 +641,11 @@ alloc_scq(struct idt77252_dev *card, int class) | |||
641 | scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL); | 641 | scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL); |
642 | if (!scq) | 642 | if (!scq) |
643 | return NULL; | 643 | return NULL; |
644 | scq->base = pci_alloc_consistent(card->pcidev, SCQ_SIZE, | 644 | scq->base = pci_zalloc_consistent(card->pcidev, SCQ_SIZE, &scq->paddr); |
645 | &scq->paddr); | ||
646 | if (scq->base == NULL) { | 645 | if (scq->base == NULL) { |
647 | kfree(scq); | 646 | kfree(scq); |
648 | return NULL; | 647 | return NULL; |
649 | } | 648 | } |
650 | memset(scq->base, 0, SCQ_SIZE); | ||
651 | 649 | ||
652 | scq->next = scq->base; | 650 | scq->next = scq->base; |
653 | scq->last = scq->base + (SCQ_ENTRIES - 1); | 651 | scq->last = scq->base + (SCQ_ENTRIES - 1); |
@@ -972,13 +970,12 @@ init_rsq(struct idt77252_dev *card) | |||
972 | { | 970 | { |
973 | struct rsq_entry *rsqe; | 971 | struct rsq_entry *rsqe; |
974 | 972 | ||
975 | card->rsq.base = pci_alloc_consistent(card->pcidev, RSQSIZE, | 973 | card->rsq.base = pci_zalloc_consistent(card->pcidev, RSQSIZE, |
976 | &card->rsq.paddr); | 974 | &card->rsq.paddr); |
977 | if (card->rsq.base == NULL) { | 975 | if (card->rsq.base == NULL) { |
978 | printk("%s: can't allocate RSQ.\n", card->name); | 976 | printk("%s: can't allocate RSQ.\n", card->name); |
979 | return -1; | 977 | return -1; |
980 | } | 978 | } |
981 | memset(card->rsq.base, 0, RSQSIZE); | ||
982 | 979 | ||
983 | card->rsq.last = card->rsq.base + RSQ_NUM_ENTRIES - 1; | 980 | card->rsq.last = card->rsq.base + RSQ_NUM_ENTRIES - 1; |
984 | card->rsq.next = card->rsq.last; | 981 | card->rsq.next = card->rsq.last; |
@@ -3400,14 +3397,14 @@ static int init_card(struct atm_dev *dev) | |||
3400 | writel(0, SAR_REG_GP); | 3397 | writel(0, SAR_REG_GP); |
3401 | 3398 | ||
3402 | /* Initialize RAW Cell Handle Register */ | 3399 | /* Initialize RAW Cell Handle Register */ |
3403 | card->raw_cell_hnd = pci_alloc_consistent(card->pcidev, 2 * sizeof(u32), | 3400 | card->raw_cell_hnd = pci_zalloc_consistent(card->pcidev, |
3404 | &card->raw_cell_paddr); | 3401 | 2 * sizeof(u32), |
3402 | &card->raw_cell_paddr); | ||
3405 | if (!card->raw_cell_hnd) { | 3403 | if (!card->raw_cell_hnd) { |
3406 | printk("%s: memory allocation failure.\n", card->name); | 3404 | printk("%s: memory allocation failure.\n", card->name); |
3407 | deinit_card(card); | 3405 | deinit_card(card); |
3408 | return -1; | 3406 | return -1; |
3409 | } | 3407 | } |
3410 | memset(card->raw_cell_hnd, 0, 2 * sizeof(u32)); | ||
3411 | writel(card->raw_cell_paddr, SAR_REG_RAWHND); | 3408 | writel(card->raw_cell_paddr, SAR_REG_RAWHND); |
3412 | IPRINTK("%s: raw cell handle is at 0x%p.\n", card->name, | 3409 | IPRINTK("%s: raw cell handle is at 0x%p.\n", card->name, |
3413 | card->raw_cell_hnd); | 3410 | card->raw_cell_hnd); |