Re: [PATCH v1] ACPI: LPSS: use acpi_dev_uid_match() for matching _UID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 25, 2023 at 8:21 PM Raag Jadav <raag.jadav@xxxxxxxxx> wrote:
>
> On Wed, Oct 25, 2023 at 08:04:44PM +0200, Rafael J. Wysocki wrote:
> > On Wed, Oct 25, 2023 at 7:53 AM Mika Westerberg
> > <mika.westerberg@xxxxxxxxxxxxxxx> wrote:
> > >
> > > On Wed, Oct 25, 2023 at 11:08:33AM +0530, Raag Jadav wrote:
> > > > Use acpi_dev_uid_match() for matching _UID instead of treating it
> > > > as an integer.
> > > >
> > > > Signed-off-by: Raag Jadav <raag.jadav@xxxxxxxxx>
> > >
> > > Acked-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> >
> > I was about to apply this, but then I realized that it might change
> > the behavior in a subtle way, because what if the _UID string is
> > something like "01"?
>
> I checked the git history and found below.
>
> commit 2a036e489eb1571810126d6fa47bd8af1e237c08
> Author: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Date:   Tue Sep 13 19:31:41 2022 +0300
>
>     ACPI: LPSS: Refactor _UID handling to use acpi_dev_uid_to_integer()
>
>     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@xxxxxxxxxxxxxxx>
>     Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx>
>     Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>
> diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
> index c4d4d21391d7..4d415e210c32 100644
> --- a/drivers/acpi/acpi_lpss.c
> +++ b/drivers/acpi/acpi_lpss.c
> @@ -167,10 +167,10 @@ static struct pwm_lookup byt_pwm_lookup[] = {
>
>  static void byt_pwm_setup(struct lpss_private_data *pdata)
>  {
> -       struct acpi_device *adev = pdata->adev;
> +       u64 uid;
>
>         /* Only call pwm_add_table for the first PWM controller */
> -       if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
> +       if (acpi_dev_uid_to_integer(pdata->adev, &uid) || uid != 1)
>                 return;
>
>         pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup));
>
> So if we consider the original logic with strcmp, which is more inline
> with acpi_dev_uid_match(), "01" should not be the case here in my opinion.
>
> Thanks for sharing your concern though.

Well, this means that what the patch really does is to effectively
revert commit 2a036e489eb1571810126d6fa47bd8af1e237c08 and use the new
helper instead of the open-coded check that was there before, so all
of this information should be present in the changelog.





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux