linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_irq()
@ 2024-06-06 14:23 Dan Carpenter
  2024-06-06 17:30 ` Péter Ujfalusi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2024-06-06 14:23 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Vinod Koul, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, MD Danish Anwar, Roger Quadros, Grygorii Strashko,
	Julien Panis, Chintan Vankar, Diogo Ivo, Simon Horman, dmaengine,
	linux-kernel, netdev, linux-arm-kernel, kernel-janitors

Currently the k3_udma_glue_rx_get_irq() function returns either negative
error codes or zero on error.  Generally, in the kernel, zero means
success so this be confusing and has caused bugs in the past.  Also the
"tx" version of this function only returns negative error codes.  Let's
clean this "rx" function so both functions match.

This patch has no effect on runtime.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/dma/ti/k3-udma-glue.c                | 3 +++
 drivers/net/ethernet/ti/am65-cpsw-nuss.c     | 4 ++--
 drivers/net/ethernet/ti/icssg/icssg_common.c | 4 +---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c
index c9b93055dc9d..b96b448a0e69 100644
--- a/drivers/dma/ti/k3-udma-glue.c
+++ b/drivers/dma/ti/k3-udma-glue.c
@@ -1531,6 +1531,9 @@ int k3_udma_glue_rx_get_irq(struct k3_udma_glue_rx_channel *rx_chn,
 		flow->virq = k3_ringacc_get_ring_irq_num(flow->ringrx);
 	}
 
+	if (!flow->virq)
+		return -ENXIO;
+
 	return flow->virq;
 }
 EXPORT_SYMBOL_GPL(k3_udma_glue_rx_get_irq);
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 4e50b3792888..8c26acc9cde1 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -2424,10 +2424,10 @@ static int am65_cpsw_nuss_init_rx_chns(struct am65_cpsw_common *common)
 
 		rx_chn->irq = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);
 
-		if (rx_chn->irq <= 0) {
+		if (rx_chn->irq < 0) {
 			dev_err(dev, "Failed to get rx dma irq %d\n",
 				rx_chn->irq);
-			ret = -ENXIO;
+			ret = rx_chn->irq;
 			goto err;
 		}
 	}
diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c
index 088ab8076db4..cac7863c5cb2 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_common.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_common.c
@@ -440,9 +440,7 @@ int prueth_init_rx_chns(struct prueth_emac *emac,
 			fdqring_id = k3_udma_glue_rx_flow_get_fdq_id(rx_chn->rx_chn,
 								     i);
 		ret = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);
-		if (ret <= 0) {
-			if (!ret)
-				ret = -ENXIO;
+		if (ret < 0) {
 			netdev_err(ndev, "Failed to get rx dma irq");
 			goto fail;
 		}
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_irq()
  2024-06-06 14:23 [PATCH net-next] dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_irq() Dan Carpenter
@ 2024-06-06 17:30 ` Péter Ujfalusi
  2024-06-07 17:15 ` Vinod Koul
  2024-06-09 16:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Péter Ujfalusi @ 2024-06-06 17:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Vinod Koul, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, MD Danish Anwar, Roger Quadros, Grygorii Strashko,
	Julien Panis, Chintan Vankar, Diogo Ivo, Simon Horman, dmaengine,
	linux-kernel, netdev, linux-arm-kernel, kernel-janitors



On 6/6/24 5:23 PM, Dan Carpenter wrote:
> Currently the k3_udma_glue_rx_get_irq() function returns either negative
> error codes or zero on error.  Generally, in the kernel, zero means
> success so this be confusing and has caused bugs in the past.  Also the
> "tx" version of this function only returns negative error codes.  Let's
> clean this "rx" function so both functions match.
> 
> This patch has no effect on runtime.

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/dma/ti/k3-udma-glue.c                | 3 +++
>  drivers/net/ethernet/ti/am65-cpsw-nuss.c     | 4 ++--
>  drivers/net/ethernet/ti/icssg/icssg_common.c | 4 +---
>  3 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c
> index c9b93055dc9d..b96b448a0e69 100644
> --- a/drivers/dma/ti/k3-udma-glue.c
> +++ b/drivers/dma/ti/k3-udma-glue.c
> @@ -1531,6 +1531,9 @@ int k3_udma_glue_rx_get_irq(struct k3_udma_glue_rx_channel *rx_chn,
>  		flow->virq = k3_ringacc_get_ring_irq_num(flow->ringrx);
>  	}
>  
> +	if (!flow->virq)
> +		return -ENXIO;
> +
>  	return flow->virq;
>  }
>  EXPORT_SYMBOL_GPL(k3_udma_glue_rx_get_irq);
> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> index 4e50b3792888..8c26acc9cde1 100644
> --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> @@ -2424,10 +2424,10 @@ static int am65_cpsw_nuss_init_rx_chns(struct am65_cpsw_common *common)
>  
>  		rx_chn->irq = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);
>  
> -		if (rx_chn->irq <= 0) {
> +		if (rx_chn->irq < 0) {
>  			dev_err(dev, "Failed to get rx dma irq %d\n",
>  				rx_chn->irq);
> -			ret = -ENXIO;
> +			ret = rx_chn->irq;
>  			goto err;
>  		}
>  	}
> diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c
> index 088ab8076db4..cac7863c5cb2 100644
> --- a/drivers/net/ethernet/ti/icssg/icssg_common.c
> +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c
> @@ -440,9 +440,7 @@ int prueth_init_rx_chns(struct prueth_emac *emac,
>  			fdqring_id = k3_udma_glue_rx_flow_get_fdq_id(rx_chn->rx_chn,
>  								     i);
>  		ret = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);
> -		if (ret <= 0) {
> -			if (!ret)
> -				ret = -ENXIO;
> +		if (ret < 0) {
>  			netdev_err(ndev, "Failed to get rx dma irq");
>  			goto fail;
>  		}

-- 
Péter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_irq()
  2024-06-06 14:23 [PATCH net-next] dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_irq() Dan Carpenter
  2024-06-06 17:30 ` Péter Ujfalusi
