From patchwork Thu Oct 27 11:23:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 79644 Delivered-To: patches@linaro.org Received: by 10.140.97.247 with SMTP id m110csp563425qge; Thu, 27 Oct 2016 04:24:11 -0700 (PDT) X-Received: by 10.25.193.198 with SMTP id r189mr5369325lff.21.1477567451078; Thu, 27 Oct 2016 04:24:11 -0700 (PDT) Return-Path: Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com. [2a00:1450:4010:c07::22d]) by mx.google.com with ESMTPS id y3si4149532lfa.179.2016.10.27.04.24.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Oct 2016 04:24:10 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22d as permitted sender) client-ip=2a00:1450:4010:c07::22d; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22d as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x22d.google.com with SMTP id b81so28008234lfe.1 for ; Thu, 27 Oct 2016 04:24:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=6DT3JJT6eNu5/d1KBQSuRRmireOiKUQF5n7dgofaOQA=; b=NFrhqevbu6vFKeeJZ4Omvs3SYPAqHWaEoM6FwFVWSzhMJV8LxkojOo1jABrI1vtOfH egXfVP3BDuAjGpjJFqr2tHIu+MrCXZ+MzThiqdFWLNFFqgZ9E7sp6Hdd9GHLdLS2/bRa HK/k5mTeErm5cyFZMiHfYu3+6MvRElXv+KFU8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6DT3JJT6eNu5/d1KBQSuRRmireOiKUQF5n7dgofaOQA=; b=k5wxrgaIExmurM7fgYe8DaPdMbI0eNZVTpi6Qf7JH1rPH3c78/ysQzjGSVcH9zfhFC FNmnpUHnDCKQN94eqt5NHskMlcZkjr9rvgFex8J8eFo+ol4ap9MFhKFSMG2m5mj8Jh4V KbiLk++TIjcrUjTsHyxy5FIP/kFUGtTVAZPj2c/jHD/VFIpDPq0Q3o3yZR0ozkhkns20 RedJuyj8ZWIAPWSPlQlk5Phf5IL48JtbxGnRQIZHiponFteufqOFyxSWDDu7bMSK01Fy XcBVU3bmqKCvwcBtnB5bnqLlGOM0G0U4nR1BBikcijzRIMqOZzOA++VOUcag3m1K6w5H LUNw== X-Gm-Message-State: ABUngvfhY8TAGb0B7chK9rZkoqo2/4E0Yw61VInafFzEVqN7xu23K1JVSiiqVyrj1I49WVuzRcU= X-Received: by 10.25.215.88 with SMTP id o85mr5798393lfg.98.1477567450460; Thu, 27 Oct 2016 04:24:10 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id b76sm1184658lfg.25.2016.10.27.04.24.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Oct 2016 04:24:09 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Alan Stern , Ulf Hansson , linux-pm@vger.kernel.org, netdev@vger.kernel.org Cc: Len Brown , Pavel Machek , Kevin Hilman , Geert Uytterhoeven , Lina Iyer , Jon Hunter , Marek Szyprowski , Linus Walleij , Steve Glendinning Subject: [PATCH] net: smsc911x: Synchronize the runtime PM status during system suspend Date: Thu, 27 Oct 2016 13:23:54 +0200 Message-Id: <1477567434-5128-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 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 Tested-by: Geert Uytterhoeven Cc: Steve Glendinning 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(+) -- 1.9.1 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."