Skip to content

Commit b11efd4

Browse files
marcanjannau
authored andcommitted
ASoC: ops: Export snd_soc_control_matches()
This helper is useful for drivers that want to do their own control lookups and matching as part of more complex logic than the existing operations. Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent 993c7a4 commit b11efd4

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

include/sound/soc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,8 @@ int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
575575
struct snd_ctl_elem_value *ucontrol);
576576
int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
577577
struct snd_ctl_elem_value *ucontrol);
578+
bool snd_soc_control_matches(struct snd_kcontrol *kcontrol,
579+
const char *pattern);
578580
int snd_soc_limit_volume(struct snd_soc_card *card,
579581
const char *name, int max);
580582
int snd_soc_deactivate_kctl(struct snd_soc_card *card,

sound/soc/soc-ops.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
445445
}
446446
EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx);
447447

448-
static bool soc_control_matches(struct snd_kcontrol *kctl,
448+
bool snd_soc_control_matches(struct snd_kcontrol *kctl,
449449
const char *pattern)
450450
{
451451
const char *name = kctl->id.name;
@@ -467,6 +467,7 @@ static bool soc_control_matches(struct snd_kcontrol *kctl,
467467

468468
return !strcmp(name, pattern);
469469
}
470+
EXPORT_SYMBOL_GPL(snd_soc_control_matches);
470471

471472
static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl)
472473
{
@@ -534,7 +535,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card, const char *name, int max)
534535
return -EINVAL;
535536

536537
list_for_each_entry(kctl, &card->snd_card->controls, list) {
537-
if (!soc_control_matches(kctl, name))
538+
if (!snd_soc_control_matches(kctl, name))
538539
continue;
539540

540541
ret = soc_limit_volume(kctl, max);
@@ -572,7 +573,7 @@ int snd_soc_deactivate_kctl(struct snd_soc_card *card,
572573
return -EINVAL;
573574

574575
list_for_each_entry(kctl, &card->snd_card->controls, list) {
575-
if (!soc_control_matches(kctl, name))
576+
if (!snd_soc_control_matches(kctl, name))
576577
continue;
577578

578579
ret = snd_ctl_activate_id(card->snd_card, &kctl->id, active);
@@ -642,7 +643,7 @@ int snd_soc_set_enum_kctl(struct snd_soc_card *card,
642643
return -EINVAL;
643644

644645
list_for_each_entry(kctl, &card->snd_card->controls, list) {
645-
if (!soc_control_matches(kctl, name))
646+
if (!snd_soc_control_matches(kctl, name))
646647
continue;
647648

648649
ret = soc_set_enum_kctl(kctl, value);

0 commit comments

Comments
 (0)