diff mbox series

[net] net: phy: micrel: fix shared interrupt on LAN8814

Message ID 20220920141619.808117-1-michael@walle.cc (mailing list archive)
State Accepted
Commit 2002fbac743b6e2391b4ed50ad9eb626768dd78a
Delegated to: Netdev Maintainers
Headers show
Series [net] net: phy: micrel: fix shared interrupt on LAN8814 | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 40 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Michael Walle Sept. 20, 2022, 2:16 p.m. UTC
Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814
phy") the handler always returns IRQ_HANDLED, except in an error case.
Before that commit, the interrupt status register was checked and if
it was empty, IRQ_NONE was returned. Restore that behavior to play nice
with the interrupt line being shared with others.

Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")
Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/net/phy/micrel.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Comments

Andrew Lunn Sept. 20, 2022, 3:44 p.m. UTC | #1
On Tue, Sep 20, 2022 at 04:16:19PM +0200, Michael Walle wrote:
> Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814
> phy") the handler always returns IRQ_HANDLED, except in an error case.
> Before that commit, the interrupt status register was checked and if
> it was empty, IRQ_NONE was returned. Restore that behavior to play nice
> with the interrupt line being shared with others.
> 
> Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Horatiu Vultur Sept. 21, 2022, 6:40 a.m. UTC | #2
The 09/20/2022 16:16, Michael Walle wrote:
> 
> Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814
> phy") the handler always returns IRQ_HANDLED, except in an error case.
> Before that commit, the interrupt status register was checked and if
> it was empty, IRQ_NONE was returned. Restore that behavior to play nice
> with the interrupt line being shared with others.
> 
> Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>

> ---
>  drivers/net/phy/micrel.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 98e9bc101d96..21b6facf6e76 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -2732,16 +2732,19 @@ static int lan8804_config_intr(struct phy_device *phydev)
>  static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
>  {
>         int irq_status, tsu_irq_status;
> +       int ret = IRQ_NONE;
> 
>         irq_status = phy_read(phydev, LAN8814_INTS);
> -       if (irq_status > 0 && (irq_status & LAN8814_INT_LINK))
> -               phy_trigger_machine(phydev);
> -
>         if (irq_status < 0) {
>                 phy_error(phydev);
>                 return IRQ_NONE;
>         }
> 
> +       if (irq_status & LAN8814_INT_LINK) {
> +               phy_trigger_machine(phydev);
> +               ret = IRQ_HANDLED;
> +       }
> +
>         while (1) {
>                 tsu_irq_status = lanphy_read_page_reg(phydev, 4,
>                                                       LAN8814_INTR_STS_REG);
> @@ -2750,12 +2753,15 @@ static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
>                     (tsu_irq_status & (LAN8814_INTR_STS_REG_1588_TSU0_ |
>                                        LAN8814_INTR_STS_REG_1588_TSU1_ |
>                                        LAN8814_INTR_STS_REG_1588_TSU2_ |
> -                                      LAN8814_INTR_STS_REG_1588_TSU3_)))
> +                                      LAN8814_INTR_STS_REG_1588_TSU3_))) {
>                         lan8814_handle_ptp_interrupt(phydev);
> -               else
> +                       ret = IRQ_HANDLED;
> +               } else {
>                         break;
> +               }
>         }
> -       return IRQ_HANDLED;
> +
> +       return ret;
>  }
> 
>  static int lan8814_ack_interrupt(struct phy_device *phydev)
> --
> 2.30.2
>
Divya Koppera Sept. 21, 2022, 6:49 a.m. UTC | #3
> -----Original Message-----
> From: Michael Walle <michael@walle.cc>
> Sent: Tuesday, September 20, 2022 7:46 PM
> To: Andrew Lunn <andrew@lunn.ch>; Heiner Kallweit
> <hkallweit1@gmail.com>; Russell King <linux@armlinux.org.uk>; David S .
> Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>;
> Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>
> Cc: Divya Koppera - I30481 <Divya.Koppera@microchip.com>;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Horatiu Vultur -
> M31836 <Horatiu.Vultur@microchip.com>; Michael Walle
> <michael@walle.cc>
> Subject: [PATCH net] net: phy: micrel: fix shared interrupt on LAN8814
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
> 
> Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814
> phy") the handler always returns IRQ_HANDLED, except in an error case.
> Before that commit, the interrupt status register was checked and if it was
> empty, IRQ_NONE was returned. Restore that behavior to play nice with the
> interrupt line being shared with others.
> 
> Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
>  drivers/net/phy/micrel.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index
> 98e9bc101d96..21b6facf6e76 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -2732,16 +2732,19 @@ static int lan8804_config_intr(struct phy_device
> *phydev)  static irqreturn_t lan8814_handle_interrupt(struct phy_device
> *phydev)  {
>         int irq_status, tsu_irq_status;
> +       int ret = IRQ_NONE;
> 
>         irq_status = phy_read(phydev, LAN8814_INTS);
> -       if (irq_status > 0 && (irq_status & LAN8814_INT_LINK))
> -               phy_trigger_machine(phydev);
> -
>         if (irq_status < 0) {
>                 phy_error(phydev);
>                 return IRQ_NONE;
>         }
> 
> +       if (irq_status & LAN8814_INT_LINK) {
> +               phy_trigger_machine(phydev);
> +               ret = IRQ_HANDLED;
> +       }
> +
>         while (1) {
>                 tsu_irq_status = lanphy_read_page_reg(phydev, 4,
>                                                       LAN8814_INTR_STS_REG); @@ -2750,12 +2753,15
> @@ static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
>                     (tsu_irq_status & (LAN8814_INTR_STS_REG_1588_TSU0_ |
>                                        LAN8814_INTR_STS_REG_1588_TSU1_ |
>                                        LAN8814_INTR_STS_REG_1588_TSU2_ |
> -                                      LAN8814_INTR_STS_REG_1588_TSU3_)))
> +
> + LAN8814_INTR_STS_REG_1588_TSU3_))) {
>                         lan8814_handle_ptp_interrupt(phydev);
> -               else
> +                       ret = IRQ_HANDLED;
> +               } else {
>                         break;
> +               }
>         }
> -       return IRQ_HANDLED;
> +
> +       return ret;
>  }
> 
>  static int lan8814_ack_interrupt(struct phy_device *phydev)
> --
> 2.30.2

