From: Punit Agrawal <punit.agrawal@bytedance.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v1 2/5] ACPI: scan: Rename acpi_bus_get_parent() and rearrange it
Date: Fri, 12 Aug 2022 14:08:31 +0100 [thread overview]
Message-ID: <87edxlk3sg.fsf@stealth> (raw)
In-Reply-To: <2252770.ElGaqSPkdT@kreacher> (Rafael J. Wysocki's message of "Wed, 10 Aug 2022 18:15:24 +0200")
"Rafael J. Wysocki" <rjw@rjwysocki.net> writes:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> The acpi_bus_get_parent() name doesn't really reflect the
> purpose of the function so change it to a more accurate
> acpi_find_parent_acpi_dev().
>
> While at it, rearrange the code inside that function the make it
Typo: to
> easier to read.
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/acpi/scan.c | 24 ++++++++++++++----------
> 1 file changed, 14 insertions(+), 10 deletions(-)
>
> Index: linux-pm/drivers/acpi/scan.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/scan.c
> +++ linux-pm/drivers/acpi/scan.c
> @@ -816,10 +816,9 @@ static const char * const acpi_honor_dep
> NULL
> };
>
> -static struct acpi_device *acpi_bus_get_parent(acpi_handle handle)
> +static struct acpi_device *acpi_find_parent_acpi_dev(acpi_handle handle)
> {
> - struct acpi_device *device;
> - acpi_status status;
> + struct acpi_device *adev;
>
> /*
> * Fixed hardware devices do not appear in the namespace and do not
> @@ -830,13 +829,18 @@ static struct acpi_device *acpi_bus_get_
> return acpi_root;
>
> do {
> - status = acpi_get_parent(handle, &handle);
> - if (ACPI_FAILURE(status))
> - return status == AE_NULL_ENTRY ? NULL : acpi_root;
> + acpi_status status;
>
> - device = acpi_fetch_acpi_dev(handle);
> - } while (!device);
> - return device;
> + status = acpi_get_parent(handle, &handle);
> + if (ACPI_FAILURE(status)) {
> + if (status != AE_NULL_ENTRY)
> + return acpi_root;
> +
> + return NULL;
> + }
> + adev = acpi_fetch_acpi_dev(handle);
> + } while (!adev);
> + return adev;
> }
>
> acpi_status
> @@ -1777,7 +1781,7 @@ void acpi_init_device_object(struct acpi
> INIT_LIST_HEAD(&device->pnp.ids);
> device->device_type = type;
> device->handle = handle;
> - device->parent = acpi_bus_get_parent(handle);
> + device->parent = acpi_find_parent_acpi_dev(handle);
> fwnode_init(&device->fwnode, &acpi_device_fwnode_ops);
> acpi_set_device_status(device, ACPI_STA_DEFAULT);
> acpi_device_get_busid(device);
next prev parent reply other threads:[~2022-08-12 13:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-10 16:11 [PATCH v1 0/5] ACPI: Device enumeration rearrangements and parent field elimination Rafael J. Wysocki
2022-08-10 16:14 ` [PATCH v1 1/5] ACPI: Rename acpi_bus_get/put_acpi_device() Rafael J. Wysocki
2022-08-10 16:30 ` Guenter Roeck
2022-08-10 16:15 ` [PATCH v1 2/5] ACPI: scan: Rename acpi_bus_get_parent() and rearrange it Rafael J. Wysocki
2022-08-12 13:08 ` Punit Agrawal [this message]
2022-08-10 16:16 ` [PATCH v1 3/5] ACPI: scan: Rearrange initialization of ACPI device objects Rafael J. Wysocki
2022-08-10 16:17 ` [PATCH v1 4/5] ACPI: scan: Eliminate __acpi_device_add() Rafael J. Wysocki
2022-08-10 16:23 ` [PATCH v1 5/5][RFT] ACPI: Drop parent field from struct acpi_device Rafael J. Wysocki
2022-08-10 16:33 ` Mark Brown
2022-08-10 17:10 ` Mika Westerberg
2022-08-12 15:14 ` Wei Liu
2022-08-24 16:59 ` [PATCH v2 5/5] " Rafael J. Wysocki
2022-08-24 18:23 ` Andy Shevchenko
2022-08-24 18:34 ` Rafael J. Wysocki
2022-08-27 13:19 ` Hanjun Guo
2022-08-29 15:54 ` Rafael J. Wysocki
2022-08-30 21:29 ` Michael Kelley (LINUX)
2022-08-12 13:11 ` [PATCH v1 0/5] ACPI: Device enumeration rearrangements and parent field elimination Punit Agrawal
2022-08-23 16:25 ` Rafael J. Wysocki
2022-08-29 15:21 ` [PATCH v1] ACPI: PM: Fix NULL argument handling in acpi_device_get/set_power() Rafael J. Wysocki
2022-08-29 15:53 ` [PATCH v1] ACPI: Drop redundant acpi_dev_parent() header Rafael J. Wysocki
2022-08-30 2:17 ` Hanjun Guo
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=87edxlk3sg.fsf@stealth \
--to=punit.agrawal@bytedance.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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;
as well as URLs for NNTP newsgroup(s).