aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorMark Ware <mware@elphinstone.net>2009-04-21 08:49:02 -0400
committerBen Dooks <ben-linux@fluff.org>2009-05-11 19:36:04 -0400
commit36521c271e5f93b249329ee7f321d27825970e31 (patch)
tree5117296787f05cfd817db197fe0c468c84f22b18 /drivers/i2c
parent89bc5d4a915dc6675961f797de91748bda87efcc (diff)
i2c-cpm: Pass dev ptr to dma_*_coherent rather than NULL
Recent DMA changes result in a BUG() when NULL is passed to dma_alloc_coherent in place of a device. Signed-off-by: Mark Ware <mware@elphinstone.net> [ben-linux@fluff.org: fix patch moves] Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-cpm.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index 3fcf78e906db..b5db8b883615 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -531,16 +531,16 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
531 rbdf = cpm->rbase; 531 rbdf = cpm->rbase;
532 532
533 for (i = 0; i < CPM_MAXBD; i++) { 533 for (i = 0; i < CPM_MAXBD; i++) {
534 cpm->rxbuf[i] = dma_alloc_coherent( 534 cpm->rxbuf[i] = dma_alloc_coherent(&cpm->ofdev->dev,
535 NULL, CPM_MAX_READ + 1, &cpm->rxdma[i], GFP_KERNEL); 535 CPM_MAX_READ + 1,
536 &cpm->rxdma[i], GFP_KERNEL);
536 if (!cpm->rxbuf[i]) { 537 if (!cpm->rxbuf[i]) {
537 ret = -ENOMEM; 538 ret = -ENOMEM;
538 goto out_muram; 539 goto out_muram;
539 } 540 }
540 out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1)); 541 out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1));
541 542
542 cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent( 543 cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL);
543 NULL, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL);
544 if (!cpm->txbuf[i]) { 544 if (!cpm->txbuf[i]) {
545 ret = -ENOMEM; 545 ret = -ENOMEM;
546 goto out_muram; 546 goto out_muram;
@@ -585,10 +585,10 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
585out_muram: 585out_muram:
586 for (i = 0; i < CPM_MAXBD; i++) { 586 for (i = 0; i < CPM_MAXBD; i++) {
587 if (cpm->rxbuf[i]) 587 if (cpm->rxbuf[i])
588 dma_free_coherent(NULL, CPM_MAX_READ + 1, 588 dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
589 cpm->rxbuf[i], cpm->rxdma[i]); 589 cpm->rxbuf[i], cpm->rxdma[i]);
590 if (cpm->txbuf[i]) 590 if (cpm->txbuf[i])
591 dma_free_coherent(NULL, CPM_MAX_READ + 1, 591 dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
592 cpm->txbuf[i], cpm->txdma[i]); 592 cpm->txbuf[i], cpm->txdma[i]);
593 } 593 }
594 cpm_muram_free(cpm->dp_addr); 594 cpm_muram_free(cpm->dp_addr);
@@ -619,9 +619,9 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)
619 619
620 /* Free all memory */ 620 /* Free all memory */
621 for (i = 0; i < CPM_MAXBD; i++) { 621 for (i = 0; i < CPM_MAXBD; i++) {
622 dma_free_coherent(NULL, CPM_MAX_READ + 1, 622 dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
623 cpm->rxbuf[i], cpm->rxdma[i]); 623 cpm->rxbuf[i], cpm->rxdma[i]);
624 dma_free_coherent(NULL, CPM_MAX_READ + 1, 624 dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
625 cpm->txbuf[i], cpm->txdma[i]); 625 cpm->txbuf[i], cpm->txdma[i]);
626 } 626 }
627 627