linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: phy: realtek: Replace phy functions with non-locked version in rtl8211e_config_init()
@ 2019-05-13  6:41 Kunihiko Hayashi
  2019-05-13 12:50 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Kunihiko Hayashi @ 2019-05-13  6:41 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit, David S. Miller
  Cc: netdev, linux-kernel, Kunihiko Hayashi

After calling phy_select_page() and until calling phy_restore_page(),
the mutex 'mdio_lock' is already locked, so the driver should use
non-locked version of phy functions. Or there will be a deadlock with
'mdio_lock'.

This replaces phy functions called from rtl8211e_config_init() to avoid
the deadlock issue.

Fixes: f81dadbcf7fd ("net: phy: realtek: Add rtl8211e rx/tx delays config")
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 drivers/net/phy/realtek.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index e1f7a60..61fc76f 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -233,12 +233,12 @@ static int rtl8211e_config_init(struct phy_device *phydev)
 	if (oldpage < 0)
 		goto err_restore_page;
 
-	ret = phy_write(phydev, RTL821x_EXT_PAGE_SELECT, 0xa4);
+	ret = __phy_write(phydev, RTL821x_EXT_PAGE_SELECT, 0xa4);
 	if (ret)
 		goto err_restore_page;
 
-	ret = phy_modify(phydev, 0x1c, RTL8211E_TX_DELAY | RTL8211E_RX_DELAY,
-			 val);
+	ret = __phy_modify(phydev, 0x1c, RTL8211E_TX_DELAY | RTL8211E_RX_DELAY,
+			   val);
 
 err_restore_page:
 	return phy_restore_page(phydev, oldpage, ret);
-- 
2.7.4


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

* Re: [PATCH net] net: phy: realtek: Replace phy functions with non-locked version in rtl8211e_config_init()
  2019-05-13  6:41 [PATCH net] net: phy: realtek: Replace phy functions with non-locked version in rtl8211e_config_init() Kunihiko Hayashi
@ 2019-05-13 12:50 ` Andrew Lunn
  2019-05-13 16:11   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2019-05-13 12:50 UTC (permalink / raw)
  To: Kunihiko Hayashi
  Cc: Florian Fainelli, Heiner Kallweit, David S. Miller, netdev, linux-kernel

On Mon, May 13, 2019 at 03:41:45PM +0900, Kunihiko Hayashi wrote:
> After calling phy_select_page() and until calling phy_restore_page(),
> the mutex 'mdio_lock' is already locked, so the driver should use
> non-locked version of phy functions. Or there will be a deadlock with
> 'mdio_lock'.
> 
> This replaces phy functions called from rtl8211e_config_init() to avoid
> the deadlock issue.
> 
> Fixes: f81dadbcf7fd ("net: phy: realtek: Add rtl8211e rx/tx delays config")
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

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

    Andrew

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

* Re: [PATCH net] net: phy: realtek: Replace phy functions with non-locked version in rtl8211e_config_init()
  2019-05-13 12:50 ` Andrew Lunn
@ 2019-05-13 16:11   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2019-05-13 16:11 UTC (permalink / raw)
  To: andrew; +Cc: hayashi.kunihiko, f.fainelli, hkallweit1, netdev, linux-kernel

From: Andrew Lunn <andrew@lunn.ch>
Date: Mon, 13 May 2019 14:50:02 +0200

> On Mon, May 13, 2019 at 03:41:45PM +0900, Kunihiko Hayashi wrote:
>> After calling phy_select_page() and until calling phy_restore_page(),
>> the mutex 'mdio_lock' is already locked, so the driver should use
>> non-locked version of phy functions. Or there will be a deadlock with
>> 'mdio_lock'.
>> 
>> This replaces phy functions called from rtl8211e_config_init() to avoid
>> the deadlock issue.
>> 
>> Fixes: f81dadbcf7fd ("net: phy: realtek: Add rtl8211e rx/tx delays config")
>> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Applied.

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

end of thread, other threads:[~2019-05-13 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-13  6:41 [PATCH net] net: phy: realtek: Replace phy functions with non-locked version in rtl8211e_config_init() Kunihiko Hayashi
2019-05-13 12:50 ` Andrew Lunn
2019-05-13 16:11   ` David Miller

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