{"id":2224289,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2224289/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/af7d11d3ceb231acc90829f7a5c8400c2446744f.1776415510.git.lukas@wunner.de/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.2/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<af7d11d3ceb231acc90829f7a5c8400c2446744f.1776415510.git.lukas@wunner.de>","list_archive_url":null,"date":"2026-04-17T08:51:46","name":"PCI: Stop setting cached power state to \"unknown\" on unbind","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"45915fe5681136c04c428f1b05fda26dcdf2e4be","submitter":{"id":68499,"url":"http://patchwork.ozlabs.org/api/1.2/people/68499/?format=json","name":"Lukas Wunner","email":"lukas@wunner.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/af7d11d3ceb231acc90829f7a5c8400c2446744f.1776415510.git.lukas@wunner.de/mbox/","series":[{"id":500280,"url":"http://patchwork.ozlabs.org/api/1.2/series/500280/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=500280","date":"2026-04-17T08:51:46","name":"PCI: Stop setting cached power state to \"unknown\" on unbind","version":1,"mbox":"http://patchwork.ozlabs.org/series/500280/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224289/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224289/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-52704-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.232.135.74; helo=sto.lore.kernel.org;\n envelope-from=linux-pci+bounces-52704-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=144.76.133.104","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=wunner.de","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=wunner.de"],"Received":["from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fxpXX1G3mz1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 18:51:56 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 11069300C0CA\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 08:51:53 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 09E5E3B0AF8;\n\tFri, 17 Apr 2026 08:51:50 +0000 (UTC)","from mailout3.hostsharing.net (mailout3.hostsharing.net\n [144.76.133.104])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 0172030EF9A\n\tfor <linux-pci@vger.kernel.org>; Fri, 17 Apr 2026 08:51:46 +0000 (UTC)","from h08.hostsharing.net (h08.hostsharing.net\n [IPv6:2a01:37:1000::53df:5f1c:0])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384\n\t client-signature ECDSA (secp384r1) client-digest SHA384)\n\t(Client CN \"*.hostsharing.net\",\n Issuer \"GlobalSign GCC R6 AlphaSSL CA 2025\" (verified OK))\n\tby mailout3.hostsharing.net (Postfix) with ESMTPS id 53C4AC27;\n\tFri, 17 Apr 2026 10:51:45 +0200 (CEST)","by h08.hostsharing.net (Postfix, from userid 100393)\n\tid 388FE6015A92; Fri, 17 Apr 2026 10:51:45 +0200 (CEST)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776415909; cv=none;\n b=l6HVxyj3Z0aK8diJPY9+jG3gTdz3evHqiHcYB378EU6mQERg839Bpeu+aH/FGtnZjYzn1zgBeUHsYRO3Din7gqd1cwaV/h1SbRQ6btZXpudsAmJulDOOGN1UNDkatakQG7y17/7UEc2zbHuRTiGo/Jcz1q8uOoMCPQE9bzsp0/o=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776415909; c=relaxed/simple;\n\tbh=13QWmgexTjKgPWUs92J+iLyxUFTvlmZV6JzYUygNFuE=;\n\th=Message-Id:From:Date:Subject:To:Cc;\n b=bnJJNyS6w6WDfVc56Mt6C1YhBiCKoAfwn5t5OSyB87OUa9JzL8c0303VG4UcBNTvhU4MuDvH8mDADTgQI7UFZv5ZHrw6HVrXubjV4w12LuIj4ofcf8Ytq7vwT3shfgyGTjXbbSgMXqWJ1dEIiOmbu9qWEh3i0ssrW3SiECHOXxI=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=wunner.de;\n spf=pass smtp.mailfrom=wunner.de; arc=none smtp.client-ip=144.76.133.104","Message-Id":"\n <af7d11d3ceb231acc90829f7a5c8400c2446744f.1776415510.git.lukas@wunner.de>","From":"Lukas Wunner <lukas@wunner.de>","Date":"Fri, 17 Apr 2026 10:51:46 +0200","Subject":"[PATCH] PCI: Stop setting cached power state to \"unknown\" on unbind","To":"Bjorn Helgaas <helgaas@kernel.org>,\n \"Rafael J. Wysocki\" <rafael@kernel.org>","Cc":"Mario Limonciello <mario.limonciello@amd.com>,\n Alex Williamson <alex@shazbot.org>, linux-pci@vger.kernel.org","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>"},"content":"When a PCI device is unbound from its driver, pci_device_remove() sets the\ncached power state in pci_dev->current_state to PCI_UNKNOWN.  This was\nintroduced by commit 2449e06a5696 (\"PCI: reset pci device state to unknown\nstate for resume\") to invalidate the cached power state in case the system\nis subsequently put to sleep.\n\nFor bound devices, the cached power state is set to PCI_UNKNOWN in\npci_pm_suspend_noirq(), immediately before entering system sleep.\n\nExtend to unbound devices for consistency.\n\nThis obviates the need to change the cached power state on unbind, so stop\ndoing so.\n\nSigned-off-by: Lukas Wunner <lukas@wunner.de>\n---\n drivers/pci/pci-driver.c | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)","diff":"diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c\nindex 7c2d9d5..774892d 100644\n--- a/drivers/pci/pci-driver.c\n+++ b/drivers/pci/pci-driver.c\n@@ -482,13 +482,6 @@ static void pci_device_remove(struct device *dev)\n \tpm_runtime_put_sync(dev);\n \n \t/*\n-\t * If the device is still on, set the power state as \"unknown\",\n-\t * since it might change by the next time we load the driver.\n-\t */\n-\tif (pci_dev->current_state == PCI_D0)\n-\t\tpci_dev->current_state = PCI_UNKNOWN;\n-\n-\t/*\n \t * We would love to complain here if pci_dev->is_enabled is set, that\n \t * the driver should have called pci_disable_device(), but the\n \t * unfortunate fact is there are too many odd BIOS and bridge setups\n@@ -862,7 +855,7 @@ static int pci_pm_suspend_noirq(struct device *dev)\n \n \tif (!pm) {\n \t\tpci_save_state(pci_dev);\n-\t\tgoto Fixup;\n+\t\tgoto set_unknown;\n \t}\n \n \tif (pm->suspend_noirq) {\n@@ -914,6 +907,7 @@ static int pci_pm_suspend_noirq(struct device *dev)\n \t\tgoto Fixup;\n \t}\n \n+set_unknown:\n \tpci_pm_set_unknown_state(pci_dev);\n \n \t/*\n","prefixes":[]}