]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: Use lockdep_assert_held(pci_bus_sem) to verify lock is held
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 16 Jan 2026 12:57:40 +0000 (14:57 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 6 Feb 2026 22:53:35 +0000 (16:53 -0600)
The function comment for pci_bus_max_d3cold_delay() declares pci_bus_sem
must be held while calling the function which can be automatically checked.
Add lockdep_assert_held(pci_bus_sem) to confirm pci_bus_sem is held.

Also mark the comment line with Context prefix.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20260116125742.1890-2-ilpo.jarvinen@linux.intel.com
drivers/pci/pci.c

index 57a5b205175f1e88928eb8b70de60fa179053326..edcc22dc95d39347e5240f88e2f1596f04c78e65 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/delay.h>
 #include <linux/dmi.h>
 #include <linux/init.h>
+#include <linux/lockdep.h>
 #include <linux/msi.h>
 #include <linux/of.h>
 #include <linux/pci.h>
@@ -4622,7 +4623,7 @@ bool pcie_wait_for_link(struct pci_dev *pdev, bool active)
  * spec says 100 ms, but firmware can lower it and we allow drivers to
  * increase it as well.
  *
- * Called with @pci_bus_sem locked for reading.
+ * Context: Called with @pci_bus_sem locked for reading.
  */
 static int pci_bus_max_d3cold_delay(const struct pci_bus *bus)
 {
@@ -4630,6 +4631,8 @@ static int pci_bus_max_d3cold_delay(const struct pci_bus *bus)
        int min_delay = 100;
        int max_delay = 0;
 
+       lockdep_assert_held(&pci_bus_sem);
+
        list_for_each_entry(pdev, &bus->devices, bus_list) {
                if (pdev->d3cold_delay < min_delay)
                        min_delay = pdev->d3cold_delay;