Skip to contentSkip to conversation

dma: don't set chancnt

PATCH Superseded Jisheng Zhang 4 participants 9 messages Mar 13, 2023 – Mar 17, 2023

Subsystems (7)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover dma: don't set chancnt

I'm patching dw-axi-dmac to add more features, but I found a small clean up point and some drivers in drivers/dma/ have the same issue, so this series comes.

The dma framework will calculate the dma channels chancnt, setting it is wrong.

NOTE: I leav drivers/dma/ioat/ as is, because its logic have a heavy dependency on chancnt usage, however it's still doable.

Jisheng Zhang (5):
dmaengine: dw-axi-dmac: Don't set chancnt
dmaengine: axi-dmac: Don't set chancnt
dmaengine: plx_dma: Don't set chancnt
dmaengine: hidma: Don't set chancnt
dmaengine: sprd: Don't set chancnt

 drivers/dma/dma-axi-dmac.c                     | 1 -
 drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 1 -
 drivers/dma/plx_dma.c                          | 1 -
 drivers/dma/qcom/hidma.c                       | 1 -
 drivers/dma/sprd-dma.c                         | 1 -
 5 files changed, 5 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/5 dmaengine: dw-axi-dmac: Don't set chancnt

The dma framework will calculate the dma channels chancnt, setting it outself is wrong.

---
 drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 1 -
 1 file changed, 1 deletion(-)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +0 -1
index 4169e1d7d5ca..7f3a60e28e38 100644
@@ -1445,7 +1445,6 @@ static int dw_probe(struct platform_device *pdev)
 	dma_cap_set(DMA_CYCLIC, dw->dma.cap_mask);
 
 	/* DMA capabilities */
-	dw->dma.chancnt = hdata->nr_channels;
 	dw->dma.max_burst = hdata->axi_rw_burst_len;
 	dw->dma.src_addr_widths = AXI_DMA_BUSWIDTHS;
 	dw->dma.dst_addr_widths = AXI_DMA_BUSWIDTHS;
Signature · 1 line
2.39.2
#5 lore raw

PATCH 3/5 dmaengine: plx_dma: Don't set chancnt

In reply to Jisheng Zhang

The dma framework will calculate the dma channels chancnt, setting it outself is wrong.

---
 drivers/dma/plx_dma.c | 1 -
 1 file changed, 1 deletion(-)
drivers/dma/plx_dma.c +0 -1
index 12725fa1655f..34b6416c3287 100644
@@ -517,7 +517,6 @@ static int plx_dma_create(struct pci_dev *pdev)
 	plxdev->bar = pcim_iomap_table(pdev)[0];
 
 	dma = &plxdev->dma_dev;
-	dma->chancnt = 1;
 	INIT_LIST_HEAD(&dma->channels);
 	dma_cap_set(DMA_MEMCPY, dma->cap_mask);
 	dma->copy_align = DMAENGINE_ALIGN_1_BYTE;
Signature · 1 line
2.39.2
#7 lore raw

PATCH 5/5 dmaengine: sprd: Don't set chancnt

In reply to Jisheng Zhang

The dma framework will calculate the dma channels chancnt, setting it outself is wrong.

---
 drivers/dma/sprd-dma.c | 1 -
 1 file changed, 1 deletion(-)
drivers/dma/sprd-dma.c +0 -1
index 474d3ba8ec9f..2b639adb48ba 100644
@@ -1169,7 +1169,6 @@ static int sprd_dma_probe(struct platform_device *pdev)
 
 	dma_cap_set(DMA_MEMCPY, sdev->dma_dev.cap_mask);
 	sdev->total_chns = chn_count;
-	sdev->dma_dev.chancnt = chn_count;
 	INIT_LIST_HEAD(&sdev->dma_dev.channels);
 	INIT_LIST_HEAD(&sdev->dma_dev.global_node);
 	sdev->dma_dev.dev = &pdev->dev;
Signature · 1 line
2.39.2
#3 lore raw

PATCH 2/5 dmaengine: axi-dmac: Don't set chancnt

In reply to Jisheng Zhang

The dma framework will calculate the dma channels chancnt, setting it outself is wrong.

---
 drivers/dma/dma-axi-dmac.c | 1 -
 1 file changed, 1 deletion(-)
drivers/dma/dma-axi-dmac.c +0 -1
index a812b9b00e6b..fc7cdad37161 100644
@@ -963,7 +963,6 @@ static int axi_dmac_probe(struct platform_device *pdev)
 	dma_dev->device_terminate_all = axi_dmac_terminate_all;
 	dma_dev->device_synchronize = axi_dmac_synchronize;
 	dma_dev->dev = &pdev->dev;
