lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 26 Jan 2015 21:55:46 -0800
From:	Florian Fainelli <f.fainelli@...il.com>
To:	"fugang.duan@...escale.com" <fugang.duan@...escale.com>
Cc:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>
Subject: Re: [PATCH net-next 3/4] net: phy: keep track of the PHY suspend state

2015-01-26 18:43 GMT-08:00 fugang.duan@...escale.com
<fugang.duan@...escale.com>:
> From: Florian Fainelli <f.fainelli@...il.com> Sent: Tuesday, January 27, 2015 8:31 AM
>> To: netdev@...r.kernel.org
>> Cc: davem@...emloft.net; s.hauer@...gutronix.de; Duan Fugang-B38611;
>> Florian Fainelli
>> Subject: [PATCH net-next 3/4] net: phy: keep track of the PHY suspend
>> state
>>
>> In order to avoid double calls to phydev->drv->suspend and resume, keep
>> track of whether the PHY has already been suspended as a consequence of a
>> successful call to phy_suspend(). We will use this in our MDIO bus
>> suspend/resume hooks to avoid a double suspend call.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
>> ---
>>  drivers/net/phy/phy_device.c | 22 ++++++++++++++++++----
>>  include/linux/phy.h          |  2 ++
>>  2 files changed, 20 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
>> index 3fc91e89f5a5..c90cecc0fe15 100644
>> --- a/drivers/net/phy/phy_device.c
>> +++ b/drivers/net/phy/phy_device.c
>> @@ -699,6 +699,7 @@ int phy_suspend(struct phy_device *phydev)  {
>>       struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
>>       struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
>> +     int ret = 0;
>>
>>       /* If the device has WOL enabled, we cannot suspend the PHY */
>>       phy_ethtool_get_wol(phydev, &wol);
>> @@ -706,18 +707,31 @@ int phy_suspend(struct phy_device *phydev)
>>               return -EBUSY;
>>
>>       if (phydrv->suspend)
>> -             return phydrv->suspend(phydev);
>> -     return 0;
>> +             ret = phydrv->suspend(phydev);
>> +
>> +     if (ret)
>> +             return ret;
>> +
>> +     phydev->suspended = true;
>> +
>> +     return ret;
>>  }
>>  EXPORT_SYMBOL(phy_suspend);
>>
>>  int phy_resume(struct phy_device *phydev)  {
>>       struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
>> +     int ret;
>
> => int ret = 0;

Good catch, let me re-submit with your tags, thanks for testing!
-- 
Florian
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