Skip to content

Commit e4a887e

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 7a70c73 commit e4a887e

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
@@ -612,6 +612,8 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
612612
struct snd_ctl_elem_value *ucontrol);
613613
int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
614614
struct snd_ctl_elem_value *ucontrol);
615+
bool snd_soc_control_matches(struct snd_kcontrol *kcontrol,
616+
const char *pattern);
615617
int snd_soc_limit_volume(struct snd_soc_card *card,
616618
const char *name, int max);
617619
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
@@ -631,7 +631,7 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
631631
}
632632
EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range);
633633

634-
static bool soc_control_matches(struct snd_kcontrol *kctl,
634+
bool snd_soc_control_matches(struct snd_kcontrol *kctl,
635635
const char *pattern)
636636
{
637637
const char *name = kctl->id.name;
@@ -653,6 +653,7 @@ static bool soc_control_matches(struct snd_kcontrol *kctl,
653653

654654
return !strcmp(name, pattern);
655655
}
656+
EXPORT_SYMBOL_GPL(snd_soc_control_matches);
656657

657658
static int soc_clip_to_platform_max(struct snd_kcontrol *kctl)
658659
{
@@ -718,7 +719,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card,
718719
return -EINVAL;
719720

720721
list_for_each_entry(kctl, &card->snd_card->controls, list) {
721-
if (!soc_control_matches(kctl, name))
722+
if (!snd_soc_control_matches(kctl, name))
722723
continue;
723724

724725
ret = soc_limit_volume(kctl, max);
@@ -756,7 +757,7 @@ int snd_soc_deactivate_kctl(struct snd_soc_card *card,
756757
return -EINVAL;
757758

758759
list_for_each_entry(kctl, &card->snd_card->controls, list) {
759-
if (!soc_control_matches(kctl, name))
760+
if (!snd_soc_control_matches(kctl, name))
760761
continue;
761762

762763
ret = snd_ctl_activate_id(card->snd_card, &kctl->id, active);
@@ -826,7 +827,7 @@ int snd_soc_set_enum_kctl(struct snd_soc_card *card,
826827
return -EINVAL;
827828

828829
list_for_each_entry(kctl, &card->snd_card->controls, list) {
829-
if (!soc_control_matches(kctl, name))
830+
if (!snd_soc_control_matches(kctl, name))
830831
continue;
831832

832833
ret = soc_set_enum_kctl(kctl, value);

0 commit comments

Comments
 (0)