-	dma_dev->chancnt = 1;
 	dma_dev->src_addr_widths = BIT(dmac->chan.src_width);
 	dma_dev->dst_addr_widths = BIT(dmac->chan.dest_width);
 	dma_dev->directions = BIT(dmac->chan.direction);
Signature · 1 line
2.39.2
#6 lore raw

PATCH 4/5 dmaengine: hidma: Don't set chancnt

In reply to Jisheng Zhang

The dma framework will calculate the dma channels chancnt, setting it outself is wrong.

---
 drivers/dma/qcom/hidma.c | 1 -
 1 file changed, 1 deletion(-)
drivers/dma/qcom/hidma.c +0 -1
index 04d1c33afc12..344525c3a32f 100644
@@ -214,7 +214,6 @@ static int hidma_chan_init(struct hidma_dev *dmadev, u32 dma_sig)
 
 	spin_lock_init(&mchan->lock);
 	list_add_tail(&mchan->chan.device_node, &ddev->channels);
-	dmadev->ddev.chancnt++;
 	return 0;
 }
 
Signature · 7 lines
2.39.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Acked-by on v1 2/5
#4 lore raw

Re: [PATCH 2/5] dmaengine: axi-dmac: Don't set chancnt

In reply to Jisheng Zhang
Quoted 2 lines · Jisheng Zhang

The dma framework will calculate the dma channels chancnt, setting it outself is wrong.

s/outself/ourself/

Looks good otherwise, thanks.

Quoted 11 lines
---
  drivers/dma/dma-axi-dmac.c | 1 -
  1 file changed, 1 deletion(-)
drivers/dma/dma-axi-dmac.c +0 -0
index a812b9b00e6b..fc7cdad37161 100644

drivers/dma/dma-axi-dmac.c static int axi_dmac_probe(struct platform_device *pdev) · line 968

Quoted 7 lines
drivers/dma/dma-axi-dmac.c +0 -1
@@ -963,7 +963,6 @@ static int axi_dmac_probe(struct platform_device *pdev)
  	dma_dev->device_terminate_all = axi_dmac_terminate_all;
  	dma_dev->device_synchronize = axi_dmac_synchronize;
  	dma_dev->dev = &pdev->dev;
-	dma_dev->chancnt = 1;
  	dma_dev->src_addr_widths = BIT(dmac->chan.src_width);
  	dma_dev->dst_addr_widths = BIT(dmac->chan.dest_width);
  	dma_dev->directions = BIT(dmac->chan.direction);

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

Reviewed-by on v1 5/5
#8 lore raw

Re: [PATCH 5/5] dmaengine: sprd: Don't set chancnt

In reply to Jisheng Zhang
Quoted 4 lines · Jisheng Zhang

The dma framework will calculate the dma channels chancnt, setting it outself is wrong.

LGTM. Thanks.

Quoted 16 lines
---
  drivers/dma/sprd-dma.c | 1 -
  1 file changed, 1 deletion(-)
drivers/dma/sprd-dma.c +0 -1
index 474d3ba8ec9f..2b639adb48ba 100644
@@ -1169,7 +1169,6 @@ static int sprd_dma_probe(struct platform_device *pdev)
 
  	dma_cap_set(DMA_MEMCPY, sdev->dma_dev.cap_mask);
  	sdev->total_chns = chn_count;
-	sdev->dma_dev.chancnt = chn_count;
  	INIT_LIST_HEAD(&sdev->dma_dev.channels);
  	INIT_LIST_HEAD(&sdev->dma_dev.global_node);
  	sdev->dma_dev.dev = &pdev->dev;
maintainer
#2 lore raw

Re: [PATCH 1/5] dmaengine: dw-axi-dmac: Don't set chancnt

In reply to Jisheng Zhang
Quoted 1 line · Jisheng Zhang

The dma framework will calculate the dma channels chancnt, setting it

The dmaengine framework...

Quoted 1 line

outself is wrong.

s/outself/ourself

Looks this this is needed for all the patches

Quoted 20 lines
---
 drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 1 -
 1 file changed, 1 deletion(-)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +0 -1
index 4169e1d7d5ca..7f3a60e28e38 100644
@@ -1445,7 +1445,6 @@ static int dw_probe(struct platform_device *pdev)
 	dma_cap_set(DMA_CYCLIC, dw->dma.cap_mask);
 
 	/* DMA capabilities */
-	dw->dma.chancnt = hdata->nr_channels;
 	dw->dma.max_burst = hdata->axi_rw_burst_len;
 	dw->dma.src_addr_widths = AXI_DMA_BUSWIDTHS;
 	dw->dma.dst_addr_widths = AXI_DMA_BUSWIDTHS;
Signature · 1 line
2.39.2
Signature · 1 line
~Vinod