linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>,
	iommu@lists.linux-foundation.org,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH v2 3/6] ACPI / utils: Introduce acpi_dev_hid_uid_match() helper
Date: Tue, 1 Oct 2019 12:38:54 +0300	[thread overview]
Message-ID: <20191001093854.GH2714@lahna.fi.intel.com> (raw)
In-Reply-To: <20190924193739.86133-4-andriy.shevchenko@linux.intel.com>

On Tue, Sep 24, 2019 at 10:37:36PM +0300, Andy Shevchenko wrote:
> There are users outside of ACPI realm which reimplementing the comparator
> function to check if the given device matches to given HID and UID.
> 
> For better utilization, introduce a helper for everyone to use.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> ---
>  drivers/acpi/utils.c    | 25 +++++++++++++++++++++++++
>  include/acpi/acpi_bus.h |  2 ++
>  include/linux/acpi.h    |  6 ++++++
>  3 files changed, 33 insertions(+)
> 
> diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
> index dbd1c4cfd7d1..804ac0df58ec 100644
> --- a/drivers/acpi/utils.c
> +++ b/drivers/acpi/utils.c
> @@ -701,6 +701,31 @@ bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs)
>  }
>  EXPORT_SYMBOL(acpi_check_dsm);
>  
> +/**
> + * acpi_dev_hid_uid_match - Match device by supplied HID and UID
> + * @adev: ACPI device to match.
> + * @hid2: Hardware ID of the device.
> + * @uid2: Unique ID of the device, pass NULL to not check _UID.
> + *
> + * Matches HID and UID in @adev with given @hid2 and @uid2.
> + * Returns true if matches.
> + */
> +bool acpi_dev_hid_uid_match(struct acpi_device *adev,
> +			    const char *hid2, const char *uid2)
> +{
> +	const char *hid1 = acpi_device_hid(adev);
> +	const char *uid1 = acpi_device_uid(adev);
> +
> +	if (strcmp(hid1, hid2))
> +		return false;
> +
> +	if (!uid2)
> +		return true;
> +
> +	return uid1 && !strcmp(uid1, uid2);
> +}
> +EXPORT_SYMBOL(acpi_dev_hid_uid_match);

Should this be _GPL?

In any case looks good,

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

  reply	other threads:[~2019-10-01  9:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 19:37 [PATCH v2 0/6] ACPI / utils: add new helper for HID/UID match Andy Shevchenko
2019-09-24 19:37 ` [PATCH v2 1/6] ACPI / utils: Describe function parameters in kernel-doc Andy Shevchenko
2019-10-01  9:32   ` Mika Westerberg
2019-09-24 19:37 ` [PATCH v2 2/6] ACPI / utils: Move acpi_dev_get_first_match_dev() under CONFIG_ACPI Andy Shevchenko
2019-10-01  9:32   ` Mika Westerberg
2019-09-24 19:37 ` [PATCH v2 3/6] ACPI / utils: Introduce acpi_dev_hid_uid_match() helper Andy Shevchenko
2019-10-01  9:38   ` Mika Westerberg [this message]
2019-10-01  9:59     ` Andy Shevchenko
2019-09-24 19:37 ` [PATCH v2 4/6] ACPI / LPSS: Switch to use acpi_dev_hid_uid_match() Andy Shevchenko
2019-10-01  9:40   ` Mika Westerberg
2019-09-24 19:37 ` [PATCH v2 5/6] mmc: sdhci-acpi: " Andy Shevchenko
2019-10-01  9:40   ` Mika Westerberg
2019-10-01 12:37   ` Adrian Hunter
2019-10-01 13:04     ` Andy Shevchenko
2019-09-24 19:37 ` [PATCH v2 6/6] iommu/amd: " Andy Shevchenko
2019-10-01  9:41   ` Mika Westerberg
2019-10-07 15:28   ` Joerg Roedel
2019-10-08 13:54     ` Andy Shevchenko
2019-10-07 18:24   ` Jerry Snitselaar

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=20191001093854.GH2714@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=adrian.hunter@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=ulf.hansson@linaro.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;
as well as URLs for NNTP newsgroup(s).