From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 728F24FE2D3; Wed, 30 Sep 2026 16:01:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790784068; cv=none; b=J0jEy70wXzrVEvD4LmP+YUtoJZVtQi4evj1PQMUrlYGxNjMr61llI0bpJotH/+44JV9YZhTjy42Oc3qSHLMEBJkq0P3SOQ+ITuu7/NUHe/9pyRu4HXYE41yIX7CTZyyAfkyzdHZQPP4L3803k1lTLeOlwZabyHr7r6LH26/Wb4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790784068; c=relaxed/simple; bh=R7Aaiapl4pipG7hfR60PGOYp8mrTDnS5PuTQBUl7NtU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iI/ctAoO90o58vtUco26quGr6m/W0qaHw2EhrDXrYnpjXwAYFKXHc06qKWL+JfscqkQqYkwch3+5u5wwcCRPqsxwh2iAotvIR/RNDUJ2g8iPPJ6CDjQc6Q67R9x/eoWLp3gxmSv+H/uaJaEAZ9CSbi2Fwdvuge4k7EhZuv5vbXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aAf78JdH; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="aAf78JdH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 452CC1F00893; Wed, 30 Sep 2026 16:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790784062; bh=6jKdnCXmPHjjHPnr5pMaEKLC2JyKP4oryxHfDWs2r5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aAf78JdHUtReye3nAGsHIsl+GaDT8Iopk+7n2bCBw2cIQGDJAYJ5Upksxq7VQsWe/ 4NVe5FjfvqcSiBHnSiRaXIbX/TxlP0W9IFkUtnBSOWuQv2NpgoZhlyOg6XOKSL31pR xp015Rcd36Hy8Zjp4isw8WX5pzOaCv8Sf/SxQ7kA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lukas Wunner , Bjorn Helgaas , "Mario Limonciello (AMD)" , Sasha Levin Subject: [PATCH 6.1 007/982] PCI: Stop setting cached power state to unknown on unbind Date: Wed, 30 Sep 2026 17:12:23 +0200 Message-ID: <20260930152416.944224140@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152416.775402466@linuxfoundation.org> References: <20260930152416.775402466@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lukas Wunner [ Upstream commit d462c8e89e84bfb6417e6b4c88e0cb7cc747ba41 ] When a PCI device is unbound from its driver, pci_device_remove() sets the cached power state in pci_dev->current_state to PCI_UNKNOWN. This was introduced by commit 2449e06a5696 ("PCI: reset pci device state to unknown state for resume") to invalidate the cached power state in case the system is subsequently put to sleep. For bound devices, the cached power state is set to PCI_UNKNOWN in pci_pm_suspend_noirq(), immediately before entering system sleep. Extend to unbound devices for consistency. This obviates the need to change the cached power state on unbind, so stop doing so. Signed-off-by: Lukas Wunner Signed-off-by: Bjorn Helgaas Reviewed-by: Mario Limonciello (AMD) Link: https://patch.msgid.link/af7d11d3ceb231acc90829f7a5c8400c2446744f.1776415510.git.lukas@wunner.de Signed-off-by: Sasha Levin --- drivers/pci/pci-driver.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index fe6e5f716543a..fa3165e5b921b 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -490,13 +490,6 @@ static void pci_device_remove(struct device *dev) /* Undo the runtime PM settings in local_pci_probe() */ pm_runtime_put_sync(dev); - /* - * If the device is still on, set the power state as "unknown", - * since it might change by the next time we load the driver. - */ - if (pci_dev->current_state == PCI_D0) - pci_dev->current_state = PCI_UNKNOWN; - /* * We would love to complain here if pci_dev->is_enabled is set, that * the driver should have called pci_disable_device(), but the @@ -874,7 +867,7 @@ static int pci_pm_suspend_noirq(struct device *dev) if (!pm) { pci_save_state(pci_dev); - goto Fixup; + goto set_unknown; } if (pm->suspend_noirq) { @@ -926,6 +919,7 @@ static int pci_pm_suspend_noirq(struct device *dev) goto Fixup; } +set_unknown: pci_pm_set_unknown_state(pci_dev); /* -- 2.53.0