Skip to contentSkip to conversation

i2c-cpm: Pass dev ptr to dma_*_coherent rather than NULL

PATCH In review Mark Ware 5 participants 9 messages Apr 21, 2009 – May 11, 2009 5 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Mark Ware

author
#0 lore raw

PATCH 1/1 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.

---

This patch fixes the BUG() during boot that has appeared during the 2.6.30 window. It has been tested and appears correct on my 8280 based board.
Sent to both linuxppc-dev and linux-i2c, since I'm not sure where it belongs.

 drivers/i2c/busses/i2c-cpm.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-cpm.c +8 -6
index 3fcf78e..83276d2 100644
@@ -532,7 +532,8 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
 
 	for (i = 0; i < CPM_MAXBD; i++) {
 		cpm->rxbuf[i] = dma_alloc_coherent(
-			NULL, CPM_MAX_READ + 1, &cpm->rxdma[i], GFP_KERNEL);
+			&cpm->ofdev->dev, CPM_MAX_READ + 1, &cpm->rxdma[i],
+			GFP_KERNEL);
 		if (!cpm->rxbuf[i]) {
 			ret = -ENOMEM;
 			goto out_muram;
@@ -540,7 +541,8 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
 		out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1));
 
 		cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent(
-			NULL, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL);
+			&cpm->ofdev->dev, CPM_MAX_READ + 1, &cpm->txdma[i],
+			GFP_KERNEL);
 		if (!cpm->txbuf[i]) {
 			ret = -ENOMEM;
 			goto out_muram;
@@ -585,10 +587,10 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
 out_muram:
 	for (i = 0; i < CPM_MAXBD; 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]);
 		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_muram_free(cpm->dp_addr);
@@ -619,9 +621,9 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)
 
 	/* Free all memory */
 	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]);
-		dma_free_coherent(NULL, CPM_MAX_READ + 1,
+		dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
 			cpm->txbuf[i], cpm->txdma[i]);
 	}
 
Signature · 1 line
1.5.6.5

A message that is not in the archive (sent off-list or not yet received): [email protected]

Acked-by
#3 lore raw
In reply to a message not in the archive
Quoted 6 lines · Mark Ware

Recent DMA changes result in a BUG() when NULL is passed to dma_alloc_coherent in place of a device.

---

Quoted 8 lines

This patch fixes the BUG() during boot that has appeared during the 2.6.30 window. It has been tested and appears correct on my 8280 based board.
Sent to both linuxppc-dev and linux-i2c, since I'm not sure where it belongs.

drivers/i2c/busses/i2c-cpm.c | 14 ++++++++------

1 files changed, 8 insertions(+), 6 deletions(-)

Ben, I'm expecting you to pick this up unless you tell me otherwise.

- k

A message that is not in the archive (sent off-list or not yet received): E2205842-8019-4CE4-812B-64ABD76F36F4-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org

#5 lore raw
Quoted 16 lines · Kumar Gala
Quoted 13 lines · Mark Ware

Recent DMA changes result in a BUG() when NULL is passed to dma_alloc_coherent in place of a device.

---

This patch fixes the BUG() during boot that has appeared during the 2.6.30 window. It has been tested and appears correct on my 8280 based board.
Sent to both linuxppc-dev and linux-i2c, since I'm not sure where it belongs.

Quoted 6 lines
Quoted 2 lines

drivers/i2c/busses/i2c-cpm.c | 14 ++++++++------

1 files changed, 8 insertions(+), 6 deletions(-)

Ben, I'm expecting you to pick this up unless you tell me otherwise.

Yes.

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#6 lore raw
Quoted 17 lines · Ben Dooks
Quoted 16 lines · Kumar Gala
Quoted 13 lines · Mark Ware

Recent DMA changes result in a BUG() when NULL is passed to dma_alloc_coherent in place of a device.

---

This patch fixes the BUG() during boot that has appeared during the 2.6.30 window. It has been tested and appears correct on my 8280 based board.
Sent to both linuxppc-dev and linux-i2c, since I'm not sure where it belongs.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

drivers/i2c/busses/i2c-cpm.c | 14 ++++++++------

1 files changed, 8 insertions(+), 6 deletions(-)

Ben, I'm expecting you to pick this up unless you tell me otherwise.

Yes.

This go in yet?

- k

A message that is not in the archive (sent off-list or not yet received): AAD6564F-9D99-492B-8364-10A652F990DF-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org

#8 lore raw
Quoted 24 lines · Kumar Gala
Quoted 21 lines · Ben Dooks
Quoted 20 lines · Kumar Gala
Quoted 16 lines · Mark Ware

Recent DMA changes result in a BUG() when NULL is passed to dma_alloc_coherent in place of a device.

---

