All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
@ 2017-11-10 18:36 ` Jeremy Cline
  0 siblings, 0 replies; 8+ messages in thread
From: Jeremy Cline @ 2017-11-10 18:36 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: Jaroslav Kysela, Takashi Iwai, Hans de Goede, alsa-devel,
	linux-kernel, Jeremy Cline

Replace snd_soc_acpi_check_hid() with the generic acpi_dev_present()
and remove the now unused snd_soc_acpi_check_hid function. This should
have no functional change.

Signed-off-by: Jeremy Cline <jeremy@jcline.org>
---
Changes in v3:
  - Remove the unnecessary "== true" and "!= true"

 include/sound/soc-acpi.h |  3 ---
 sound/soc/soc-acpi.c     | 32 ++------------------------------
 2 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h
index a7d8d335b043..057805489af3 100644
--- a/include/sound/soc-acpi.h
+++ b/include/sound/soc-acpi.h
@@ -49,9 +49,6 @@ snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
 struct snd_soc_acpi_mach *
 snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines);
 
-/* acpi check hid */
-bool snd_soc_acpi_check_hid(const u8 hid[ACPI_ID_LEN]);
-
 /**
  * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are
  * related to the hardware, except for the firmware and topology file names.
diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c
index f21df28bc28e..3543a7749490 100644
--- a/sound/soc/soc-acpi.c
+++ b/sound/soc/soc-acpi.c
@@ -49,41 +49,13 @@ const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
 }
 EXPORT_SYMBOL_GPL(snd_soc_acpi_find_name_from_hid);
 
-static acpi_status snd_soc_acpi_mach_match(acpi_handle handle, u32 level,
-				       void *context, void **ret)
-{
-	unsigned long long sta;
-	acpi_status status;
-
-	*(bool *)context = true;
-	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
-	if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
-		*(bool *)context = false;
-
-	return AE_OK;
-}
-
-bool snd_soc_acpi_check_hid(const u8 hid[ACPI_ID_LEN])
-{
-	acpi_status status;
-	bool found = false;
-
-	status = acpi_get_devices(hid, snd_soc_acpi_mach_match, &found, NULL);
-
-	if (ACPI_FAILURE(status))
-		return false;
-
-	return found;
-}
-EXPORT_SYMBOL_GPL(snd_soc_acpi_check_hid);
-
 struct snd_soc_acpi_mach *
 snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)
 {
 	struct snd_soc_acpi_mach *mach;
 
 	for (mach = machines; mach->id[0]; mach++) {
-		if (snd_soc_acpi_check_hid(mach->id) == true) {
+		if (acpi_dev_present(mach->id, NULL, -1)) {
 			if (mach->machine_quirk == NULL)
 				return mach;
 
@@ -163,7 +135,7 @@ struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg)
 		return mach;
 
 	for (i = 0; i < codec_list->num_codecs; i++) {
-		if (snd_soc_acpi_check_hid(codec_list->codecs[i]) != true)
+		if (!acpi_dev_present(codec_list->codecs[i], NULL, -1))
 			return NULL;
 	}
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3] ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
@ 2017-11-10 18:36 ` Jeremy Cline
  0 siblings, 0 replies; 8+ messages in thread
From: Jeremy Cline @ 2017-11-10 18:36 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: alsa-devel, Takashi Iwai, linux-kernel, Jeremy Cline, Hans de Goede

Replace snd_soc_acpi_check_hid() with the generic acpi_dev_present()
and remove the now unused snd_soc_acpi_check_hid function. This should
have no functional change.

Signed-off-by: Jeremy Cline <jeremy@jcline.org>
---
Changes in v3:
  - Remove the unnecessary "== true" and "!= true"

 include/sound/soc-acpi.h |  3 ---
 sound/soc/soc-acpi.c     | 32 ++------------------------------
 2 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h
index a7d8d335b043..057805489af3 100644
--- a/include/sound/soc-acpi.h
+++ b/include/sound/soc-acpi.h
@@ -49,9 +49,6 @@ snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
 struct snd_soc_acpi_mach *
 snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines);
 
