linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Brad Mouring <brad.mouring@ni.com>, Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: Move interrupt check from phy_check to phy_interrupt
Date: Thu, 8 Mar 2018 22:41:04 +0300	[thread overview]
Message-ID: <704e7f37-2b94-7e1f-c42f-374254bc791c@cogentembedded.com> (raw)
In-Reply-To: <20180307225042.2205-1-brad.mouring@ni.com>

Hello!

On 03/08/2018 01:50 AM, Brad Mouring wrote:

> If multiple phys share the same interrupt (e.g. a multi-phy chip),
> the first device registered is the only one checked as phy_interrupt
> will always return IRQ_HANDLED if the first phydev is not halted.
> Move the interrupt check into phy_interrupt and, if it was not this
> phydev, return IRQ_NONE to allow other devices on this irq a chance
> to check if it was their interrupt.

   Hm, looking at kernel/irq/handle.c, all registered IRQ handlers are always
called regardless of their results. Care to explain?

> Signed-off-by: Brad Mouring <brad.mouring@ni.com>
> ---
>  drivers/net/phy/phy.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index e3e29c2b028b..ff1aa815568f 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -632,6 +632,12 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
>  	if (PHY_HALTED == phydev->state)
>  		return IRQ_NONE;		/* It can't be ours.  */
>  
> +	if (phy_interrupt_is_valid(phydev)) {

  Always true in this context, no?

> +		if (phydev->drv->did_interrupt &&
> +			!phydev->drv->did_interrupt(phydev))

   I don't think we can do this in the interrupt context as this function *will*
read from MDIO... I think that was the reason why IRQ handling is done in the
thread context... 

> +			return IRQ_NONE;
> +	}
> +
>  	phy_change(phydev);
>  
>  	return IRQ_HANDLED;
[...]

MBR, Sergei

  parent reply	other threads:[~2018-03-08 19:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 22:50 [PATCH] net: phy: Move interrupt check from phy_check to phy_interrupt Brad Mouring
2018-03-08 16:29 ` Andrew Lunn
2018-03-08 16:46   ` Brad Mouring
2018-03-08 19:41 ` Sergei Shtylyov [this message]
2018-03-08 19:57   ` Sergei Shtylyov
2018-03-08 20:16   ` Brad Mouring
2018-03-08 20:25 ` Sergei Shtylyov
2018-03-08 20:31 ` [PATCH] net: phy: Tell caller result of phy_change() Brad Mouring
2018-03-08 20:47   ` Andrew Lunn
2018-03-08 22:23   ` [PATCH net v3] " Brad Mouring
2018-03-12 14:34     ` David Miller

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=704e7f37-2b94-7e1f-c42f-374254bc791c@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=andrew@lunn.ch \
    --cc=brad.mouring@ni.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).