Netdev List
 help / color / mirror / Atom feed
From: Jeremy Linton <jeremy.linton@arm.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-pm@vger.kernel.org, netdev@vger.kernel.org
Cc: Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Kevin Hilman <khilman@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Lina Iyer <lina.iyer@linaro.org>,
	Jon Hunter <jonathanh@nvidia.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Steve Glendinning <steve.glendinning@shawell.net>
Subject: Re: [PATCH] net: smsc911x: Synchronize the runtime PM status during system suspend
Date: Fri, 28 Oct 2016 10:33:12 -0500	[thread overview]
Message-ID: <6a87415f-0ff8-a352-cff5-65806509a981@arm.com> (raw)
In-Reply-To: <1477567434-5128-1-git-send-email-ulf.hansson@linaro.org>

Hi,

On 10/27/2016 06:23 AM, Ulf Hansson wrote:
> The smsc911c driver puts its device into low power state when entering
> system suspend. Although it doesn't update the device's runtime PM status
> to RPM_SUSPENDED, which causes problems for a parent device.
>
> In particular, when the runtime PM status of the parent is requested to be
> updated to RPM_SUSPENDED, the runtime PM core prevent this, because it's
> forbidden to runtime suspend a device, which has an active child.
>
> Fix this by updating the runtime PM status of the smsc911x device to
> RPM_SUSPENDED during system suspend. In system resume, let's reverse that
> action by runtime resuming the device and thus also the parent.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Steve Glendinning <steve.glendinning@shawell.net>
> Fixes: 8b1107b85efd ("PM / Runtime: Don't allow to suspend a device with an active child")
> ---
>
> Note that the commit this change fixes is currently queued for 4.10 via
> Rafael's linux-pm tree. So this fix should go via that tree as well.
>
> ---
>  drivers/net/ethernet/smsc/smsc911x.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
> index e9b8579..65fca9c 100644
> --- a/drivers/net/ethernet/smsc/smsc911x.c
> +++ b/drivers/net/ethernet/smsc/smsc911x.c
> @@ -2584,6 +2584,9 @@ static int smsc911x_suspend(struct device *dev)
>  		PMT_CTRL_PM_MODE_D1_ | PMT_CTRL_WOL_EN_ |
>  		PMT_CTRL_ED_EN_ | PMT_CTRL_PME_EN_);
>
> +	pm_runtime_disable(dev);
> +	pm_runtime_set_suspended(dev);

> +
>  	return 0;
>  }
>
> @@ -2593,6 +2596,9 @@ static int smsc911x_resume(struct device *dev)
>  	struct smsc911x_data *pdata = netdev_priv(ndev);
>  	unsigned int to = 100;
>
> +	pm_runtime_enable(dev);
> +	pm_runtime_resume(dev);
> +
>  	/* Note 3.11 from the datasheet:
>  	 * 	"When the LAN9220 is in a power saving state, a write of any
>  	 * 	 data to the BYTE_TEST register will wake-up the device."
>

This seems an unusual change/sequence. I thought a successful return 
from the suspend callback would set the device state to suspended.

I just checked a few other ethernet drivers suspend/resume sequences and 
directly calling the pm_runtime seems a little unusual. Most of the 
other drivers are checking to see if the interface is running then doing 
a netif_device_detach()/attach() sequence which is missing from this 
drivers suspend/resume path. Could that be part of the problem?

Of course my knowledge of the power management system is a little thin 
so I could be really off base.

      parent reply	other threads:[~2016-10-28 15:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 11:23 [PATCH] net: smsc911x: Synchronize the runtime PM status during system suspend Ulf Hansson
2016-10-27 11:41 ` Geert Uytterhoeven
2016-10-27 11:53   ` Ulf Hansson
2016-10-27 11:54     ` Geert Uytterhoeven
2016-10-27 17:47       ` Ulf Hansson
2016-11-01  4:19     ` Rafael J. Wysocki
2016-11-01 23:53       ` Ulf Hansson
2016-10-28 15:33 ` Jeremy Linton [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=6a87415f-0ff8-a352-cff5-65806509a981@arm.com \
    --to=jeremy.linton@arm.com \
    --cc=geert@linux-m68k.org \
    --cc=jonathanh@nvidia.com \
    --cc=khilman@kernel.org \
    --cc=len.brown@intel.com \
    --cc=lina.iyer@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=netdev@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=stern@rowland.harvard.edu \
    --cc=steve.glendinning@shawell.net \
    --cc=ulf.hansson@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox