All of lore.kernel.org
 help / color / mirror / Atom feed
From: Naveen M <naveen.m@intel.com>
To: alsa-devel@alsa-project.org
Cc: vinod.koul@intel.com, liam.r.girdwood@linux.intel.com,
	Harsha Priya <harshapriya.n@intel.com>,
	broonie@kernel.org, naveen.m@intel.com,
	pierre-louis.bossart@intel.com
Subject: [PATCH 1/6] ASoC: Intel: Create a helper to search for matching machine
Date: Mon,  8 May 2017 14:48:55 +0530	[thread overview]
Message-ID: <1494235140-29369-2-git-send-email-naveen.m@intel.com> (raw)
In-Reply-To: <1494235140-29369-1-git-send-email-naveen.m@intel.com>

Create a helper function to search for a matching machine
based on HID. No functional change

Signed-off-by: Naveen M <naveen.m@intel.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
---
 sound/soc/intel/common/sst-acpi.h       |  3 +++
 sound/soc/intel/common/sst-match-acpi.c | 19 +++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/common/sst-acpi.h b/sound/soc/intel/common/sst-acpi.h
index 214e000..3649d3b 100644
--- a/sound/soc/intel/common/sst-acpi.h
+++ b/sound/soc/intel/common/sst-acpi.h
@@ -43,6 +43,9 @@ static inline bool sst_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
 /* acpi match */
 struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines);
 
+/* acpi check hid */
+bool sst_acpi_check_hid(const u8 hid[ACPI_ID_LEN]);
+
 /* Descriptor for SST ASoC machine driver */
 struct sst_acpi_mach {
 	/* ACPI ID for the matching machine driver. Audio codec for instance */
diff --git a/sound/soc/intel/common/sst-match-acpi.c b/sound/soc/intel/common/sst-match-acpi.c
index 1070f3a..f4af3d1 100644
--- a/sound/soc/intel/common/sst-match-acpi.c
+++ b/sound/soc/intel/common/sst-match-acpi.c
@@ -63,15 +63,26 @@ static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
 	return AE_OK;
 }
 
+bool sst_acpi_check_hid(const u8 hid[ACPI_ID_LEN])
+{
+	acpi_status status;
+	bool found = false;
+
+	status = acpi_get_devices(hid, sst_acpi_mach_match, &found, NULL);
+
+	if (ACPI_FAILURE(status))
+		return false;
+
+	return found;
+}
+EXPORT_SYMBOL_GPL(sst_acpi_check_hid);
+
 struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
 {
 	struct sst_acpi_mach *mach;
-	bool found = false;
 
 	for (mach = machines; mach->id[0]; mach++)
-		if (ACPI_SUCCESS(acpi_get_devices(mach->id,
-						  sst_acpi_mach_match,
-						  &found, NULL)) && found)
+		if (sst_acpi_check_hid(mach->id) == true)
 			return mach;
 	return NULL;
 }
-- 
1.9.1

  reply	other threads:[~2017-05-08  9:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08  9:18 [PATCH 0/6] ASoC: Intel: kabylake: Adds rt5663+max98927 machine driver Naveen M
2017-05-08  9:18 ` Naveen M [this message]
2017-05-24 17:41   ` Applied "ASoC: Intel: Create a helper to search for matching machine" to the asoc tree Mark Brown
2017-05-08  9:18 ` [PATCH 2/6] ASoC: Move quirk to identify correct machine driver Naveen M
2017-05-24 17:41   ` Applied "ASoC: Move quirk to identify correct machine driver" to the asoc tree Mark Brown
2017-05-08  9:18 ` [PATCH 3/6] ASoC: Add quirk data to support multiple codecs Naveen M
2017-05-09  6:17   ` Takashi Iwai
2017-05-09 10:26     ` Vinod Koul
2017-05-08  9:18 ` [PATCH 4/6] ASoC: Improve machine driver selection based on quirk data Naveen M
2017-05-08  9:18 ` [PATCH 5/6] ASoC: Intel: Add Kabylake Realtek Maxim machine driver Naveen M
2017-05-24 17:41   ` Applied "ASoC: Intel: Add Kabylake Realtek Maxim machine driver" to the asoc tree Mark Brown
2017-05-08  9:19 ` [PATCH 6/6] ASoC: Intel: Add Kabylake RT5663+MAX98927 machine driver entry Naveen M

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=1494235140-29369-2-git-send-email-naveen.m@intel.com \
    --to=naveen.m@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=harshapriya.n@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=pierre-louis.bossart@intel.com \
    --cc=vinod.koul@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.