-/* acpi check hid */
-bool snd_soc_acpi_check_hid(const u8 hid[ACPI_ID_LEN]);
-
 /**
  * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are
  * related to the hardware, except for the firmware and topology file names.
diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c
index f21df28bc28e..3543a7749490 100644
--- a/sound/soc/soc-acpi.c
+++ b/sound/soc/soc-acpi.c
@@ -49,41 +49,13 @@ const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
 }
 EXPORT_SYMBOL_GPL(snd_soc_acpi_find_name_from_hid);
 
-static acpi_status snd_soc_acpi_mach_match(acpi_handle handle, u32 level,
-				       void *context, void **ret)
-{
-	unsigned long long sta;
-	acpi_status status;
-
-	*(bool *)context = true;
-	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
-	if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
-		*(bool *)context = false;
-
-	return AE_OK;
-}
-
-bool snd_soc_acpi_check_hid(const u8 hid[ACPI_ID_LEN])
-{
-	acpi_status status;
-	bool found = false;
-
-	status = acpi_get_devices(hid, snd_soc_acpi_mach_match, &found, NULL);
-
-	if (ACPI_FAILURE(status))
-		return false;
-
-	return found;
-}
-EXPORT_SYMBOL_GPL(snd_soc_acpi_check_hid);
-
 struct snd_soc_acpi_mach *
 snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)
 {
 	struct snd_soc_acpi_mach *mach;
 
 	for (mach = machines; mach->id[0]; mach++) {
-		if (snd_soc_acpi_check_hid(mach->id) == true) {
+		if (acpi_dev_present(mach->id, NULL, -1)) {
 			if (mach->machine_quirk == NULL)
 				return mach;
 
@@ -163,7 +135,7 @@ struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg)
 		return mach;
 
 	for (i = 0; i < codec_list->num_codecs; i++) {
-		if (snd_soc_acpi_check_hid(codec_list->codecs[i]) != true)
+		if (!acpi_dev_present(codec_list->codecs[i], NULL, -1))
 			return NULL;
 	}
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [alsa-devel] [PATCH v3] ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
  2017-11-10 18:36 ` Jeremy Cline
  (?)
@ 2017-11-13 19:43 ` Pierre-Louis Bossart
  2017-11-14 19:12     ` Jeremy Cline
  -1 siblings, 1 reply; 8+ messages in thread
From: Pierre-Louis Bossart @ 2017-11-13 19:43 UTC (permalink / raw)
  To: Jeremy Cline, Liam Girdwood, Mark Brown
  Cc: alsa-devel, Takashi Iwai, linux-kernel, Hans de Goede



On 11/10/2017 12:36 PM, Jeremy Cline wrote:
> Replace snd_soc_acpi_check_hid() with the generic acpi_dev_present()
> and remove the now unused snd_soc_acpi_check_hid function. This should
> have no functional change.

The code looks ok, but I'd like to first add the fix for the quirk 
handling regression which appeared in 4.13 and is still there in 4.14. 
Current fix is at https://bugzilla.kernel.org/attachment.cgi?id=258581

Can we wait a couple of days on this one to avoid mixing bug fixes and 
renames? this would also make the stable branch fix easier to handle.

>
> Signed-off-by: Jeremy Cline <jeremy@jcline.org>
> ---
> Changes in v3:
>    - Remove the unnecessary "== true" and "!= true"
>
>   include/sound/soc-acpi.h |  3 ---
>   sound/soc/soc-acpi.c     | 32 ++------------------------------
>   2 files changed, 2 insertions(+), 33 deletions(-)
>
> diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h
> index a7d8d335b043..057805489af3 100644
> --- a/include/sound/soc-acpi.h
> +++ b/include/sound/soc-acpi.h
> @@ -49,9 +49,6 @@ snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
>   struct snd_soc_acpi_mach *
>   snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines);
>   
> -/* acpi check hid */
> -bool snd_soc_acpi_check_hid(const u8 hid[ACPI_ID_LEN]);
> -
>   /**
>    * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are
>    * related to the hardware, except for the firmware and topology file names.
> diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c
> index f21df28bc28e..3543a7749490 100644
> --- a/sound/soc/soc-acpi.c
> +++ b/sound/soc/soc-acpi.c
> @@ -49,41 +49,13 @@ const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
>   }
>   EXPORT_SYMBOL_GPL(snd_soc_acpi_find_name_from_hid);
>   
> -static acpi_status snd_soc_acpi_mach_match(acpi_handle handle, u32 level,
> -				       void *context, void **ret)
> -{
> -	unsigned long long sta;
> -	acpi_status status;
> -
> -	*(bool *)context = true;
> -	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
> -	if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
> -		*(bool *)context = false;
> -
> -	return AE_OK;
> -}
> -
> -bool snd_soc_acpi_check_hid(const u8 hid[ACPI_ID_LEN])
> -{
> -	acpi_status status;
> -	bool found = false;
> -
> -	status = acpi_get_devices(hid, snd_soc_acpi_mach_match, &found, NULL);
> -
> -	if (ACPI_FAILURE(status))
> -		return false;
> -
> -	return found;
> -}
> -EXPORT_SYMBOL_GPL(snd_soc_acpi_check_hid);
> -
>   struct snd_soc_acpi_mach *
>   snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)
>   {
>   	struct snd_soc_acpi_mach *mach;
>   
>   	for (mach = machines; mach->id[0]; mach++) {
> -		if (snd_soc_acpi_check_hid(mach->id) == true) {
> +		if (acpi_dev_present(mach->id, NULL, -1)) {
>   			if (mach->machine_quirk == NULL)
>   				return mach;
>   
> @@ -163,7 +135,7 @@ struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg)
>   		return mach;
>   
>   	for (i = 0; i < codec_list->num_codecs; i++) {
> -		if (snd_soc_acpi_check_hid(codec_list->codecs[i]) != true)
> +		if (!acpi_dev_present(codec_list->codecs[i], NULL, -1))
>   			return NULL;
>   	}
>   

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [alsa-devel] [PATCH v3] ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
  2017-11-13 19:43 ` [alsa-devel] " Pierre-Louis Bossart
@ 2017-11-14 19:12     ` Jeremy Cline
  0 siblings, 0 replies; 8+ messages in thread
From: Jeremy Cline @ 2017-11-14 19:12 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Liam Girdwood, Mark Brown, alsa-devel, Takashi Iwai,
	linux-kernel, Hans de Goede

On Mon, Nov 13, 2017 at 01:43:57PM -0600, Pierre-Louis Bossart wrote:
> On 11/10/2017 12:36 PM, Jeremy Cline wrote:
> > Replace snd_soc_acpi_check_hid() with the generic acpi_dev_present()
> > and remove the now unused snd_soc_acpi_check_hid function. This should
> > have no functional change.
> 
> The code looks ok, but I'd like to first add the fix for the quirk handling
> regression which appeared in 4.13 and is still there in 4.14. Current fix is
> at https://bugzilla.kernel.org/attachment.cgi?id=258581
> 
> Can we wait a couple of days on this one to avoid mixing bug fixes and
> renames? this would also make the stable branch fix easier to handle.

That makes perfect sense to me. I'm pretty new to all this, should I just
keep an eye on things and rebase this once that patch lands?

Thanks,
Jeremy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
@ 2017-11-14 19:12     ` Jeremy Cline
  0 siblings, 0 replies; 8+ messages in thread
From: Jeremy Cline @ 2017-11-14 19:12 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, Takashi Iwai, linux-kernel, Liam Girdwood,
	Hans de Goede, Mark Brown

On Mon, Nov 13, 2017 at 01:43:57PM -0600, Pierre-Louis Bossart wrote:
> On 11/10/2017 12:36 PM, Jeremy Cline wrote:
> > Replace snd_soc_acpi_check_hid() with the generic acpi_dev_present()
> > and remove the now unused snd_soc_acpi_check_hid function. This should
> > have no functional change.
> 
> The code looks ok, but I'd like to first add the fix for the quirk handling
> regression which appeared in 4.13 and is still there in 4.14. Current fix is
> at https://bugzilla.kernel.org/attachment.cgi?id=258581
> 
> Can we wait a couple of days on this one to avoid mixing bug fixes and
> renames? this would also make the stable branch fix easier to handle.

That makes perfect sense to me. I'm pretty new to all this, should I just
keep an eye on things and rebase this once that patch lands?

Thanks,
Jeremy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [alsa-devel] [PATCH v3] ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
  2017-11-14 19:12     ` Jeremy Cline
  (?)
@ 2017-11-14 19:54     ` Pierre-Louis Bossart
  2017-11-14 21:05         ` Jeremy Cline
  -1 siblings, 1 reply; 8+ messages in thread
From: Pierre-Louis Bossart @ 2017-11-14 19:54 UTC (permalink / raw)
  To: Jeremy Cline
  Cc: alsa-devel, Takashi Iwai, linux-kernel, Liam Girdwood,
	Hans de Goede, Mark Brown



On 11/14/2017 01:12 PM, Jeremy Cline wrote:
> On Mon, Nov 13, 2017 at 01:43:57PM -0600, Pierre-Louis Bossart wrote:
>> On 11/10/2017 12:36 PM, Jeremy Cline wrote:
>>> Replace snd_soc_acpi_check_hid() with the generic acpi_dev_present()
>>> and remove the now unused snd_soc_acpi_check_hid function. This should
>>> have no functional change.
>> The code looks ok, but I'd like to first add the fix for the quirk handling
>> regression which appeared in 4.13 and is still there in 4.14. Current fix is
>> at https://bugzilla.kernel.org/attachment.cgi?id=258581
>>
>> Can we wait a couple of days on this one to avoid mixing bug fixes and
>> renames? this would also make the stable branch fix easier to handle.
> That makes perfect sense to me. I'm pretty new to all this, should I just
> keep an eye on things and rebase this once that patch lands?
if it's easier I can submit both the fix and your change in the same 
series (keeping you as the author of course)
>
> Thanks,
> Jeremy
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [alsa-devel] [PATCH v3] ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
  2017-11-14 19:54     ` [alsa-devel] " Pierre-Louis Bossart
@ 2017-11-14 21:05         ` Jeremy Cline
  0 siblings, 0 replies; 8+ messages in thread
From: Jeremy Cline @ 2017-11-14 21:05 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, Takashi Iwai, linux-kernel, Liam Girdwood,
	Hans de Goede, Mark Brown

On Tue, Nov 14, 2017 at 01:54:59PM -0600, Pierre-Louis Bossart wrote:
> if it's easier I can submit both the fix and your change in the same series
> (keeping you as the author of course)

That does sound easier, but whatever is easiest for you works for me!

Thanks,
Jeremy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
@ 2017-11-14 21:05         ` Jeremy Cline
  0 siblings, 0 replies; 8+ messages in thread
From: Jeremy Cline @ 2017-11-14 21:05 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, linux-kernel, Liam Girdwood, Takashi Iwai,
	Hans de Goede, Mark Brown

On Tue, Nov 14, 2017 at 01:54:59PM -0600, Pierre-Louis Bossart wrote:
> if it's easier I can submit both the fix and your change in the same series
> (keeping you as the author of course)

That does sound easier, but whatever is easiest for you works for me!

Thanks,
Jeremy

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-11-14 21:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-10 18:36 [PATCH v3] ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present Jeremy Cline
2017-11-10 18:36 ` Jeremy Cline
2017-11-13 19:43 ` [alsa-devel] " Pierre-Louis Bossart
2017-11-14 19:12   ` Jeremy Cline
2017-11-14 19:12     ` Jeremy Cline
2017-11-14 19:54     ` [alsa-devel] " Pierre-Louis Bossart
2017-11-14 21:05       ` Jeremy Cline
2017-11-14 21:05         ` Jeremy Cline

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.