[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7c46798b-35c3-9c10-1856-9a61f873aca7@ti.com>
Date: Fri, 6 Oct 2017 07:00:49 -0500
From: Dan Murphy <dmurphy@...com>
To: Andrew Lunn <andrew@...n.ch>, <Woojung.Huh@...rochip.com>
CC: <f.fainelli@...il.com>, <netdev@...r.kernel.org>, <afd@...com>
Subject: Re: [PATCH 2/3 v2] net: phy: DP83822 initial driver submission
Andrew
On 10/04/2017 06:53 PM, Andrew Lunn wrote:
> On Wed, Oct 04, 2017 at 10:44:36PM +0000, Woojung.Huh@...rochip.com wrote:
>>> +static int dp83822_suspend(struct phy_device *phydev)
>>> +{
>>> + int value;
>>> +
>>> + mutex_lock(&phydev->lock);
>>> + value = phy_read_mmd(phydev, DP83822_DEVADDR,
>>> MII_DP83822_WOL_CFG);
>>> + mutex_unlock(&phydev->lock);
>
>> Would we need mutex to access phy_read_mmd()?
>> phy_read_mmd() has mdio_lock for indirect access.
>
> Hi Woojung
>
> The mdio lock is not sufficient. It protects against two mdio
> accesses. But here we need to protect against two phy operations.
> There is a danger something else tries to access the phy during
> suspend.
>
>>> + if (!(value & DP83822_WOL_EN))
>>> + genphy_suspend(phydev);
>
> Releasing the lock before calling genphy_suspend() is not so nice.
> Maybe add a version which assumes the lock has already been taken?
>
The marvell driver does not take a lock and calls genphy_suspend/resume
so I am wondering if this driver needs to take a lock.
The at803x needs to take the lock because it does not call into the genphy
functions.
I will submit a new version with the lock removed.
Dan
> Andrew
>
--
------------------
Dan Murphy
Powered by blists - more mailing lists