From patchwork Fri May 13 18:03:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 9092811 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1E9B29F372 for ; Fri, 13 May 2016 18:04:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D2AE2024C for ; Fri, 13 May 2016 18:04:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 425C72021A for ; Fri, 13 May 2016 18:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752960AbcEMSEE (ORCPT ); Fri, 13 May 2016 14:04:04 -0400 Received: from arroyo.ext.ti.com ([198.47.19.12]:39435 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752361AbcEMSED (ORCPT ); Fri, 13 May 2016 14:04:03 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id u4DI3roO030103; Fri, 13 May 2016 13:03:53 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u4DI3rrY005464; Fri, 13 May 2016 13:03:53 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Fri, 13 May 2016 13:03:52 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u4DI3ps4029385; Fri, 13 May 2016 13:03:52 -0500 From: Grygorii Strashko To: "Rafael J. Wysocki" , , Len Brown , Pavel Machek CC: Greg Kroah-Hartman , Kevin Hilman , Ulf Hansson , , Grygorii Strashko Subject: [PATCH] PM / sleep: fix unbalanced pm runtime disable in __device_suspend_late() Date: Fri, 13 May 2016 21:03:48 +0300 Message-ID: <1463162628-16976-1-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.8.2 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The PM runtime will be left disabled for the device if its .suspend_late() callback fails and async suspend is not allowed for this device. In this case device will not be added in dpm_late_early_list and dpm_resume_early() will ignore this device, as result PM runtime will be disabled for it forever (side effect: after 8 subsequent failures for the same device the PM runtime will be reenabled due to disable_depth overflow). Hence, re-enable PM runtime in __device_suspend_late() if .suspend_late() callback fails and async suspend is not allowed for this device. Signed-off-by: Grygorii Strashko --- drivers/base/power/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 6e7c3cc..9b266e5 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1207,10 +1207,13 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as } error = dpm_run_callback(callback, dev, state, info); - if (!error) + if (!error) { dev->power.is_late_suspended = true; - else + } else { async_error = error; + if (!is_async(dev)) + pm_runtime_enable(dev); + } Complete: TRACE_SUSPEND(error);