Skip to content

Commit 6577c29

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 17680aa commit 6577c29

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
@@ -569,6 +569,8 @@ int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
569569
struct snd_ctl_elem_value *ucontrol);
570570
int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
571571
struct snd_ctl_elem_value *ucontrol);
572+
bool snd_soc_control_matches(struct snd_kcontrol *kcontrol,
573+
const char *pattern);
572574
int snd_soc_limit_volume(struct snd_soc_card *card,
573575
const char *name, int max);
574576
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
@@ -396,7 +396,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
396396
}
397397
EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx);
398398

399-
static bool soc_control_matches(struct snd_kcontrol *kctl,
399+
bool snd_soc_control_matches(struct snd_kcontrol *kctl,
400400
const char *pattern)
401401
{
402402
const char *name = kctl->id.name;
@@ -418,6 +418,7 @@ static bool soc_control_matches(struct snd_kcontrol *kctl,
418418

419419
return !strcmp(name, pattern);
420420
}
421+
EXPORT_SYMBOL_GPL(snd_soc_control_matches);
421422

422423
static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl)
423424
{
@@ -481,7 +482,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card, const char *name, int max)
481482
return -EINVAL;
482483

483484
list_for_each_entry(kctl, &card->snd_card->controls, list) {
484-
if (!soc_control_matches(kctl, name))
485+
if (!snd_soc_control_matches(kctl, name))
485486
continue;
486487

487488
ret = soc_limit_volume(kctl, max);
@@ -519,7 +520,7 @@ int snd_soc_deactivate_kctl(struct snd_soc_card *card,
519520
return -EINVAL;
520521

521522
list_for_each_entry(kctl, &card->snd_card->controls, list) {
522-
if (!soc_control_matches(kctl, name))
523+
if (!snd_soc_control_matches(kctl, name))
523524
continue;
524525

525526
ret = snd_ctl_activate_id(card->snd_card, &kctl->id, active);
@@ -589,7 +590,7 @@ int snd_soc_set_enum_kctl(struct snd_soc_card *card,
589590
return -EINVAL;
590591

591592
list_for_each_entry(kctl, &card->snd_card->controls, list) {
592-
if (!soc_control_matches(kctl, name))
593+
if (!snd_soc_control_matches(kctl, name))
593594
continue;
594595

595596
ret = soc_set_enum_kctl(kctl, value);

0 commit comments

Comments
 (0)