All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 Linux PCI <linux-pci@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	 Bjorn Helgaas <helgaas@kernel.org>,
	Hans de Goede <hansg@kernel.org>
Subject: Re: [PATCH v2 1/4] ACPI: PCI: Use a mutex guard to simplify acpi_get_pci_dev()
Date: Mon, 20 Jul 2026 13:21:22 +0300 (EEST)	[thread overview]
Message-ID: <ab954902-7449-b466-717b-ded704b720bb@linux.intel.com> (raw)
In-Reply-To: <3056272.e9J7NaK4W3@rafael.j.wysocki>

[-- Attachment #1: Type: text/plain, Size: 1735 bytes --]

On Thu, 16 Jul 2026, Rafael J. Wysocki wrote:

> 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>
> ---
> 
> v1 -> v2:
>    * Add cleanup.h include to pci_root.c (Andy)
> 
> ---
>  drivers/acpi/pci_root.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index 4c06c3ffd0cb..d0dafc38b0cf 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -8,6 +8,7 @@
>  
>  #define pr_fmt(fmt) "ACPI: " fmt
>  
> +#include <linux/cleanup.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/init.h>
> @@ -307,24 +308,20 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle handle)
>  {
>  	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);

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

  parent reply	other threads:[~2026-07-20 10:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 13:59 [PATCH v2 0/4] ACPI: Add and use acpi_dev_get_pci_dev() Rafael J. Wysocki
2026-07-16 14:04 ` [PATCH v2 1/4] ACPI: PCI: Use a mutex guard to simplify acpi_get_pci_dev() Rafael J. Wysocki
2026-07-16 14:08   ` sashiko-bot
2026-07-16 18:02   ` Andy Shevchenko
2026-07-20 10:21   ` Ilpo Järvinen [this message]
2026-07-16 14:04 ` [PATCH v2 2/4] ACPI: PCI: Introduce acpi_dev_get_pci_dev() Rafael J. Wysocki
2026-07-16 14:18   ` sashiko-bot
2026-07-16 16:40     ` Rafael J. Wysocki (Intel)
2026-07-16 18:36   ` Andy Shevchenko
2026-07-16 14:05 ` [PATCH v2 3/4] ACPI: video: Drop backlight parent device reference later Rafael J. Wysocki
2026-07-16 14:12   ` sashiko-bot
2026-07-16 14:05 ` [PATCH v2 4/4] ACPI: video: Use acpi_dev_get_pci_dev() instead of acpi_get_pci_dev() Rafael J. Wysocki
2026-07-16 14:28   ` sashiko-bot

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=ab954902-7449-b466-717b-ded704b720bb@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --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 \
    --cc=rafael@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.