From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: Linux PCI <linux-pci@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Bjorn Helgaas <helgaas@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Hans de Goede <hansg@kernel.org>
Subject: [PATCH v1 1/4] ACPI: PCI: Use a mutex guard to simplify acpi_get_pci_dev()
Date: Wed, 15 Jul 2026 17:15:02 +0200 [thread overview]
Message-ID: <2417350.ElGaqSPkdT@rafael.j.wysocki> (raw)
In-Reply-To: <5115219.31r3eYUQgx@rafael.j.wysocki>
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Use a mutex guard in acpi_get_pci_dev() for the physical_node_lock
locking and drop local variable pci_dev that becomes redundant after
that change.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/pci_root.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -307,24 +307,20 @@ struct pci_dev *acpi_get_pci_dev(acpi_ha
{
struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
struct acpi_device_physical_node *pn;
- struct pci_dev *pci_dev = NULL;
if (!adev)
return NULL;
- mutex_lock(&adev->physical_node_lock);
+ guard(mutex)(&adev->physical_node_lock);
list_for_each_entry(pn, &adev->physical_node_list, node) {
if (dev_is_pci(pn->dev)) {
get_device(pn->dev);
- pci_dev = to_pci_dev(pn->dev);
- break;
+ return to_pci_dev(pn->dev);
}
}
- mutex_unlock(&adev->physical_node_lock);
-
- return pci_dev;
+ return NULL;
}
EXPORT_SYMBOL_GPL(acpi_get_pci_dev);
next prev parent reply other threads:[~2026-07-15 15:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 15:13 [PATCH v1 0/4] ACPI: Add and use acpi_dev_get_pci_dev() Rafael J. Wysocki
2026-07-15 15:15 ` Rafael J. Wysocki [this message]
2026-07-15 15:52 ` [PATCH v1 1/4] ACPI: PCI: Use a mutex guard to simplify acpi_get_pci_dev() Andy Shevchenko
2026-07-15 15:16 ` [PATCH v1 2/4] ACPI: PCI: Introduce acpi_dev_get_pci_dev() Rafael J. Wysocki
2026-07-15 15:56 ` Andy Shevchenko
2026-07-15 16:33 ` Rafael J. Wysocki (Intel)
2026-07-15 15:19 ` [PATCH v1 3/4] ACPI: video: Drop backlight parent device reference later Rafael J. Wysocki
2026-07-15 15:57 ` Andy Shevchenko
2026-07-15 15:21 ` [PATCH v1 4/4] ACPI: video: Use acpi_dev_get_pci_dev() instead of acpi_get_pci_dev() Rafael J. Wysocki
2026-07-15 15:59 ` Andy Shevchenko
2026-07-15 16:34 ` Rafael J. Wysocki (Intel)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2417350.ElGaqSPkdT@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hansg@kernel.org \
--cc=helgaas@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox