Skip to content

Commit 2841b25

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 2f82985 commit 2841b25

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
@@ -607,6 +607,8 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
607607
struct snd_ctl_elem_value *ucontrol);
608608
int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
609609
struct snd_ctl_elem_value *ucontrol);
610+
bool snd_soc_control_matches(struct snd_kcontrol *kcontrol,
611+
const char *pattern);
610612
int snd_soc_limit_volume(struct snd_soc_card *card,
611613
const char *name, int max);
612614
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
@@ -632,7 +632,7 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
632632
}
633633
EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range);
634634

635-
static bool soc_control_matches(struct snd_kcontrol *kctl,
635+
bool snd_soc_control_matches(struct snd_kcontrol *kctl,
636636
const char *pattern)
637637
{
638638
const char *name = kctl->id.name;
@@ -654,6 +654,7 @@ static bool soc_control_matches(struct snd_kcontrol *kctl,
654654

655655
return !strcmp(name, pattern);
656656
}
657+
EXPORT_SYMBOL_GPL(snd_soc_control_matches);
657658

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

721722
list_for_each_entry(kctl, &card->snd_card->controls, list) {
722-
if (!soc_control_matches(kctl, name))
723+
if (!snd_soc_control_matches(kctl, name))
723724
continue;
724725

725726
ret = soc_limit_volume(kctl, max);
@@ -757,7 +758,7 @@ int snd_soc_deactivate_kctl(struct snd_soc_card *card,
757758
return -EINVAL;
758759

759760
list_for_each_entry(kctl, &card->snd_card->controls, list) {
760-
if (!soc_control_matches(kctl, name))
761+
if (!snd_soc_control_matches(kctl, name))
761762
continue;
762763

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

829830
list_for_each_entry(kctl, &card->snd_card->controls, list) {
830-
if (!soc_control_matches(kctl, name))
831+
if (!snd_soc_control_matches(kctl, name))
831832
continue;
832833

833834
ret = soc_set_enum_kctl(kctl, value);

0 commit comments

Comments
 (0)