All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: spread usage of snd_ctl_elem_info()
@ 2014-10-21 10:14 Takashi Iwai
  2014-10-21 10:14 ` [PATCH 1/2] ASoC: s6000: Use snd_ctl_enum_info() Takashi Iwai
  2014-10-21 10:14 ` [PATCH 2/2] ASoC: core: " Takashi Iwai
  0 siblings, 2 replies; 6+ messages in thread
From: Takashi Iwai @ 2014-10-21 10:14 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown

Hi,

just like my previous patch series, this convers the simple open-code
for enum info callbacks with the existing snd_ctl_enum_info() helper.

They can be applied individually, as far as I know, but I think it'd
fit better to the same branch for other similar patches.


Takashi

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

* [PATCH 1/2] ASoC: s6000: Use snd_ctl_enum_info()
  2014-10-21 10:14 [PATCH 0/2] ASoC: spread usage of snd_ctl_elem_info() Takashi Iwai
@ 2014-10-21 10:14 ` Takashi Iwai
  2014-10-21 13:24   ` Lars-Peter Clausen
  2014-10-21 10:14 ` [PATCH 2/2] ASoC: core: " Takashi Iwai
  1 sibling, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2014-10-21 10:14 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown

... and reduce the open codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/s6000/s6105-ipcam.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c
index 3510c01f8a6a..e1e159257b57 100644
--- a/sound/soc/s6000/s6105-ipcam.c
+++ b/sound/soc/s6000/s6105-ipcam.c
@@ -80,16 +80,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
 static int output_type_info(struct snd_kcontrol *kcontrol,
 			    struct snd_ctl_elem_info *uinfo)
 {
-	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-	uinfo->count = 1;
-	uinfo->value.enumerated.items = 2;
-	if (uinfo->value.enumerated.item) {
-		uinfo->value.enumerated.item = 1;
-		strcpy(uinfo->value.enumerated.name, "HPLOUT/HPROUT");
-	} else {
-		strcpy(uinfo->value.enumerated.name, "HPLOUT/HPLCOM");
-	}
-	return 0;
+	static const char * const texts[] = {
+		"HPLOUT/HPLCOM", "HPLOUT/HPROUT",
+	};
+
+	return snd_ctl_enum_info(uinfo, 1, 2, texts);
 }
 
 static int output_type_get(struct snd_kcontrol *kcontrol,
-- 
2.1.2

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

* [PATCH 2/2] ASoC: core: Use snd_ctl_enum_info()
  2014-10-21 10:14 [PATCH 0/2] ASoC: spread usage of snd_ctl_elem_info() Takashi Iwai
  2014-10-21 10:14 ` [PATCH 1/2] ASoC: s6000: Use snd_ctl_enum_info() Takashi Iwai
@ 2014-10-21 10:14 ` Takashi Iwai
  2014-10-22 10:05   ` Mark Brown
  1 sibling, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2014-10-21 10:14 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown

... and reduce the open codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/soc-core.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4c8f8a23a0e9..96ecdc30eb60 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2348,16 +2348,8 @@ int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
 {
 	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
 
-	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-	uinfo->count = e->shift_l == e->shift_r ? 1 : 2;
-	uinfo->value.enumerated.items = e->items;
-
-	if (uinfo->value.enumerated.item >= e->items)
-		uinfo->value.enumerated.item = e->items - 1;
-	strlcpy(uinfo->value.enumerated.name,
-		e->texts[uinfo->value.enumerated.item],
-		sizeof(uinfo->value.enumerated.name));
-	return 0;
+	return snd_ctl_enum_info(uinfo, e->shift_l == e->shift_r ? 1 : 2,
+				 e->items, e->texts);
 }
 EXPORT_SYMBOL_GPL(snd_soc_info_enum_double);
 
-- 
2.1.2

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

* Re: [PATCH 1/2] ASoC: s6000: Use snd_ctl_enum_info()
  2014-10-21 10:14 ` [PATCH 1/2] ASoC: s6000: Use snd_ctl_enum_info() Takashi Iwai
@ 2014-10-21 13:24   ` Lars-Peter Clausen
  2014-10-21 13:28     ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Lars-Peter Clausen @ 2014-10-21 13:24 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel; +Cc: Mark Brown, Daniel Glöckner

On 10/21/2014 12:14 PM, Takashi Iwai wrote:
> ... and reduce the open codes.
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

There is another patch from a couple of days back which removes this driver, 
so I guess this patch can be dropped.

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

* Re: [PATCH 1/2] ASoC: s6000: Use snd_ctl_enum_info()
  2014-10-21 13:24   ` Lars-Peter Clausen
@ 2014-10-21 13:28     ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2014-10-21 13:28 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: alsa-devel, Mark Brown, Daniel Glöckner

At Tue, 21 Oct 2014 15:24:38 +0200,
Lars-Peter Clausen wrote:
> 
> On 10/21/2014 12:14 PM, Takashi Iwai wrote:
> > ... and reduce the open codes.
> >
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> 
> There is another patch from a couple of days back which removes this driver, 
> so I guess this patch can be dropped.

OK, good to know.


Takashi

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

* Re: [PATCH 2/2] ASoC: core: Use snd_ctl_enum_info()
  2014-10-21 10:14 ` [PATCH 2/2] ASoC: core: " Takashi Iwai
@ 2014-10-22 10:05   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-10-22 10:05 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel


[-- Attachment #1.1: Type: text/plain, Size: 113 bytes --]

On Tue, Oct 21, 2014 at 12:14:56PM +0200, Takashi Iwai wrote:
> ... and reduce the open codes.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2014-10-22 10:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 10:14 [PATCH 0/2] ASoC: spread usage of snd_ctl_elem_info() Takashi Iwai
2014-10-21 10:14 ` [PATCH 1/2] ASoC: s6000: Use snd_ctl_enum_info() Takashi Iwai
2014-10-21 13:24   ` Lars-Peter Clausen
2014-10-21 13:28     ` Takashi Iwai
2014-10-21 10:14 ` [PATCH 2/2] ASoC: core: " Takashi Iwai
2014-10-22 10:05   ` Mark Brown

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.