All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next 0/2] net: phy: remove phy_error from phy_disable_interrupts
@ 2018-03-05 21:29 Heiner Kallweit
  2018-03-05 21:34 ` [PATCH v2 net-next 1/2] " Heiner Kallweit
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Heiner Kallweit @ 2018-03-05 21:29 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev

All callers of phy_disable_interrupts() call phy_error() in the error
case. Therefore we don't need to do this within the function too.
This change also allows us to use phy_disable_interrupts() in code
holding phydev->lock (because phy_error() takes this lock).
Make use of this in phy_stop().

v2:
- splitted into two separate patches

Heiner Kallweit (2):
  net: phy: remove phy_error from phy_disable_interrupts
  net: phy: use phy_disable_interrupts in phy_stop

 drivers/net/phy/phy.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

-- 
2.16.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 net-next 1/2] net: phy: remove phy_error from phy_disable_interrupts
  2018-03-05 21:29 [PATCH v2 net-next 0/2] net: phy: remove phy_error from phy_disable_interrupts Heiner Kallweit
@ 2018-03-05 21:34 ` Heiner Kallweit
  2018-03-06 16:59   ` Andrew Lunn
  2018-03-05 21:34 ` [PATCH v2 net-next 2/2] net: phy: use phy_disable_interrupts in phy_stop Heiner Kallweit
  2018-03-07 17:30 ` [PATCH v2 net-next 0/2] net: phy: remove phy_error from phy_disable_interrupts David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Heiner Kallweit @ 2018-03-05 21:34 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev

All callers of phy_disable_interrupts() call phy_error() in the error
case. Therefore we don't need to do this within the function too.
This change also allows us to use phy_disable_interrupts() in code
holding phydev->lock (because phy_error() can take this lock).

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index a6f924fee..c5aa773ea 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -662,19 +662,10 @@ static int phy_disable_interrupts(struct phy_device *phydev)
 	/* Disable PHY interrupts */
 	err = phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED);
 	if (err)
-		goto phy_err;
+		return err;
 
 	/* Clear the interrupt */
-	err = phy_clear_interrupt(phydev);
-	if (err)
-		goto phy_err;
-
-	return 0;
-
-phy_err:
-	phy_error(phydev);
-
-	return err;
+	return phy_clear_interrupt(phydev);
 }
 
 /**
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 net-next 2/2] net: phy: use phy_disable_interrupts in phy_stop
  2018-03-05 21:29 [PATCH v2 net-next 0/2] net: phy: remove phy_error from phy_disable_interrupts Heiner Kallweit
  2018-03-05 21:34 ` [PATCH v2 net-next 1/2] " Heiner Kallweit
@ 2018-03-05 21:34 ` Heiner Kallweit
  2018-03-06 16:59   ` Andrew Lunn
  2018-03-07 17:30 ` [PATCH v2 net-next 0/2] net: phy: remove phy_error from phy_disable_interrupts David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Heiner Kallweit @ 2018-03-05 21:34 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev

Now that phy_disable_interrupts() can't take lock phydev->lock any longer,
we can use it to simplify phy_stop().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index c5aa773ea..c2d9027be 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -765,13 +765,8 @@ void phy_stop(struct phy_device *phydev)
 	if (PHY_HALTED == phydev->state)
 		goto out_unlock;
 
-	if (phy_interrupt_is_valid(phydev)) {
-		/* Disable PHY Interrupts */
-		phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED);
-
-		/* Clear any pending interrupts */
-		phy_clear_interrupt(phydev);
-	}
+	if (phy_interrupt_is_valid(phydev))
+		phy_disable_interrupts(phydev);
 
 	phydev->state = PHY_HALTED;
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net-next 1/2] net: phy: remove phy_error from phy_disable_interrupts
  2018-03-05 21:34 ` [PATCH v2 net-next 1/2] " Heiner Kallweit
@ 2018-03-06 16:59   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2018-03-06 16:59 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Florian Fainelli, David Miller, netdev

On Mon, Mar 05, 2018 at 10:34:27PM +0100, Heiner Kallweit wrote:
> All callers of phy_disable_interrupts() call phy_error() in the error
> case. Therefore we don't need to do this within the function too.
> This change also allows us to use phy_disable_interrupts() in code
> holding phydev->lock (because phy_error() can take this lock).
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

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

    Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net-next 2/2] net: phy: use phy_disable_interrupts in phy_stop
  2018-03-05 21:34 ` [PATCH v2 net-next 2/2] net: phy: use phy_disable_interrupts in phy_stop Heiner Kallweit
@ 2018-03-06 16:59   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2018-03-06 16:59 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Florian Fainelli, David Miller, netdev

On Mon, Mar 05, 2018 at 10:34:46PM +0100, Heiner Kallweit wrote:
> Now that phy_disable_interrupts() can't take lock phydev->lock any longer,
> we can use it to simplify phy_stop().
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

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

    Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net-next 0/2] net: phy: remove phy_error from phy_disable_interrupts
  2018-03-05 21:29 [PATCH v2 net-next 0/2] net: phy: remove phy_error from phy_disable_interrupts Heiner Kallweit
  2018-03-05 21:34 ` [PATCH v2 net-next 1/2] " Heiner Kallweit
  2018-03-05 21:34 ` [PATCH v2 net-next 2/2] net: phy: use phy_disable_interrupts in phy_stop Heiner Kallweit
@ 2018-03-07 17:30 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-03-07 17:30 UTC (permalink / raw)
  To: hkallweit1; +Cc: andrew, f.fainelli, netdev

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Mon, 5 Mar 2018 22:29:43 +0100

> All callers of phy_disable_interrupts() call phy_error() in the error
> case. Therefore we don't need to do this within the function too.
> This change also allows us to use phy_disable_interrupts() in code
> holding phydev->lock (because phy_error() takes this lock).
> Make use of this in phy_stop().
> 
> v2:
> - splitted into two separate patches

Series applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-07 17:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-05 21:29 [PATCH v2 net-next 0/2] net: phy: remove phy_error from phy_disable_interrupts Heiner Kallweit
2018-03-05 21:34 ` [PATCH v2 net-next 1/2] " Heiner Kallweit
2018-03-06 16:59   ` Andrew Lunn
2018-03-05 21:34 ` [PATCH v2 net-next 2/2] net: phy: use phy_disable_interrupts in phy_stop Heiner Kallweit
2018-03-06 16:59   ` Andrew Lunn
2018-03-07 17:30 ` [PATCH v2 net-next 0/2] net: phy: remove phy_error from phy_disable_interrupts David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.