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

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

 



On 26.05.2021 13:47:44, Torin Cooper-Bennun wrote:
> Device-specific interrupts are handled, if no M_CAN core interrupts were
> handled in the ISR call.

In case there are both core and device specific interrupts the kernel
IRQ handler will call the ISR a 2nd time - should be OK.

> The patch also improves the flow at the start of m_can_isr(), removing a
> conditional which always evaluates to true, and improves comments.
> 
> Signed-off-by: Torin Cooper-Bennun <torin@xxxxxxxxxxxxxxxxxx>
> ---
>  drivers/net/can/m_can/m_can.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index fa853201d2c4..3bc957da06f7 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -1033,17 +1033,24 @@ 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 irq_ret = IRQ_NONE;

nitpick: please move before the "u32 ir;"

>  
>  	if (pm_runtime_suspended(cdev->dev))
>  		return IRQ_NONE;
> +
>  	ir = m_can_read(cdev, M_CAN_IR);
> -	if (!ir)
> -		return IRQ_NONE;
>  
> -	/* ACK all irqs */
> -	if (ir & IR_ALL_INT)
> -		m_can_write(cdev, M_CAN_IR, ir);
> +	if (!ir) {
> +		/* Handle device-specific interrupts */
> +		if (cdev->ops->handle_dev_interrupts)
> +			irq_ret = cdev->ops->handle_dev_interrupts(cdev, false);
> +		return irq_ret;
> +	}
> +
> +	/* ACK M_CAN interrupts */
> +	m_can_write(cdev, M_CAN_IR, ir);
>  
> +	/* ACK device-specific interrupts */
>  	if (cdev->ops->handle_dev_interrupts)
>  		cdev->ops->handle_dev_interrupts(cdev, true);

Why do you call a 2nd time the handle_dev_interrupts() callback?

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature


[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