public inbox for linux-can@vger.kernel.org
 help / color / mirror / Atom feed
From: Torin Cooper-Bennun <torin@maxiluxsystems.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org
Subject: Re: [PATCH can-next 2/5] can: m_can: m_can_isr(): handle device-specific interrupts
Date: Tue, 1 Jun 2021 09:23:38 +0100	[thread overview]
Message-ID: <20210601082338.b7t67oebywhcwcnd@bigthink> (raw)
In-Reply-To: <20210526151833.5ppprex6zzrclr6u@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 2027 bytes --]

On Wed, May 26, 2021 at 05:18:33PM +0200, Marc Kleine-Budde wrote:
> On 26.05.2021 17:07:05, Marc Kleine-Budde wrote:
> > On 26.05.2021 13:47:44, Torin Cooper-Bennun wrote:
> > > +	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?
> 
> I see, clear and no clear. Why are these two separate operations?

As discussed here,

https://lore.kernel.org/linux-can/20210514141012.3ehw4tosog3lreq4@pengutronix.de/

you previously recommended adding a 2nd parameter the callback to
indicate that we only want to clear the device IR, not read it, in order
to save an SPI transaction when M_CAN core interrupts were already
handled.

However, quoting from your previous mail,

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

this implies I should leave device IR totally alone unless no M_CAN
interrupts are asserted, and do the following only:

|	ir = m_can_read(cdev, M_CAN_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);

I can probably also kill off the clear_only parameter.

--
Regards,

Torin Cooper-Bennun
Software Engineer | maxiluxsystems.com


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2021-06-01  8:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 12:47 [PATCH can-next 0/5] m_can, tcan4x5x: device-specific interrupt handling Torin Cooper-Bennun
2021-05-26 12:47 ` [PATCH can-next 1/5] can: m_can: ops: clear_interrupts -> handle_dev_interrupts Torin Cooper-Bennun
2021-05-26 12:47 ` [PATCH can-next 2/5] can: m_can: m_can_isr(): handle device-specific interrupts Torin Cooper-Bennun
2021-05-26 15:07   ` Marc Kleine-Budde
2021-05-26 15:18     ` Marc Kleine-Budde
2021-06-01  8:23       ` Torin Cooper-Bennun [this message]
2021-06-01 10:25         ` Marc Kleine-Budde
2021-06-01  7:22     ` Torin Cooper-Bennun
2021-05-26 12:47 ` [PATCH can-next 3/5] can: tcan4x5x: tcan4x5x_clear_interrupts(): rm unnecessary reg clears Torin Cooper-Bennun
2021-05-26 12:47 ` [PATCH can-next 4/5] can: tcan4x5x: only enable useful device interrupts Torin Cooper-Bennun
2021-05-26 12:47 ` [PATCH can-next 5/5] can: tcan4x5x: implement handling of " Torin Cooper-Bennun
2021-05-26 15:15   ` Marc Kleine-Budde
2021-06-01  7:50     ` Torin Cooper-Bennun
2021-06-01  8:19       ` Marc Kleine-Budde
2021-05-26 15:20 ` [PATCH can-next 0/5] m_can, tcan4x5x: device-specific interrupt handling Marc Kleine-Budde
2021-06-01  8:21   ` Torin Cooper-Bennun
2021-06-01  9:18     ` Marc Kleine-Budde
2021-06-01 10:56       ` Torin Cooper-Bennun
2021-07-02  7:33 ` Torin Cooper-Bennun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210601082338.b7t67oebywhcwcnd@bigthink \
    --to=torin@maxiluxsystems.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox