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>
This commit is contained in:
parent
89bc5d4a91
commit
36521c271e
1 changed files with 8 additions and 8 deletions
|
@ -531,16 +531,16 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
|
||||||
rbdf = cpm->rbase;
|
rbdf = cpm->rbase;
|
||||||
|
|
||||||
for (i = 0; i < CPM_MAXBD; i++) {
|
for (i = 0; i < CPM_MAXBD; i++) {
|
||||||
cpm->rxbuf[i] = dma_alloc_coherent(
|
cpm->rxbuf[i] = dma_alloc_coherent(&cpm->ofdev->dev,
|
||||||
NULL, CPM_MAX_READ + 1, &cpm->rxdma[i], GFP_KERNEL);
|
CPM_MAX_READ + 1,
|
||||||
|
&cpm->rxdma[i], GFP_KERNEL);
|
||||||
if (!cpm->rxbuf[i]) {
|
if (!cpm->rxbuf[i]) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out_muram;
|
goto out_muram;
|
||||||
}
|
}
|
||||||
out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1));
|
out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1));
|
||||||
|
|
||||||
cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent(
|
cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL);
|
||||||
NULL, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL);
|
|
||||||
if (!cpm->txbuf[i]) {
|
if (!cpm->txbuf[i]) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out_muram;
|
goto out_muram;
|
||||||
|
@ -585,10 +585,10 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
|
||||||
out_muram:
|
out_muram:
|
||||||
for (i = 0; i < CPM_MAXBD; i++) {
|
for (i = 0; i < CPM_MAXBD; i++) {
|
||||||
if (cpm->rxbuf[i])
|
if (cpm->rxbuf[i])
|
||||||
dma_free_coherent(NULL, CPM_MAX_READ + 1,
|
dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
|
||||||
cpm->rxbuf[i], cpm->rxdma[i]);
|
cpm->rxbuf[i], cpm->rxdma[i]);
|
||||||
if (cpm->txbuf[i])
|
if (cpm->txbuf[i])
|
||||||
dma_free_coherent(NULL, CPM_MAX_READ + 1,
|
dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
|
||||||
cpm->txbuf[i], cpm->txdma[i]);
|
cpm->txbuf[i], cpm->txdma[i]);
|
||||||
}
|
}
|
||||||
cpm_muram_free(cpm->dp_addr);
|
cpm_muram_free(cpm->dp_addr);
|
||||||
|
@ -619,9 +619,9 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)
|
||||||
|
|
||||||
/* Free all memory */
|
/* Free all memory */
|
||||||
for (i = 0; i < CPM_MAXBD; i++) {
|
for (i = 0; i < CPM_MAXBD; i++) {
|
||||||
dma_free_coherent(NULL, CPM_MAX_READ + 1,
|
dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
|
||||||
cpm->rxbuf[i], cpm->rxdma[i]);
|
cpm->rxbuf[i], cpm->rxdma[i]);
|
||||||
dma_free_coherent(NULL, CPM_MAX_READ + 1,
|
dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
|
||||||
cpm->txbuf[i], cpm->txdma[i]);
|
cpm->txbuf[i], cpm->txdma[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue