aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-08-08 17:24:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-08 18:57:28 -0400
commit6850aeabdd1fde7cd35f26d4e8779bec943e1cd9 (patch)
tree8bf82328936e4762df92a48129bc0bc65c580d60 /drivers/media
parent59e2623b433552d7402dfacd2bc2d7a22a360a4f (diff)
media: use pci_zalloc_consistent
Remove the now unnecessary memset too. Signed-off-by: Joe Perches <joe@perches.com> Cc: Hans Verkuil <hverkuil@xs4all.nl> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/common/saa7146/saa7146_core.c15
-rw-r--r--drivers/media/common/saa7146/saa7146_fops.c5
-rw-r--r--drivers/media/pci/bt8xx/bt878.c16
-rw-r--r--drivers/media/pci/ngene/ngene-core.c7
-rw-r--r--drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c11
-rw-r--r--drivers/media/usb/ttusb-dec/ttusb_dec.c11
6 files changed, 22 insertions, 43 deletions
diff --git a/drivers/media/common/saa7146/saa7146_core.c b/drivers/media/common/saa7146/saa7146_core.c
index 34b0d0ddeef3..97afee672d07 100644
--- a/drivers/media/common/saa7146/saa7146_core.c
+++ b/drivers/media/common/saa7146/saa7146_core.c
@@ -421,23 +421,20 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
421 err = -ENOMEM; 421 err = -ENOMEM;
422 422
423 /* get memory for various stuff */ 423 /* get memory for various stuff */
424 dev->d_rps0.cpu_addr = pci_alloc_consistent(pci, SAA7146_RPS_MEM, 424 dev->d_rps0.cpu_addr = pci_zalloc_consistent(pci, SAA7146_RPS_MEM,
425 &dev->d_rps0.dma_handle); 425 &dev->d_rps0.dma_handle);
426 if (!dev->d_rps0.cpu_addr) 426 if (!dev->d_rps0.cpu_addr)
427 goto err_free_irq; 427 goto err_free_irq;
428 memset(dev->d_rps0.cpu_addr, 0x0, SAA7146_RPS_MEM);
429 428
430 dev->d_rps1.cpu_addr = pci_alloc_consistent(pci, SAA7146_RPS_MEM, 429 dev->d_rps1.cpu_addr = pci_zalloc_consistent(pci, SAA7146_RPS_MEM,
431 &dev->d_rps1.dma_handle); 430 &dev->d_rps1.dma_handle);
432 if (!dev->d_rps1.cpu_addr) 431 if (!dev->d_rps1.cpu_addr)
433 goto err_free_rps0; 432 goto err_free_rps0;
434 memset(dev->d_rps1.cpu_addr, 0x0, SAA7146_RPS_MEM);
435 433
436 dev->d_i2c.cpu_addr = pci_alloc_consistent(pci, SAA7146_RPS_MEM, 434 dev->d_i2c.cpu_addr = pci_zalloc_consistent(pci, SAA7146_RPS_MEM,
437 &dev->d_i2c.dma_handle); 435 &dev->d_i2c.dma_handle);
438 if (!dev->d_i2c.cpu_addr) 436 if (!dev->d_i2c.cpu_addr)
439 goto err_free_rps1; 437 goto err_free_rps1;
440 memset(dev->d_i2c.cpu_addr, 0x0, SAA7146_RPS_MEM);
441 438
442 /* the rest + print status message */ 439 /* the rest + print status message */
443 440
diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c
index d9e1d6395ed9..6c47f3fe9b0f 100644
--- a/drivers/media/common/saa7146/saa7146_fops.c
+++ b/drivers/media/common/saa7146/saa7146_fops.c
@@ -520,14 +520,15 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
520 configuration data) */ 520 configuration data) */
521 dev->ext_vv_data = ext_vv; 521 dev->ext_vv_data = ext_vv;
522 522
523 vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle); 523 vv->d_clipping.cpu_addr =
524 pci_zalloc_consistent(dev->pci, SAA7146_CLIPPING_MEM,
525 &vv->d_clipping.dma_handle);
524 if( NULL == vv->d_clipping.cpu_addr ) { 526 if( NULL == vv->d_clipping.cpu_addr ) {
525 ERR("out of memory. aborting.\n"); 527 ERR("out of memory. aborting.\n");
526 kfree(vv); 528 kfree(vv);
527 v4l2_ctrl_handler_free(hdl); 529 v4l2_ctrl_handler_free(hdl);
528 return -1; 530 return -1;
529 } 531 }
530 memset(vv->d_clipping.cpu_addr, 0x0, SAA7146_CLIPPING_MEM);
531 532
532 saa7146_video_uops.init(dev,vv); 533 saa7146_video_uops.init(dev,vv);
533 if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) 534 if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c
index d0c281f41a0a..11765835d7b2 100644
--- a/drivers/media/pci/bt8xx/bt878.c
+++ b/drivers/media/pci/bt8xx/bt878.c
@@ -101,28 +101,20 @@ static int bt878_mem_alloc(struct bt878 *bt)
101 if (!bt->buf_cpu) { 101 if (!bt->buf_cpu) {
102 bt->buf_size = 128 * 1024; 102 bt->buf_size = 128 * 1024;
103 103
104 bt->buf_cpu = 104 bt->buf_cpu = pci_zalloc_consistent(bt->dev, bt->buf_size,
105 pci_alloc_consistent(bt->dev, bt->buf_size, 105 &bt->buf_dma);
106 &bt->buf_dma);
107
108 if (!bt->buf_cpu) 106 if (!bt->buf_cpu)
109 return -ENOMEM; 107 return -ENOMEM;
110
111 memset(bt->buf_cpu, 0, bt->buf_size);
112 } 108 }
113 109
114 if (!bt->risc_cpu) { 110 if (!bt->risc_cpu) {
115 bt->risc_size = PAGE_SIZE; 111 bt->risc_size = PAGE_SIZE;
116 bt->risc_cpu = 112 bt->risc_cpu = pci_zalloc_consistent(bt->dev, bt->risc_size,
117 pci_alloc_consistent(bt->dev, bt->risc_size, 113 &bt->risc_dma);
118 &bt->risc_dma);
119
120 if (!bt->risc_cpu) { 114 if (!bt->risc_cpu) {
121 bt878_mem_free(bt); 115 bt878_mem_free(bt);
122 return -ENOMEM; 116 return -ENOMEM;
123 } 117 }
124
125 memset(bt->risc_cpu, 0, bt->risc_size);
126 } 118 }
127 119
128 return 0; 120 return 0;
diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c
index 826228c3800e..4930b55fd5f4 100644
--- a/drivers/media/pci/ngene/ngene-core.c
+++ b/drivers/media/pci/ngene/ngene-core.c
@@ -1075,12 +1075,11 @@ static int AllocCommonBuffers(struct ngene *dev)
1075 dev->ngenetohost = dev->FWInterfaceBuffer + 256; 1075 dev->ngenetohost = dev->FWInterfaceBuffer + 256;
1076 dev->EventBuffer = dev->FWInterfaceBuffer + 512; 1076 dev->EventBuffer = dev->FWInterfaceBuffer + 512;
1077 1077
1078 dev->OverflowBuffer = pci_alloc_consistent(dev->pci_dev, 1078 dev->OverflowBuffer = pci_zalloc_consistent(dev->pci_dev,
1079 OVERFLOW_BUFFER_SIZE, 1079 OVERFLOW_BUFFER_SIZE,
1080 &dev->PAOverflowBuffer); 1080 &dev->PAOverflowBuffer);
1081 if (!dev->OverflowBuffer) 1081 if (!dev->OverflowBuffer)
1082 return -ENOMEM; 1082 return -ENOMEM;
1083 memset(dev->OverflowBuffer, 0, OVERFLOW_BUFFER_SIZE);
1084 1083
1085 for (i = STREAM_VIDEOIN1; i < MAX_STREAM; i++) { 1084 for (i = STREAM_VIDEOIN1; i < MAX_STREAM; i++) {
1086 int type = dev->card_info->io_type[i]; 1085 int type = dev->card_info->io_type[i];
diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
index f166ffc9800a..cef7a00099ea 100644
--- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
@@ -803,11 +803,9 @@ static int ttusb_alloc_iso_urbs(struct ttusb *ttusb)
803{ 803{
804 int i; 804 int i;
805 805
806 ttusb->iso_buffer = pci_alloc_consistent(NULL, 806 ttusb->iso_buffer = pci_zalloc_consistent(NULL,
807 ISO_FRAME_SIZE * 807 ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF * ISO_BUF_COUNT,
808 FRAMES_PER_ISO_BUF * 808 &ttusb->iso_dma_handle);
809 ISO_BUF_COUNT,
810 &ttusb->iso_dma_handle);
811 809
812 if (!ttusb->iso_buffer) { 810 if (!ttusb->iso_buffer) {
813 dprintk("%s: pci_alloc_consistent - not enough memory\n", 811 dprintk("%s: pci_alloc_consistent - not enough memory\n",
@@ -815,9 +813,6 @@ static int ttusb_alloc_iso_urbs(struct ttusb *ttusb)
815 return -ENOMEM; 813 return -ENOMEM;
816 } 814 }
817 815
818 memset(ttusb->iso_buffer, 0,
819 ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF * ISO_BUF_COUNT);
820
821 for (i = 0; i < ISO_BUF_COUNT; i++) { 816 for (i = 0; i < ISO_BUF_COUNT; i++) {
822 struct urb *urb; 817 struct urb *urb;
823 818
diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c
index 29724af9b9ab..15ab584cf265 100644
--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
@@ -1151,11 +1151,9 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec)
1151 1151
1152 dprintk("%s\n", __func__); 1152 dprintk("%s\n", __func__);
1153 1153
1154 dec->iso_buffer = pci_alloc_consistent(NULL, 1154 dec->iso_buffer = pci_zalloc_consistent(NULL,
1155 ISO_FRAME_SIZE * 1155 ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT),
1156 (FRAMES_PER_ISO_BUF * 1156 &dec->iso_dma_handle);
1157 ISO_BUF_COUNT),
1158 &dec->iso_dma_handle);
1159 1157
1160 if (!dec->iso_buffer) { 1158 if (!dec->iso_buffer) {
1161 dprintk("%s: pci_alloc_consistent - not enough memory\n", 1159 dprintk("%s: pci_alloc_consistent - not enough memory\n",
@@ -1163,9 +1161,6 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec)
1163 return -ENOMEM; 1161 return -ENOMEM;
1164 } 1162 }
1165 1163
1166 memset(dec->iso_buffer, 0,
1167 ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT));
1168
1169 for (i = 0; i < ISO_BUF_COUNT; i++) { 1164 for (i = 0; i < ISO_BUF_COUNT; i++) {
1170 struct urb *urb; 1165 struct urb *urb;
1171 1166