[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <767b4c6c-c860-b490-4e85-34c6677de456@redhat.com>
Date: Thu, 8 Sep 2022 15:42:17 +0200
From: Hans de Goede <hdegoede@...hat.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Ard Biesheuvel <ardb@...nel.org>,
Mark Brown <broonie@...nel.org>, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-efi@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-spi@...r.kernel.org,
devel@...ica.org
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, Elie Morisse <syniurge@...il.com>,
Nehal Shah <nehal-bakulchandra.shah@....com>,
Shyam Sundar S K <shyam-sundar.s-k@....com>,
Khalil Blaiech <kblaiech@...dia.com>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...ainline.org>,
Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Daniel Mack <daniel@...que.org>,
Haojian Zhuang <haojian.zhuang@...il.com>,
Robert Jarzmik <robert.jarzmik@...e.fr>,
Robert Moore <robert.moore@...el.com>,
Wolfram Sang <wsa@...nel.org>
Subject: Re: [PATCH v2 8/8] efi/dev-path-parser: Refactor _UID handling to use
acpi_dev_uid_to_integer()
Hi,
On 9/8/22 15:29, Andy Shevchenko wrote:
> ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
> an integer. Use it instead of custom approach.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Reviewed-by: Ard Biesheuvel <ardb@...nel.org>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@...hat.com>
Regards,
Hans
> ---
> drivers/firmware/efi/dev-path-parser.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/firmware/efi/dev-path-parser.c b/drivers/firmware/efi/dev-path-parser.c
> index eb9c65f97841..f80d87c199c3 100644
> --- a/drivers/firmware/efi/dev-path-parser.c
> +++ b/drivers/firmware/efi/dev-path-parser.c
> @@ -15,9 +15,11 @@
> static long __init parse_acpi_path(const struct efi_dev_path *node,
> struct device *parent, struct device **child)
> {
> - char hid[ACPI_ID_LEN], uid[11]; /* UINT_MAX + null byte */
> struct acpi_device *adev;
> struct device *phys_dev;
> + char hid[ACPI_ID_LEN];
> + u64 uid;
> + int ret;
>
> if (node->header.length != 12)
> return -EINVAL;
> @@ -27,12 +29,12 @@ static long __init parse_acpi_path(const struct efi_dev_path *node,
> 'A' + ((node->acpi.hid >> 5) & 0x1f) - 1,
> 'A' + ((node->acpi.hid >> 0) & 0x1f) - 1,
> node->acpi.hid >> 16);
> - sprintf(uid, "%u", node->acpi.uid);
>
> for_each_acpi_dev_match(adev, hid, NULL, -1) {
> - if (adev->pnp.unique_id && !strcmp(adev->pnp.unique_id, uid))
> + ret = acpi_dev_uid_to_integer(adev, &uid);
> + if (ret == 0 && node->acpi.uid == uid)
> break;
> - if (!adev->pnp.unique_id && node->acpi.uid == 0)
> + if (ret == -ENODATA && node->acpi.uid == 0)
> break;
> }
> if (!adev)
Powered by blists - more mailing lists