Skip to content

Commit 44168f9

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 62149bf commit 44168f9

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
@@ -561,6 +561,8 @@ int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
561561
struct snd_ctl_elem_value *ucontrol);
562562
int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
563563
struct snd_ctl_elem_value *ucontrol);
564+
bool snd_soc_control_matches(struct snd_kcontrol *kcontrol,
565+
const char *pattern);
564566
int snd_soc_limit_volume(struct snd_soc_card *card,
565567
const char *name, int max);
566568
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
@@ -397,7 +397,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
397397
}
398398
EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx);
399399

400-
static bool soc_control_matches(struct snd_kcontrol *kctl,
400+
bool snd_soc_control_matches(struct snd_kcontrol *kctl,
401401
const char *pattern)
402402
{
403403
const char *name = kctl->id.name;
@@ -419,6 +419,7 @@ static bool soc_control_matches(struct snd_kcontrol *kctl,
419419

420420
return !strcmp(name, pattern);
421421
}
422+
EXPORT_SYMBOL_GPL(snd_soc_control_matches);
422423

423424
static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl)
424425
{
@@ -486,7 +487,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card, const char *name, int max)
486487
return -EINVAL;
487488

488489
list_for_each_entry(kctl, &card->snd_card->controls, list) {
489-
if (!soc_control_matches(kctl, name))
490+
if (!snd_soc_control_matches(kctl, name))
490491
continue;
491492

492493
ret = soc_limit_volume(kctl, max);
@@ -524,7 +525,7 @@ int snd_soc_deactivate_kctl(struct snd_soc_card *card,
524525
return -EINVAL;
525526

526527
list_for_each_entry(kctl, &card->snd_card->controls, list) {
527-
if (!soc_control_matches(kctl, name))
528+
if (!snd_soc_control_matches(kctl, name))
528529
continue;
529530

530531
ret = snd_ctl_activate_id(card->snd_card, &kctl->id, active);
@@ -594,7 +595,7 @@ int snd_soc_set_enum_kctl(struct snd_soc_card *card,
594595
return -EINVAL;
595596

596597
list_for_each_entry(kctl, &card->snd_card->controls, list) {
597-
if (!soc_control_matches(kctl, name))
598+
if (!snd_soc_control_matches(kctl, name))
598599
continue;
599600

600601
ret = soc_set_enum_kctl(kctl, value);

0 commit comments

Comments
 (0)