Reviewed-by: Divya Koppera <Divya.Koppera@microchip.com>
patchwork-bot+netdevbpf@kernel.org Sept. 22, 2022, 2:10 p.m. UTC | #4
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 20 Sep 2022 16:16:19 +0200 you wrote:
> Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814
> phy") the handler always returns IRQ_HANDLED, except in an error case.
> Before that commit, the interrupt status register was checked and if
> it was empty, IRQ_NONE was returned. Restore that behavior to play nice
> with the interrupt line being shared with others.
> 
> Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")
> Signed-off-by: Michael Walle <michael@walle.cc>
> 
> [...]

Here is the summary with links:
  - [net] net: phy: micrel: fix shared interrupt on LAN8814
    https://git.kernel.org/netdev/net/c/2002fbac743b

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 98e9bc101d96..21b6facf6e76 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -2732,16 +2732,19 @@  static int lan8804_config_intr(struct phy_device *phydev)
 static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
 {
 	int irq_status, tsu_irq_status;
+	int ret = IRQ_NONE;
 
 	irq_status = phy_read(phydev, LAN8814_INTS);
-	if (irq_status > 0 && (irq_status & LAN8814_INT_LINK))
-		phy_trigger_machine(phydev);
-
 	if (irq_status < 0) {
 		phy_error(phydev);
 		return IRQ_NONE;
 	}
 
+	if (irq_status & LAN8814_INT_LINK) {
+		phy_trigger_machine(phydev);
+		ret = IRQ_HANDLED;
+	}
+
 	while (1) {
 		tsu_irq_status = lanphy_read_page_reg(phydev, 4,
 						      LAN8814_INTR_STS_REG);
@@ -2750,12 +2753,15 @@  static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
 		    (tsu_irq_status & (LAN8814_INTR_STS_REG_1588_TSU0_ |
 				       LAN8814_INTR_STS_REG_1588_TSU1_ |
 				       LAN8814_INTR_STS_REG_1588_TSU2_ |
-				       LAN8814_INTR_STS_REG_1588_TSU3_)))
+				       LAN8814_INTR_STS_REG_1588_TSU3_))) {
 			lan8814_handle_ptp_interrupt(phydev);
-		else
+			ret = IRQ_HANDLED;
+		} else {
 			break;
+		}
 	}
-	return IRQ_HANDLED;
+
+	return ret;
 }
 
 static int lan8814_ack_interrupt(struct phy_device *phydev)