All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhangfei <zhangfei.gao@linaro.org>
To: Joe Perches <joe@perches.com>
Cc: sebastian.hesselbarth@gmail.com, f.fainelli@gmail.com,
	davem@davemloft.net, sergei.shtylyov@cogentembedded.com,
	netdev@vger.kernel.org, Jiancheng Xue <xuejiancheng@huawei.com>
Subject: Re: [PATCH v1] net: phy: resume phydev when going to RESUMING
Date: Thu, 15 May 2014 09:57:39 +0800	[thread overview]
Message-ID: <53741F13.5030805@linaro.org> (raw)
In-Reply-To: <1400032650.24350.79.camel@joe-AO725>



On 05/14/2014 09:57 AM, Joe Perches wrote:
> On Wed, 2014-05-14 at 09:40 +0800, Zhangfei Gao wrote:
>> With commit be9dad1f9f26604fb ("net: phy: suspend phydev when going
>> to HALTED"), an unused PHY device will be put in a low-power mode
>> using BMCR_PDOWN. Some Ethernet drivers might be calling phy_start()
>> and phy_stop() from ndo_open and ndo_close() respectively, while
>> calling phy_connect() and phy_disconnect() from probe and remove.
>> In such a case, the PHY will be powered down during the phy_stop()
>> call, but will fail to be powered up in phy_start().
>> This patch fixes this scenario.
>
> trivial notes:
>
>> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> []
>> @@ -715,7 +715,7 @@ void phy_state_machine(struct work_struct *work)
>>   	struct delayed_work *dwork = to_delayed_work(work);
>>   	struct phy_device *phydev =
>>   			container_of(dwork, struct phy_device, state_queue);
>> -	int needs_aneg = 0, do_suspend = 0;
>> +	int needs_aneg = 0, do_suspend = 0, do_resume = 0;
>
> Perhaps these 3 vars should bool
Yes, agree.
>
>> @@ -876,6 +878,9 @@ void phy_state_machine(struct work_struct *work)
>>   	if (do_suspend)
>>   		phy_suspend(phydev);
>>
>> +	if (do_resume)
>> +		phy_resume(phydev);
>> +
>
> and these should be else if
>
> 	if (needs_aneg)
> 		...
> 	else if (do_suspend)
> 		...
> 	else if (do_resume)
> 		...
Ok, since needs_aneg can not happen simultaneously with suspend/resume.

Thanks

      reply	other threads:[~2014-05-15  1:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14  1:31 [PATCH v1] net: phy: resume phydev when going to RESUMING Zhangfei Gao
2014-05-14  1:40 ` Zhangfei Gao
2014-05-14  1:57   ` Joe Perches
2014-05-15  1:57     ` zhangfei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53741F13.5030805@linaro.org \
    --to=zhangfei.gao@linaro.org \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=joe@perches.com \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=xuejiancheng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.