public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
	len.brown@intel.com, andriy.shevchenko@linux.intel.com,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	mallikarjunappa.sangannavar@intel.com, bala.senthil@intel.com
Subject: Re: [PATCH v1] ACPI: LPSS: use acpi_dev_uid_match() for matching _UID
Date: Wed, 25 Oct 2023 21:21:12 +0300	[thread overview]
Message-ID: <ZTlcmA0VpE2jsbUQ@black.fi.intel.com> (raw)
In-Reply-To: <CAJZ5v0iYA3Qh=KQm_+XGm=jvLO=ZN-AyYx7DW=-EiqkE5LS19Q@mail.gmail.com>

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@linux.intel.com> 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@intel.com>
> >
> > Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> 
> 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@linux.intel.com>
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@linux.intel.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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.

Raag

  reply	other threads:[~2023-10-25 18:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25  5:38 [PATCH v1] ACPI: LPSS: use acpi_dev_uid_match() for matching _UID Raag Jadav
2023-10-25  5:53 ` Mika Westerberg
2023-10-25 18:04   ` Rafael J. Wysocki
2023-10-25 18:21     ` Raag Jadav [this message]
2023-10-25 18:33       ` Rafael J. Wysocki
2023-10-25 20:33 ` Andy Shevchenko
2023-10-26  3:00   ` Raag Jadav
2023-10-26 12:06     ` Andy Shevchenko

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=ZTlcmA0VpE2jsbUQ@black.fi.intel.com \
    --to=raag.jadav@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bala.senthil@intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mallikarjunappa.sangannavar@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox