Skip to content

Commit 0a0829b

Browse files
awilliambjorn-helgaas
authored andcommitted
PCI: Increment PM usage counter when probing reset methods
We can get different results probing reset methods for a device depending on its power state. For example, reading the PM control register of a device in D3cold will always indicate NoSoftRst+ because we get ~0 data when the config read fails on PCI, preventing us from correctly probing PM reset support. Increment the PM usage counter before any probes and use the cleanup __free facility to automatically drop the usage counter out of scope. Signed-off-by: Alex Williamson <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent bfa4477 commit 0a0829b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/pci/pci-sysfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,9 @@ static ssize_t reset_method_store(struct device *dev,
14751475
return count;
14761476
}
14771477

1478+
pm_runtime_get_sync(dev);
1479+
struct device *pmdev __free(pm_runtime_put) = dev;
1480+
14781481
if (sysfs_streq(buf, "default")) {
14791482
pci_init_reset_methods(pdev);
14801483
return count;

0 commit comments

Comments
 (0)