From patchwork Fri Apr 15 18:14:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 711191 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3FIH4BC010383 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 15 Apr 2011 18:17:25 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p3FIF7J7027878; Fri, 15 Apr 2011 11:15:08 -0700 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p3FIF3FR027863 for ; Fri, 15 Apr 2011 11:15:05 -0700 Received: from axis700.grange (pD9EB8F8A.dip0.t-ipconnect.de [217.235.143.138]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0MTJZq-1QLLwA1d3O-00S9xA; Fri, 15 Apr 2011 20:15:00 +0200 Received: by axis700.grange (Postfix, from userid 1000) id 076DAE6AB4; Fri, 15 Apr 2011 20:14:59 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id F0B6A1067E6; Fri, 15 Apr 2011 20:14:59 +0200 (CEST) Date: Fri, 15 Apr 2011 20:14:59 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-pm@lists.linux-foundation.org Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:uIB7xvpRhmcx6CxuCvo11IYyu0AtSUaVZKqmISdFmkh SEH6UyT28NoD4pfXZbUy9BUkRYYQv33m59J+NQbbu23s1cRCm/ D74z41G/Zg1h8wdyvJCThQhqUCoXnuoRmGDCnIpHHynOg8OnOc c+dnejJ6A+D8jzrFIgxT/WRwvp72BXZH4hoK/62pWbpnxtnMor 5WbONv3hCmjzQkuJw+gk8nDSG9v2+QrNYHDzMekIoY= Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-4.694 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SPF_PASS, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: Magnus Damm Subject: [linux-pm] [PATCH/RFC] pm: disabling runtime power-management has to reset the status X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 15 Apr 2011 18:17:25 +0000 (UTC) Restore the initial RPM_SUSPENDED runtime pm status, when disabling, otherwise the following enable will not function. This happens, e.g., when unloading and reloading drivers. Signed-off-by: Guennadi Liakhovetski Cc: Simon Horman Cc: Magnus Damm --- No, I do not claim to understand the thousand of states, flags, and counters, this just happens to fix the problem for me. Feel free to make a correct solution out of this. drivers/base/power/runtime.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 3172c60..83d6898 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1012,8 +1012,10 @@ void __pm_runtime_disable(struct device *dev, bool check_resume) pm_runtime_put_noidle(dev); } - if (!dev->power.disable_depth++) + if (!dev->power.disable_depth++) { __pm_runtime_barrier(dev); + dev->power.runtime_status = RPM_SUSPENDED; + } out: spin_unlock_irq(&dev->power.lock);