This patch fixes the BUG() during boot that has appeared during the 2.6.30 window. It has been tested and appears correct on my 8280 based
board.
Sent to both linuxppc-dev and linux-i2c, since I'm not sure where it belongs.

drivers/i2c/busses/i2c-cpm.c | 14 ++++++++------

1 files changed, 8 insertions(+), 6 deletions(-)
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Ben, I'm expecting you to pick this up unless you tell me otherwise.

Yes.

This go in yet?

I've had to do a manual apply due to some changes in the driver, so can someone please do a build of my git tree at:

git://aeryn.fluff.org.uk/bjdooks/linux.git i2c-for-2630-rc5

or tell me which arch and defconfig to build.

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#10 lore raw
Quoted 27 lines · Ben Dooks
Quoted 18 lines · Kumar Gala
Quoted 16 lines · Ben Dooks
Quoted 15 lines · Kumar Gala
Quoted 13 lines · Mark Ware

Recent DMA changes result in a BUG() when NULL is passed to dma_alloc_coherent in place of a device.

---

This patch fixes the BUG() during boot that has appeared during the 2.6.30 window. It has been tested and appears correct on my 8280 based board.
Sent to both linuxppc-dev and linux-i2c, since I'm not sure where it belongs.

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

drivers/i2c/busses/i2c-cpm.c | 14 ++++++++------

1 files changed, 8 insertions(+), 6 deletions(-)

Ben, I'm expecting you to pick this up unless you tell me otherwise.

Yes.

This go in yet?

Quoted 8 lines

I've had to do a manual apply due to some changes in the driver, so can someone please do a build of my git tree at:

git://aeryn.fluff.org.uk/bjdooks/linux.git i2c-for-2630-rc5

or tell me which arch and defconfig to build.

Fails to build, due to a typo. Once fixed (diff below), it builds and tests OK on my MPC8280 based hardware

Thanks.

Mark

drivers/i2c/busses/i2c-cpm.c +1 -1
index b4c0448..b5db8b8 100644
@@ -585,7 +585,7 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
 out_muram:
        for (i = 0; i < CPM_MAXBD; i++) {
                if (cpm->rxbuf[i])
-                       dma_free_coherent(&cpm->ofdev->devL, CPM_MAX_READ + 1,
+                       dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
                                cpm->rxbuf[i], cpm->rxdma[i]);
                if (cpm->txbuf[i])
                        dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
author
#11 lore raw
In reply to a message not in the archive
Quoted 27 lines · Ben Dooks
Quoted 18 lines · Kumar Gala
Quoted 16 lines · Ben Dooks
Quoted 15 lines · Kumar Gala
Quoted 13 lines · Mark Ware

Recent DMA changes result in a BUG() when NULL is passed to dma_alloc_coherent in place of a device.

---

This patch fixes the BUG() during boot that has appeared during the 2.6.30 window. It has been tested and appears correct on my 8280 based board.
Sent to both linuxppc-dev and linux-i2c, since I'm not sure where it belongs.

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

drivers/i2c/busses/i2c-cpm.c | 14 ++++++++------

1 files changed, 8 insertions(+), 6 deletions(-)

Ben, I'm expecting you to pick this up unless you tell me otherwise.

Yes.

This go in yet?

Quoted 8 lines

I've had to do a manual apply due to some changes in the driver, so can someone please do a build of my git tree at:

git://aeryn.fluff.org.uk/bjdooks/linux.git i2c-for-2630-rc5

or tell me which arch and defconfig to build.

Ping. Is there anything still blocking this?

Mark Ware

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw
Quoted 33 lines · Mark Ware
Quoted 32 lines · Ben Dooks
Quoted 19 lines · Kumar Gala
Quoted 17 lines · Ben Dooks
Quoted 16 lines · Kumar Gala
Quoted 14 lines · Mark Ware

Recent DMA changes result in a BUG() when NULL is passed to dma_alloc_coherent in place of a device.

---

This patch fixes the BUG() during boot that has appeared during the 2.6.30 window. It has been tested and appears correct on my 8280 based
board.
Sent to both linuxppc-dev and linux-i2c, since I'm not sure where it belongs.

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

drivers/i2c/busses/i2c-cpm.c | 14 ++++++++------

1 files changed, 8 insertions(+), 6 deletions(-)

Ben, I'm expecting you to pick this up unless you tell me otherwise.

Yes.

This go in yet?

I've had to do a manual apply due to some changes in the driver, so can someone please do a build of my git tree at:

Quoted 6 lines
Quoted 4 lines

git://aeryn.fluff.org.uk/bjdooks/linux.git i2c-for-2630-rc5

or tell me which arch and defconfig to build.

Ping. Is there anything still blocking this?

sorry, have been ill recently, will get this sorted and pushed.

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'