@ 2024-06-07 17:15 ` Vinod Koul
  2024-06-09 16:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2024-06-07 17:15 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Peter Ujfalusi, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, MD Danish Anwar, Roger Quadros, Grygorii Strashko,
	Julien Panis, Chintan Vankar, Diogo Ivo, Simon Horman, dmaengine,
	linux-kernel, netdev, linux-arm-kernel, kernel-janitors

On 06-06-24, 17:23, Dan Carpenter wrote:
> Currently the k3_udma_glue_rx_get_irq() function returns either negative
> error codes or zero on error.  Generally, in the kernel, zero means
> success so this be confusing and has caused bugs in the past.  Also the
> "tx" version of this function only returns negative error codes.  Let's
> clean this "rx" function so both functions match.
> 
> This patch has no effect on runtime.

Acked-by: Vinod Koul <vkoul@kernel.org>

-- 
~Vinod

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_irq()
  2024-06-06 14:23 [PATCH net-next] dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_irq() Dan Carpenter
  2024-06-06 17:30 ` Péter Ujfalusi
  2024-06-07 17:15 ` Vinod Koul
@ 2024-06-09 16:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-09 16:40 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: peter.ujfalusi, vkoul, davem, edumazet, kuba, pabeni, danishanwar,
	rogerq, grygorii.strashko, jpanis, c-vankar, diogo.ivo, horms,
	dmaengine, linux-kernel, netdev, linux-arm-kernel,
	kernel-janitors

Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Thu, 6 Jun 2024 17:23:44 +0300 you wrote:
> Currently the k3_udma_glue_rx_get_irq() function returns either negative
> error codes or zero on error.  Generally, in the kernel, zero means
> success so this be confusing and has caused bugs in the past.  Also the
> "tx" version of this function only returns negative error codes.  Let's
> clean this "rx" function so both functions match.
> 
> This patch has no effect on runtime.
> 
> [...]

Here is the summary with links:
  - [net-next] dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_irq()
    https://git.kernel.org/netdev/net-next/c/28f961f9d5b7

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-09 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-06 14:23 [PATCH net-next] dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_irq() Dan Carpenter
2024-06-06 17:30 ` Péter Ujfalusi
2024-06-07 17:15 ` Vinod Koul
2024-06-09 16:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).