Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp274515ybi; Wed, 29 May 2019 21:09:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGL36yr1KbiYbCinO6jaBX9KZgqGpW2mSvLkhjm5W5KWhxLYeP8QkTyHNXGv3DwBxD0iCR X-Received: by 2002:a63:4621:: with SMTP id t33mr1885571pga.246.1559189386228; Wed, 29 May 2019 21:09:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559189386; cv=none; d=google.com; s=arc-20160816; b=U6gecdk5uVmyBYdsxUdUaKldbsZLc9GYo7wBNvZlFleDNJ7bdzPBRBpE2ptB5XXAcz 8IgUbyzYJDGlYNbno3FCSf+OkE8uGrKfVgCHDvwcy5/llwV+nRokwksbZd9SRRStP+Nf s1OiP9EcPh8xwlcp3snZDDCIsw13XYAPqmvBQGKnsWlBNtmZqfwbwXA7WZMPkcgeRf72 fq/We87elHq5aRhe7kkcd3bwV/thlvD5ezzczdq2G2I1QrV5JqU22Hs14C4FHloMZRZ3 LfunIH8S58sRdeAAk+so9qfsmLIVX5gDpcol2kYFcJXDyomaWppVl8R1KqGqgZZVZV8n DeDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PZFOcc9yBa8GBi7C6foVdISXwme78OHN9gj1bnpqEFE=; b=dvY2CUgTy1WsoYaf5pL2yU8KhhdcP+CwoF2n07QuT10ieJms/ZCcBYjgs+zVwkGJCb uiJoBwWLrB3DQ/128EkxLTPbpotrnIEErXkfK9FsY0wzgg2AovGos66wcCW+8El+yX0u X/USGuRzzsSXjK4jwE1YtIMhEDaEMfqpHclQ0YWs+TW7DhjrhCqK0USHBjS0XXE3dXSA JkBw4iIH9vjkerpfaFz40i3AJQYM9PV4ArfhfO10ZrZwcGhs5Lrmkqzpje/dsr/xSxkD 4/c2Q+XZr5WTNh0gr7wc8JbiL2n3UXaU2g8YBKnScCABmVBFctejPj2/mXY2UZgeuFFR wqDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xBD21zjL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1si1917972plr.74.2019.05.29.21.09.30; Wed, 29 May 2019 21:09:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xBD21zjL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbfE3EHL (ORCPT + 99 others); Thu, 30 May 2019 00:07:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:47466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731137AbfE3DRa (ORCPT ); Wed, 29 May 2019 23:17:30 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 49E032464B; Thu, 30 May 2019 03:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186250; bh=AqjRXvAowMkD8Xr9ZMA3vBOBovKcSxEwvdYWHoscRq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xBD21zjLfFnAHRbuLJaoCCvlKBipZiSUGBLL3DwR9lhwFTWf9Ob0xGFloqD7NJCi+ F5csTMvZYsks437xp4EITcTsdG8YGClU7TnK3Obj/S27zf13heT9qKXqAGpFz5nXhM CFQimDFEqsIZQXBTCGx+X6H8+ONVeXPpQ3n9vFYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Loic Pallardy , Ulf Hansson , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.19 169/276] PM / core: Propagate dev->power.wakeup_path when no callbacks Date: Wed, 29 May 2019 20:05:27 -0700 Message-Id: <20190530030535.965554437@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit dc351d4c5f4fe4d0f274d6d660227be0c3a03317 ] The dev->power.direct_complete flag may become set in device_prepare() in case the device don't have any PM callbacks (dev->power.no_pm_callbacks is set). This leads to a broken behaviour, when there is child having wakeup enabled and relies on its parent to be used in the wakeup path. More precisely, when the direct complete path becomes selected for the child in __device_suspend(), the propagation of the dev->power.wakeup_path becomes skipped as well. Let's address this problem, by checking if the device is a part the wakeup path or has wakeup enabled, then prevent the direct complete path from being used. Reported-by: Loic Pallardy Signed-off-by: Ulf Hansson [ rjw: Comment cleanup ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/base/power/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index a690fd4002605..4abd7c6531d9d 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1736,6 +1736,10 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) if (dev->power.syscore) goto Complete; + /* Avoid direct_complete to let wakeup_path propagate. */ + if (device_may_wakeup(dev) || dev->power.wakeup_path) + dev->power.direct_complete = false; + if (dev->power.direct_complete) { if (pm_runtime_status_suspended(dev)) { pm_runtime_disable(dev); -- 2.20.1