linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: xilinx_can: Add check for NAPI Poll function
@ 2022-02-08 16:20 Srinivas Neeli
  2022-02-09  7:49 ` Marc Kleine-Budde
  0 siblings, 1 reply; 7+ messages in thread
From: Srinivas Neeli @ 2022-02-08 16:20 UTC (permalink / raw)
  To: wg, mkl, davem, kuba
  Cc: michal.simek, linux-can, netdev, linux-arm-kernel, linux-kernel,
	appana.durga.rao, sgoud, git, Srinivas Neeli

Add check for NAPI poll function to avoid enabling interrupts
with out completing the NAPI call.

Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 1674b561c9a2..e562c5ab1149 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -1215,10 +1215,11 @@ static int xcan_rx_poll(struct napi_struct *napi, int quota)
 	}
 
 	if (work_done < quota) {
-		napi_complete_done(napi, work_done);
-		ier = priv->read_reg(priv, XCAN_IER_OFFSET);
-		ier |= xcan_rx_int_mask(priv);
-		priv->write_reg(priv, XCAN_IER_OFFSET, ier);
+		if (napi_complete_done(napi, work_done)) {
+			ier = priv->read_reg(priv, XCAN_IER_OFFSET);
+			ier |= xcan_rx_int_mask(priv);
+			priv->write_reg(priv, XCAN_IER_OFFSET, ier);
+		}
 	}
 	return work_done;
 }
-- 
2.17.1


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

end of thread, other threads:[~2022-02-09  8:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 16:20 [PATCH] can: xilinx_can: Add check for NAPI Poll function Srinivas Neeli
2022-02-09  7:49 ` Marc Kleine-Budde
2022-02-09  8:29   ` Srinivas Neeli
2022-02-09  8:31     ` Marc Kleine-Budde
2022-02-09  8:40       ` Srinivas Neeli
2022-02-09  8:41         ` Michal Simek
2022-02-09  8:43         ` Marc Kleine-Budde

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).