netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Ioana Ciornei <ciorneiioana@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, andrew@lunn.ch,
	hkallweit1@gmail.com, linux@armlinux.org.uk,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Sven Schuchmann <schuchmann@schleissheimer.de>
Subject: Re: [PATCH net] net: phy: ti: take into account all possible interrupt sources
Date: Sun, 28 Feb 2021 12:00:27 -0800	[thread overview]
Message-ID: <20210228120027.76488180@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20210226153020.867852-1-ciorneiioana@gmail.com>

On Fri, 26 Feb 2021 17:30:20 +0200 Ioana Ciornei wrote:
> diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
> index be1224b4447b..f7a2ec150e54 100644
> --- a/drivers/net/phy/dp83822.c
> +++ b/drivers/net/phy/dp83822.c
> @@ -290,6 +290,7 @@ static int dp83822_config_intr(struct phy_device *phydev)
>  
>  static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
>  {
> +	bool trigger_machine = false;
>  	int irq_status;
>  
>  	/* The MISR1 and MISR2 registers are holding the interrupt status in
> @@ -305,7 +306,7 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
>  		return IRQ_NONE;
>  	}
>  	if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
> -		goto trigger_machine;
> +		trigger_machine = true;
>  
>  	irq_status = phy_read(phydev, MII_DP83822_MISR2);
>  	if (irq_status < 0) {
> @@ -313,11 +314,11 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
>  		return IRQ_NONE;
>  	}
>  	if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
> -		goto trigger_machine;
> +		trigger_machine = true;
>  
> -	return IRQ_NONE;
> +	if (!trigger_machine)
> +		return IRQ_NONE;
>  
> -trigger_machine:
>  	phy_trigger_machine(phydev);
>  
>  	return IRQ_HANDLED;

Would it be better to code it up as:

	irqreturn_t ret = IRQ_NONE;

	if (irq_status & ...)
		ret = IRQ_HANDLED;

	/* .. */

	if (ret != IRQ_NONE)
		phy_trigger_machine(phydev);

	return ret;

That reads a tiny bit better to me, but it's probably majorly
subjective so I'm happy with existing patch if you prefer it.

  reply	other threads:[~2021-02-28 20:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26 15:30 [PATCH net] net: phy: ti: take into account all possible interrupt sources Ioana Ciornei
2021-02-28 20:00 ` Jakub Kicinski [this message]
2021-03-01  8:21   ` Ioana Ciornei
2021-03-01 19:48     ` Jakub Kicinski

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=20210228120027.76488180@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=ciorneiioana@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=schuchmann@schleissheimer.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;
as well as URLs for NNTP newsgroup(s).