From patchwork Mon Jun 20 09:14:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 70417 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1413604qgy; Mon, 20 Jun 2016 02:17:04 -0700 (PDT) X-Received: by 10.98.33.138 with SMTP id o10mr20616081pfj.151.1466414224832; Mon, 20 Jun 2016 02:17:04 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4si32202863pfj.47.2016.06.20.02.17.04; Mon, 20 Jun 2016 02:17:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752098AbcFTJPH (ORCPT + 14 others); Mon, 20 Jun 2016 05:15:07 -0400 Received: from mail-lf0-f49.google.com ([209.85.215.49]:33284 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753303AbcFTJOm (ORCPT ); Mon, 20 Jun 2016 05:14:42 -0400 Received: by mail-lf0-f49.google.com with SMTP id f6so33559133lfg.0 for ; Mon, 20 Jun 2016 02:14:41 -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=bxily7Pbgb01fMcRBXPYZx04+1zeTB9jMGd7RqjGW5o=; b=NZZEuoxXhXQ7XNO8peGOg1OYKDuQlRoOYlfEgJoGbj8Vciok7kSibkP+ZLQUskDbBh 7DeIegB3dmqEIhLwQrt00/Gwk5kZhVcD8f0sUFudWaytpPoaP9JjhVAthvVYjuadaWpT yJUGyZ3FvYhiZhCUX7wNgu/DnuUcNc/sm9O+0= 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=bxily7Pbgb01fMcRBXPYZx04+1zeTB9jMGd7RqjGW5o=; b=VadES/vS4/Qhs+TsgOT74HuLmST0tQJSwDFyzCwX4NlV/OXaGrxW25g/bLd5BPI8zb 28WOe7f4bzS2oiqnkFF4Vqb3ii8/q6bBzlh6+Z4dGnVpuUWMOb4Ij0c/nXqg1SmccTT5 4ANAfrrUuDP0ltYxmleV++TG3HCsNSlNGN//seHZkQFjy1z7UueGR7D53ljpWQhRtIL0 ypvbgQ1EK8PibX4YTQ9bouExwAL0dGowxa3cP1oZxAVhPkMgixvaqUctw8a5XjwYITvh zmgBGh7MY5pT0+x8hZZvOWM9/TVHToHoJv6FiSXGnTcVroKDhd0Zw62O3BGpBDpp0ZFc +AQA== X-Gm-Message-State: ALyK8tKESvUZ82uafZjyUqLjH4Q3rgS02DO0VQ6IYjdrbDE4lUspfs0h7fEdBCMCw0iv7xxQ X-Received: by 10.46.9.80 with SMTP id 77mr3659053ljj.0.1466414074922; Mon, 20 Jun 2016 02:14:34 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id xq6sm4315308lbb.6.2016.06.20.02.14.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 02:14:34 -0700 (PDT) From: Linus Walleij To: "Rafael J. Wysocki" , Ulf Hansson Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH] PM / runtime: print error when activating a child to unactive parent Date: Mon, 20 Jun 2016 11:14:26 +0200 Message-Id: <1466414066-6131-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.11 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The code currently silently bails out with -EBUSY if you try to activate a child to an inactive parent. This typically happens when you have a runtime suspended parent and runtime resume your child, but forgot to set .ignore_children on the parent to true with pm_suspend_ignore_children(dev). Silently ignoring this error is not good as it gives rise to other strange behaviour like double-resume of devices after silently bailing out of the .runtime_resume() callback. Signed-off-by: Linus Walleij --- drivers/base/power/runtime.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.4.11 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index b74690418504..e7ee8293055b 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1045,10 +1045,14 @@ int __pm_runtime_set_status(struct device *dev, unsigned int status) */ if (!parent->power.disable_depth && !parent->power.ignore_children - && parent->power.runtime_status != RPM_ACTIVE) + && parent->power.runtime_status != RPM_ACTIVE) { + dev_err(dev, "runtime PM trying to activate child device %s but parent (%s) is not active\n", + dev_name(dev), + dev_name(parent)); error = -EBUSY; - else if (dev->power.runtime_status == RPM_SUSPENDED) + } else if (dev->power.runtime_status == RPM_SUSPENDED) { atomic_inc(&parent->power.child_count); + } spin_unlock(&parent->power.lock);