[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8c455cf6-9556-63bb-7f2d-76f2c4027d73@gmail.com>
Date: Fri, 12 Jan 2018 23:13:26 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Florian Fainelli <f.fainelli@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] phy: realtek: use new helpers for paged register access
Am 12.01.2018 um 22:01 schrieb Andrew Lunn:
> On Fri, Jan 12, 2018 at 09:30:08PM +0100, Heiner Kallweit wrote:
>> Make use of the new helpers for paged register access.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
>> ---
>> drivers/net/phy/realtek.c | 59 +++++++++++------------------------------------
>> 1 file changed, 14 insertions(+), 45 deletions(-)
>>
>> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
>> index 7c1bf688d..887bad07a 100644
>> --- a/drivers/net/phy/realtek.c
>> +++ b/drivers/net/phy/realtek.c
>> @@ -41,37 +41,14 @@ MODULE_DESCRIPTION("Realtek PHY driver");
>> MODULE_AUTHOR("Johnson Leung");
>> MODULE_LICENSE("GPL");
>>
>> -static int rtl8211x_page_read(struct phy_device *phydev, u16 page, u16 address)
>> +static int rtl821x_read_page(struct phy_device *phydev)
>> {
>> - int ret;
>> -
>> - ret = phy_write(phydev, RTL821x_PAGE_SELECT, page);
>> - if (ret)
>> - return ret;
>> -
>> - ret = phy_read(phydev, address);
>> -
>> - /* restore to default page 0 */
>> - phy_write(phydev, RTL821x_PAGE_SELECT, 0x0);
>> -
>> - return ret;
>> + return phy_read(phydev, RTL821x_PAGE_SELECT);
>
> Hi Heiner
>
> It think this is wrong. You need to use __phy_read(). phy_read() does
> an mdiobus_read(), which takes the bus->mdio_lock. However,
>
Uh, you are of course right.
> int phy_save_page(struct phy_device *phydev)
> {
> mutex_lock(&phydev->mdio.bus->mdio_lock);
> return __phy_read_page(phydev);
> }
>
> This also takes the same lock. So this should deadlock.
>
> Try turning on CONFIG_PROVE_LOCKING, it will detect problems like
> this.
>
Thanks for the hint. I have this option set, however my test system
doesn't use the irq-related callbacks. So it wasn't able to report
the issue. My fault.
> Andrew
>
Powered by blists - more mailing lists