Skip to contentSkip to conversation

dmaengine: xilinx: dpdma: remove comparison of unsigned expression

PATCH In review Vinod Koul 2 participants 11 messages Jul 18, 2020 – Jul 22, 2020

Subsystems (3)
lore
Share & tools
lore

Vinod Koul

author maintainer
#0 lore raw

PATCH 1/3 dmaengine: xilinx: dpdma: remove comparison of unsigned expression

xilinx_dpdma_config() channel id is unsigned int and compares with ZYNQMP_DPDMA_VIDEO0 which is zero, so remove this comparison

drivers/dma/xilinx/xilinx_dpdma.c:1073:15: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits] if

	(chan->id >= ZYNQMP_DPDMA_VIDEO0 && chan->id <= ZYNQMP_DPDMA_VIDEO2)
---
 drivers/dma/xilinx/xilinx_dpdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/xilinx/xilinx_dpdma.c +1 -1
index af88a6762ef4..8e602378f2dc 100644
@@ -1070,7 +1070,7 @@ static int xilinx_dpdma_config(struct dma_chan *dchan,
 	 * Abuse the slave_id to indicate that the channel is part of a video
 	 * group.
 	 */
-	if (chan->id >= ZYNQMP_DPDMA_VIDEO0 && chan->id <= ZYNQMP_DPDMA_VIDEO2)
+	if (chan->id <= ZYNQMP_DPDMA_VIDEO2)
 		chan->video_group = config->slave_id != 0;
 
 	spin_unlock_irqrestore(&chan->lock, flags);
Signature · 1 line
2.26.2
author maintainer
#1 lore raw

PATCH 2/3 dmaengine: xilinx: dpdma: add missing kernel doc

xilinx_dpdma_sw_desc_set_dma_addrs() documentation is missing describing 'xdev', so add it

drivers/dma/xilinx/xilinx_dpdma.c:313: warning: Function parameter or member 'xdev' not described in 'xilinx_dpdma_sw_desc_set_dma_addrs'

---
 drivers/dma/xilinx/xilinx_dpdma.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/xilinx/xilinx_dpdma.c +1 -0
index 8e602378f2dc..430f3714f6a3 100644
@@ -295,6 +295,7 @@ static inline void dpdma_set(void __iomem *base, u32 offset, u32 set)
 
 /**
  * xilinx_dpdma_sw_desc_set_dma_addrs - Set DMA addresses in the descriptor
+ * @xdev: DPDMA device
  * @sw_desc: The software descriptor in which to set DMA addresses
  * @prev: The previous descriptor
  * @dma_addr: array of dma addresses
Signature · 1 line
2.26.2
maintainer Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] dmaengine: xilinx: dpdma: add missing kernel doc

Hi Vinod,

Thank you for the patch.

Quoted 7 lines · Vinod Koul

xilinx_dpdma_sw_desc_set_dma_addrs() documentation is missing describing 'xdev', so add it

drivers/dma/xilinx/xilinx_dpdma.c:313: warning: Function parameter or member 'xdev' not described in 'xilinx_dpdma_sw_desc_set_dma_addrs'

Quoted 16 lines
---
 drivers/dma/xilinx/xilinx_dpdma.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/xilinx/xilinx_dpdma.c +1 -0
index 8e602378f2dc..430f3714f6a3 100644
@@ -295,6 +295,7 @@ static inline void dpdma_set(void __iomem *base, u32 offset, u32 set)
 
 /**
  * xilinx_dpdma_sw_desc_set_dma_addrs - Set DMA addresses in the descriptor
+ * @xdev: DPDMA device
  * @sw_desc: The software descriptor in which to set DMA addresses
  * @prev: The previous descriptor
  * @dma_addr: array of dma addresses
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#3 lore raw

PATCH 3/3 dmaengine: xilinx: dpdma: fix kernel doc format

In reply to Vinod Koul

xilinx_dpdma_chan structure documents 'desc' members, but that leads to warnings, so split that up and describe members

drivers/dma/xilinx/xilinx_dpdma.c:241: warning: Function parameter or member 'desc' not described in 'xilinx_dpdma_chan'

---
 drivers/dma/xilinx/xilinx_dpdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/xilinx/xilinx_dpdma.c +2 -2
index 430f3714f6a3..d94c75a842f8 100644
@@ -214,8 +214,8 @@ struct xilinx_dpdma_tx_desc {
  * @lock: lock to access struct xilinx_dpdma_chan
  * @desc_pool: descriptor allocation pool
  * @err_task: error IRQ bottom half handler
- * @desc.pending: Descriptor schedule to the hardware, pending execution
- * @desc.active: Descriptor being executed by the hardware
+ * @desc: pending: Descriptor schedule to the hardware, pending execution
+ *        active: Descriptor being executed by the hardware
  * @xdev: DPDMA device
  */
 struct xilinx_dpdma_chan {
Signature · 1 line
2.26.2
maintainer
#4 lore raw

Re: [PATCH 3/3] dmaengine: xilinx: dpdma: fix kernel doc format

Hi Vinod,

Thank you for the patch.

Quoted 16 lines · Vinod Koul

xilinx_dpdma_chan structure documents 'desc' members, but that leads to warnings, so split that up and describe members

drivers/dma/xilinx/xilinx_dpdma.c:241: warning: Function parameter or member 'desc' not described in 'xilinx_dpdma_chan'

---
 drivers/dma/xilinx/xilinx_dpdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/xilinx/xilinx_dpdma.c +0 -0
index 430f3714f6a3..d94c75a842f8 100644

drivers/dma/xilinx/xilinx_dpdma.c struct xilinx_dpdma_tx_desc { · line 218

Quoted 7 lines
drivers/dma/xilinx/xilinx_dpdma.c +2 -2
@@ -214,8 +214,8 @@ struct xilinx_dpdma_tx_desc {
  * @lock: lock to access struct xilinx_dpdma_chan
  * @desc_pool: descriptor allocation pool
  * @err_task: error IRQ bottom half handler
- * @desc.pending: Descriptor schedule to the hardware, pending execution
- * @desc.active: Descriptor being executed by the hardware
+ * @desc: pending: Descriptor schedule to the hardware, pending execution
+ *        active: Descriptor being executed by the hardware

According to
https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#nested-structs-unions,
the existing syntax is supposed to be valid. Where does the above warning come from ?

Quoted 3 lines
drivers/dma/xilinx/xilinx_dpdma.c +0 -0
  * @xdev: DPDMA device
  */
 struct xilinx_dpdma_chan {
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#5 lore raw

Re: [PATCH 3/3] dmaengine: xilinx: dpdma: fix kernel doc format

Quoted 25 lines · Laurent Pinchart

Hi Vinod,

Thank you for the patch.

Quoted 20 lines · Vinod Koul

xilinx_dpdma_chan structure documents 'desc' members, but that leads to warnings, so split that up and describe members

drivers/dma/xilinx/xilinx_dpdma.c:241: warning: Function parameter or member 'desc' not described in 'xilinx_dpdma_chan'

---
 drivers/dma/xilinx/xilinx_dpdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/xilinx/xilinx_dpdma.c +0 -1
index 430f3714f6a3..d94c75a842f8 100644
@@ -214,8 +214,8 @@ struct xilinx_dpdma_tx_desc {
  * @lock: lock to access struct xilinx_dpdma_chan
  * @desc_pool: descriptor allocation pool
  * @err_task: error IRQ bottom half handler
- * @desc.pending: Descriptor schedule to the hardware, pending execution
Quoted 8 lines

drivers/dma/xilinx/xilinx_dpdma.c struct xilinx_dpdma_tx_desc { · line 218

Quoted 3 lines
drivers/dma/xilinx/xilinx_dpdma.c +2 -1
- * @desc.active: Descriptor being executed by the hardware
+ * @desc: pending: Descriptor schedule to the hardware, pending execution
+ *        active: Descriptor being executed by the hardware

According to
https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#nested-structs-unions,
the existing syntax is supposed to be valid. Where does the above warning come from ?

W=1 build again..

Quoted 9 lines
Quoted 4 lines
drivers/dma/xilinx/xilinx_dpdma.c +0 -0
  * @xdev: DPDMA device
  */
 struct xilinx_dpdma_chan {
Signature · 3 lines
Regards,

Laurent Pinchart
Signature · 1 line
~Vinod
maintainer
#6 lore raw

Re: [PATCH 3/3] dmaengine: xilinx: dpdma: fix kernel doc format

Hi Vinod,

Quoted 31 lines · Vinod Koul
Quoted 21 lines · Laurent Pinchart
Quoted 20 lines · Vinod Koul

xilinx_dpdma_chan structure documents 'desc' members, but that leads to warnings, so split that up and describe members

drivers/dma/xilinx/xilinx_dpdma.c:241: warning: Function parameter or member 'desc' not described in 'xilinx_dpdma_chan'

---
 drivers/dma/xilinx/xilinx_dpdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/xilinx/xilinx_dpdma.c +0 -1
index 430f3714f6a3..d94c75a842f8 100644
@@ -214,8 +214,8 @@ struct xilinx_dpdma_tx_desc {
  * @lock: lock to access struct xilinx_dpdma_chan
  * @desc_pool: descriptor allocation pool
  * @err_task: error IRQ bottom half handler
- * @desc.pending: Descriptor schedule to the hardware, pending execution
Quoted 8 lines

drivers/dma/xilinx/xilinx_dpdma.c struct xilinx_dpdma_tx_desc { · line 218

Quoted 3 lines
drivers/dma/xilinx/xilinx_dpdma.c +2 -1
- * @desc.active: Descriptor being executed by the hardware
+ * @desc: pending: Descriptor schedule to the hardware, pending execution
+ *        active: Descriptor being executed by the hardware

According to
https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#nested-structs-unions,
the existing syntax is supposed to be valid. Where does the above warning come from ?

Quoted 1 line

W=1 build again..

I get the same when plumbing the source file into the kerneldoc build. The generated documentation however contains the description of both desc.pending and desc.active. If you want to fix the warning, I think you should instead add a line to document @desc, but without removing the existing @desc.pending and @desc.active lines.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/dma/xilinx/xilinx_dpdma.c +0 -0
  * @xdev: DPDMA device
  */
 struct xilinx_dpdma_chan {
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#7 lore raw

Re: [PATCH 3/3] dmaengine: xilinx: dpdma: fix kernel doc format

Quoted 7 lines · Laurent Pinchart
Quoted 1 line

W=1 build again..

I get the same when plumbing the source file into the kerneldoc build. The generated documentation however contains the description of both desc.pending and desc.active. If you want to fix the warning, I think you should instead add a line to document @desc, but without removing the existing @desc.pending and @desc.active lines.

I would like to see clean build with W=1, helps to find other issues :) So do feel free to send the patch to fix this, i will swap them..

Signature · 1 line
~Vinod
maintainer
#8 lore raw

Re: [PATCH 3/3] dmaengine: xilinx: dpdma: fix kernel doc format

Quoted 4 lines · Vinod Koul
Quoted 2 lines · Laurent Pinchart
Quoted 1 line

W=1 build again..

Quoted 8 lines
Quoted 5 lines

I get the same when plumbing the source file into the kerneldoc build. The generated documentation however contains the description of both desc.pending and desc.active. If you want to fix the warning, I think you should instead add a line to document @desc, but without removing the existing @desc.pending and @desc.active lines.

I would like to see clean build with W=1, helps to find other issues :) So do feel free to send the patch to fix this, i will swap them..

Done, see "[PATCH] dmaengine: xilinx: dpdma: Fix kerneldoc warning".

Signature · 3 lines
Regards,

Laurent Pinchart
maintainer Reviewed-by on v1 1/3
#9 lore raw
In reply to Vinod Koul

Hi Vinod,

Thank you for the patch.

Quoted 6 lines · Vinod Koul

xilinx_dpdma_config() channel id is unsigned int and compares with ZYNQMP_DPDMA_VIDEO0 which is zero, so remove this comparison

drivers/dma/xilinx/xilinx_dpdma.c:1073:15: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits] if

	(chan->id >= ZYNQMP_DPDMA_VIDEO0 && chan->id <= ZYNQMP_DPDMA_VIDEO2)

I didn't see that warning, how do you produce it ?

Quoted 10 lines
---
 drivers/dma/xilinx/xilinx_dpdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/xilinx/xilinx_dpdma.c +0 -0
index af88a6762ef4..8e602378f2dc 100644

drivers/dma/xilinx/xilinx_dpdma.c static int xilinx_dpdma_config(struct dma_chan *dchan, · line 1073

Quoted 5 lines
drivers/dma/xilinx/xilinx_dpdma.c +1 -1
@@ -1070,7 +1070,7 @@ static int xilinx_dpdma_config(struct dma_chan *dchan,
 	 * Abuse the slave_id to indicate that the channel is part of a video
 	 * group.
 	 */
-	if (chan->id >= ZYNQMP_DPDMA_VIDEO0 && chan->id <= ZYNQMP_DPDMA_VIDEO2)
+	if (chan->id <= ZYNQMP_DPDMA_VIDEO2)

While this doesn't affect the behaviour, I'm worried about the risk of introducing bugs in the future if the ZYNQMP_DPDMA_VIDEO0 becomes non-zero. On the other hand, that's part of the DT ABI, so it shouldn't change. How about

	switch (chan->id) {
	case ZYNQMP_DPDMA_VIDEO0:
	case ZYNQMP_DPDMA_VIDEO1:
	case ZYNQMP_DPDMA_VIDEO2:
  		chan->video_group = config->slave_id != 0;
		break;
	}

instead ?

Quoted 3 lines
drivers/dma/xilinx/xilinx_dpdma.c +0 -0
 		chan->video_group = config->slave_id != 0;
 
 	spin_unlock_irqrestore(&chan->lock, flags);
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#10 lore raw
Quoted 5 lines · Laurent Pinchart

Hi Vinod,

Thank you for the patch.

On Sat, Jul 18, 2020 at 07:21:59PM +0530, Vinod Koul wrote:

Quoted 8 lines
Quoted 6 lines

xilinx_dpdma_config() channel id is unsigned int and compares with ZYNQMP_DPDMA_VIDEO0 which is zero, so remove this comparison

drivers/dma/xilinx/xilinx_dpdma.c:1073:15: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits] if

	(chan->id >= ZYNQMP_DPDMA_VIDEO0 && chan->id <= ZYNQMP_DPDMA_VIDEO2)

I didn't see that warning, how do you produce it ?

I see it with gcc and W=1.

Quoted 30 lines
Quoted 11 lines
---
 drivers/dma/xilinx/xilinx_dpdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/xilinx/xilinx_dpdma.c +0 -0
index af88a6762ef4..8e602378f2dc 100644

drivers/dma/xilinx/xilinx_dpdma.c static int xilinx_dpdma_config(struct dma_chan *dchan, · line 1073

Quoted 5 lines
drivers/dma/xilinx/xilinx_dpdma.c +1 -1
@@ -1070,7 +1070,7 @@ static int xilinx_dpdma_config(struct dma_chan *dchan,
 	 * Abuse the slave_id to indicate that the channel is part of a video
 	 * group.
 	 */
-	if (chan->id >= ZYNQMP_DPDMA_VIDEO0 && chan->id <= ZYNQMP_DPDMA_VIDEO2)
+	if (chan->id <= ZYNQMP_DPDMA_VIDEO2)

While this doesn't affect the behaviour, I'm worried about the risk of introducing bugs in the future if the ZYNQMP_DPDMA_VIDEO0 becomes non-zero. On the other hand, that's part of the DT ABI, so it shouldn't change. How about

	switch (chan->id) {
	case ZYNQMP_DPDMA_VIDEO0:
	case ZYNQMP_DPDMA_VIDEO1:
	case ZYNQMP_DPDMA_VIDEO2:
  		chan->video_group = config->slave_id != 0;
		break;
	}
Quoted 3 lines

instead ?

Thanks

Quoted 9 lines
Quoted 4 lines
drivers/dma/xilinx/xilinx_dpdma.c +0 -0
 		chan->video_group = config->slave_id != 0;
 
 	spin_unlock_irqrestore(&chan->lock, flags);
Signature · 3 lines
Regards,

Laurent Pinchart
Signature · 1 line
~Vinod