diff options
| author | Alex Williamson <alex.williamson@redhat.com> | 2025-04-22 17:05:32 -0600 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2025-04-23 16:06:45 -0500 |
| commit | 0a0829b1fd76cb6110cc049a60e634a51969e488 (patch) | |
| tree | 56aca90f89c05a1f9d4677972152f2475f6bcdb0 /drivers/pci/pci-sysfs.c | |
| parent | PM: runtime: Define pm_runtime_put cleanup helper (diff) | |
| download | linux-0a0829b1fd76cb6110cc049a60e634a51969e488.tar.gz linux-0a0829b1fd76cb6110cc049a60e634a51969e488.zip | |
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 <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250422230534.2295291-3-alex.williamson@redhat.com
Diffstat (limited to 'drivers/pci/pci-sysfs.c')
| -rw-r--r-- | drivers/pci/pci-sysfs.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index c6cda56ca52c..71a36f57ef57 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1475,6 +1475,9 @@ static ssize_t reset_method_store(struct device *dev, return count; } + pm_runtime_get_sync(dev); + struct device *pmdev __free(pm_runtime_put) = dev; + if (sysfs_streq(buf, "default")) { pci_init_reset_methods(pdev); return count; |
