lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2323750.iZASKD2KPV@rafael.j.wysocki>
Date: Fri, 26 Sep 2025 18:24:05 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Linux PM <linux-pm@...r.kernel.org>,
 Jonathan Cameron <jonathan.cameron@...wei.com>,
 Bjorn Helgaas <helgaas@...nel.org>
Cc: Takashi Iwai <tiwai@...e.de>, LKML <linux-kernel@...r.kernel.org>,
 Linux PCI <linux-pci@...r.kernel.org>,
 Alex Williamson <alex.williamson@...hat.com>,
 Zhang Qilong <zhangqilong3@...wei.com>, Ulf Hansson <ulf.hansson@...aro.org>,
 Frank Li <Frank.Li@....com>, Dhruva Gole <d-gole@...com>
Subject: [PATCH v4 2/3] PCI/sysfs: Use runtime PM guard macro for auto-cleanup

From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

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@...e.de> [1].

Link: https://patch.msgid.link/20250919163147.4743-3-tiwai@suse.de [1]
Acked-by: Bjorn Helgaas <bhelgaas@...gle.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---

v3 -> v4:
   * Use ACQUIRE()/ACQUIRE_ERR() (Jonathan)
   * Adjust subject and changelog
   * Take patch ownership (it's all different now)
   * Pick up Bjorn's ACK from v3 (Bjorn, please let me know if that's not OK)

v2 -> v3: No changes

v1 -> v2:
   * Adjust the name of the class to handle the disabled runtime PM case
     transparently (like the original code).

---
 drivers/pci/pci-sysfs.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1475,8 +1475,9 @@ static ssize_t reset_method_store(struct
 		return count;
 	}
 
-	pm_runtime_get_sync(dev);
-	struct device *pmdev __free(pm_runtime_put) = dev;
+	ACQUIRE(pm_runtime_active_try, pm)(dev);
+	if (ACQUIRE_ERR(pm_runtime_active_try, &pm))
+		return -ENXIO;
 
 	if (sysfs_streq(buf, "default")) {
 		pci_init_reset_methods(pdev);




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