Skip to contentSkip to conversation

mmc: bcm2835: Use dma_request_chan() instead dma_request_slave_channel()

PATCH In review Peter Ujfalusi 2 participants 3 messages Dec 17, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: bcm2835: Use dma_request_chan() instead dma_request_slave_channel()

dma_request_slave_channel() is a wrapper on top of dma_request_chan() eating up the error code.

By using dma_request_chan() directly the driver can support deferred probing against DMA.

---
 drivers/mmc/host/bcm2835.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mmc/host/bcm2835.c +9 -1
index 99f61fd2a658..3821f159d36d 100644
@@ -1393,7 +1393,15 @@ static int bcm2835_probe(struct platform_device *pdev)
 	host->dma_chan = NULL;
 	host->dma_desc = NULL;
 
-	host->dma_chan_rxtx = dma_request_slave_channel(dev, "rx-tx");
+	host->dma_chan_rxtx = dma_request_chan(dev, "rx-tx");
+	if (IS_ERR(host->dma_chan_rxtx)) {
+		if (PTR_ERR(host->dma_chan_rxtx) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+
+		/* Ignore errors to fall back to PIO mode */
+		host->dma_chan_rxtx = NULL;
+	}
+
 
 	clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(clk)) {
Signature · 10 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

Hi Peter,

Quoted 16 lines · Peter Ujfalusi

dma_request_slave_channel() is a wrapper on top of dma_request_chan() eating up the error code.

By using dma_request_chan() directly the driver can support deferred probing against DMA.

---
 drivers/mmc/host/bcm2835.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mmc/host/bcm2835.c +0 -0
index 99f61fd2a658..3821f159d36d 100644

drivers/mmc/host/bcm2835.c static int bcm2835_probe(struct platform_device *pdev) · line 1399

Quoted 8 lines
drivers/mmc/host/bcm2835.c +4 -1
@@ -1393,7 +1393,15 @@ static int bcm2835_probe(struct platform_device *pdev)
 	host->dma_chan = NULL;
 	host->dma_desc = NULL;
 
-	host->dma_chan_rxtx = dma_request_slave_channel(dev, "rx-tx");
+	host->dma_chan_rxtx = dma_request_chan(dev, "rx-tx");
+	if (IS_ERR(host->dma_chan_rxtx)) {
+		if (PTR_ERR(host->dma_chan_rxtx) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;

I think you should 'goto err' here, as you have to free the mmc host structure allocated earlier in the probe function.

Other than that the patch looks good to me.

Regards,
Nicolas

#2 lore raw
Quoted 22 lines · Nicolas Saenz Julienne

Hi Peter,

Quoted 19 lines · Peter Ujfalusi

dma_request_slave_channel() is a wrapper on top of dma_request_chan() eating up the error code.

By using dma_request_chan() directly the driver can support deferred probing against DMA.

---
 drivers/mmc/host/bcm2835.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mmc/host/bcm2835.c +0 -0
index 99f61fd2a658..3821f159d36d 100644
@@ -1393,7 +1393,15 @@ static int bcm2835_probe(struct platform_device *pdev)
 	host->dma_chan = NULL;
 	host->dma_desc = NULL;
 
Quoted 8 lines

drivers/mmc/host/bcm2835.c static int bcm2835_probe(struct platform_device *pdev) · line 1399

Quoted 5 lines
drivers/mmc/host/bcm2835.c +4 -1
-	host->dma_chan_rxtx = dma_request_slave_channel(dev, "rx-tx");
+	host->dma_chan_rxtx = dma_request_chan(dev, "rx-tx");
+	if (IS_ERR(host->dma_chan_rxtx)) {
+		if (PTR_ERR(host->dma_chan_rxtx) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;

I think you should 'goto err' here, as you have to free the mmc host structure allocated earlier in the probe function.

You are right.

Quoted 5 lines

Other than that the patch looks good to me.

Regards,
Nicolas

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki