Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2231983ybi; Thu, 20 Jun 2019 11:17:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpfFC2dSN3Oc3SYlFmrwTLH6VZZOzSctJ3DwYNAlmd14ZBPYy5B1nLFIrICMcI2nA8hudM X-Received: by 2002:a62:5105:: with SMTP id f5mr132385408pfb.127.1561054621857; Thu, 20 Jun 2019 11:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054621; cv=none; d=google.com; s=arc-20160816; b=eis4mic40XPvGlST4FZOhLz1yWUmrvGdH1KmCVlK4oZ2hTW0D6WckBkRaygsWO6+s2 j1q7tF/D9rpnWPBLl9SSSuNz64ZxCg1z+yJ0o4YeZCi3rRpicPDs1g30Of50wj3tVzLE 27QdpvovEzn7oGpJv1URV1Kwuj/gkJDhTApPn64lNlaHB5N25ESFHa7zzHYqK5AtnLtH hSPxEKDca5nJOhzdRDOUCkKqz2FfiX5iaaIjMa+SI2bixSMS9CRq7w/Rk0vwxuh3QgFt 7R0EzjJ30CO7f6bFJw8MYwzh9zpw7c9Q1me+t0mAeuKkRX12qwomzkbiXQPE3WMteCQz 110g== 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=0NArjdVtAoW3jC2gdIJcVqWl+cFc+jtKWl96EvG/YTg=; b=J7wQsF4zgyaZ8ZLDRWqnI+QsdTgrTrJSMP2uAF7jYa6q8zJocpuXWzkH8JCP9jHefx ZOAg8dVLDY+OYI+4lWRrbm5V5UmUkXEQqCilWakdHn3oM65cYLx+ybHx+hbXFvqq8PKN fqxshDt1BecLLdC5dAHZUhtkSJcfiBS3log/rTQ8v5KgiOg9ecsgJCdJ6KnolqhyVLPs 5vYpH1tTVIHePWx8ciCk01YuJEQE2KvJSl5uJEJb1Yv4VL7E8ibbtv1ezKnxdVeJECYd DCozuMDx8bzy40MIZP0x0tSV/dG8QYh+KQgdxiSoDG932dEFMOtB+9FGlCDsJpK+7mym MFbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XGUKNsrV; 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 s36si342019pld.164.2019.06.20.11.16.46; Thu, 20 Jun 2019 11:17:01 -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=XGUKNsrV; 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 S1729602AbfFTSP1 (ORCPT + 99 others); Thu, 20 Jun 2019 14:15:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:44184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729594AbfFTSPZ (ORCPT ); Thu, 20 Jun 2019 14:15:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 DFE902082C; Thu, 20 Jun 2019 18:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054524; bh=MVJXWWRUgvZ1zUCh0VY4byhSg34+07e77MeVGbVwFVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGUKNsrVhRorGaXn4mbncwnxLYVSX90oy/NiFnP0SuStkeM6X761RfLlxSRuTb2Kw wMfUeTw81Vv2XoTwgrbSeh74dzYLl0e3VBFPDyfgi6eYNe75swHNVPlJJw3Zg9kR5m fRhbpm41+Cp6otGlcNVLLRBEp/nkrgVvhwDx8GLY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Mika Westerberg , Sasha Levin Subject: [PATCH 5.1 59/98] ACPI/PCI: PM: Add missing wakeup.flags.valid checks Date: Thu, 20 Jun 2019 19:57:26 +0200 Message-Id: <20190620174352.041727866@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@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 9a51c6b1f9e0239a9435db036b212498a2a3b75c ] Both acpi_pci_need_resume() and acpi_dev_needs_resume() check if the current ACPI wakeup configuration of the device matches what is expected as far as system wakeup from sleep states is concerned, as reflected by the device_may_wakeup() return value for the device. However, they only should do that if wakeup.flags.valid is set for the device's ACPI companion, because otherwise the wakeup.prepare_count value for it is meaningless. Add the missing wakeup.flags.valid checks to these functions. Signed-off-by: Rafael J. Wysocki Reviewed-by: Mika Westerberg Signed-off-by: Sasha Levin --- drivers/acpi/device_pm.c | 4 ++-- drivers/pci/pci-acpi.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 824ae985ad93..ccb59768b1f3 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -949,8 +949,8 @@ static bool acpi_dev_needs_resume(struct device *dev, struct acpi_device *adev) u32 sys_target = acpi_target_system_state(); int ret, state; - if (!pm_runtime_suspended(dev) || !adev || - device_may_wakeup(dev) != !!adev->wakeup.prepare_count) + if (!pm_runtime_suspended(dev) || !adev || (adev->wakeup.flags.valid && + device_may_wakeup(dev) != !!adev->wakeup.prepare_count)) return true; if (sys_target == ACPI_STATE_S0) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index e1949f7efd9c..bf32fde328c2 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -666,7 +666,8 @@ static bool acpi_pci_need_resume(struct pci_dev *dev) if (!adev || !acpi_device_power_manageable(adev)) return false; - if (device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count) + if (adev->wakeup.flags.valid && + device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count) return true; if (acpi_target_system_state() == ACPI_STATE_S0) -- 2.20.1