[PATCH RFC can-next 2/3] can: m_can: m_can_isr(): handle device-specific interrupts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Device-specific interrupts are handled, if applicable (and if no M_CAN
interrupts were handled in this ISR call).

Signed-off-by: Torin Cooper-Bennun <torin@xxxxxxxxxxxxxxxxxx>
---
 drivers/net/can/m_can/m_can.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 34073cd077e4..af63dd4b8cd5 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1033,20 +1033,31 @@ static irqreturn_t m_can_isr(int irq, void *dev_id)
 	struct net_device *dev = (struct net_device *)dev_id;
 	struct m_can_classdev *cdev = netdev_priv(dev);
 	u32 ir;
+	irqreturn_t ret = IRQ_NONE;
 
 	if (pm_runtime_suspended(cdev->dev))
 		return IRQ_NONE;
+
 	ir = m_can_read(cdev, M_CAN_IR);
 	if (!ir)
-		return IRQ_NONE;
+		ret = IRQ_NONE;
 
 	/* ACK all irqs */
 	if (ir & IR_ALL_INT)
 		m_can_write(cdev, M_CAN_IR, ir);
 
+	/* If we have no M_CAN interrupts to handle, we can assume
+	 * device-specific interrupt(s) need handling.
+	 */
+	if (!ir && cdev->ops->handle_dev_interrupts)
+		ret = cdev->ops->handle_dev_interrupts(cdev);
+
 	if (cdev->ops->clear_interrupts)
 		cdev->ops->clear_interrupts(cdev);
 
+	if (!ir)
+		return ret;
+
 	/* schedule NAPI in case of
 	 * - rx IRQ
 	 * - state change IRQ
-- 
2.30.2




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux