Skip to content

Commit 8ff5aaa

Browse files
committed
PCI/sysfs: Use runtime PM guard macro for auto-cleanup
Use the newly introduced pm_runtime_active_try guard to simplify the code and add the proper error handling for PM runtime resume errors. Based on an earlier patch from Takashi Iwai <tiwai@suse.de> [1]. Link: https://patch.msgid.link/20250919163147.4743-3-tiwai@suse.de [1] Acked-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
1 parent 9a0abc3 commit 8ff5aaa

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/pci/pci-sysfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,8 +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;
1478+
ACQUIRE(pm_runtime_active_try, pm)(dev);
1479+
if (ACQUIRE_ERR(pm_runtime_active_try, &pm))
1480+
return -ENXIO;
14801481

14811482
if (sysfs_streq(buf, "default")) {
14821483
pci_init_reset_methods(pdev);

0 commit comments

Comments
 (0)