Skip to content

Commit a739c3d

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 5174dc3 commit a739c3d

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
@@ -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
{
@@ -485,7 +486,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card, const char *name, int max)
485486
return -EINVAL;
486487

487488
list_for_each_entry(kctl, &card->snd_card->controls, list) {
488-
if (!soc_control_matches(kctl, name))
489+
if (!snd_soc_control_matches(kctl, name))
489490
continue;
490491

491492
ret = soc_limit_volume(kctl, max);
@@ -523,7 +524,7 @@ int snd_soc_deactivate_kctl(struct snd_soc_card *card,
523524
return -EINVAL;
524525

525526
list_for_each_entry(kctl, &card->snd_card->controls, list) {
526-
if (!soc_control_matches(kctl, name))
527+
if (!snd_soc_control_matches(kctl, name))
527528
continue;
528529

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

595596
list_for_each_entry(kctl, &card->snd_card->controls, list) {
596-
if (!soc_control_matches(kctl, name))
597+
if (!snd_soc_control_matches(kctl, name))
597598
continue;
598599

599600
ret = soc_set_enum_kctl(kctl, value);

0 commit comments

Comments
 (0)