Skip to content

Commit 209c6cd

Browse files
morimotobroonie
authored andcommitted
ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card
Card related function should be implemented at soc-card now. This patch moves it. Signed-off-by: Kuninori Morimoto <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 1793936 commit 209c6cd

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

include/sound/soc-card.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
#ifndef __SOC_CARD_H
99
#define __SOC_CARD_H
1010

11+
struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
12+
const char *name);
13+
1114
#endif /* __SOC_CARD_H */

include/sound/soc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,6 @@ static inline int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops)
582582
struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
583583
void *data, const char *long_name,
584584
const char *prefix);
585-
struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
586-
const char *name);
587585
int snd_soc_add_component_controls(struct snd_soc_component *component,
588586
const struct snd_kcontrol_new *controls, unsigned int num_controls);
589587
int snd_soc_add_card_controls(struct snd_soc_card *soc_card,

sound/soc/soc-card.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,19 @@ static inline int _soc_card_ret(struct snd_soc_card *card,
2424

2525
return ret;
2626
}
27+
28+
struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
29+
const char *name)
30+
{
31+
struct snd_card *card = soc_card->snd_card;
32+
struct snd_kcontrol *kctl;
33+
34+
if (unlikely(!name))
35+
return NULL;
36+
37+
list_for_each_entry(kctl, &card->controls, list)
38+
if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name)))
39+
return kctl;
40+
return NULL;
41+
}
42+
EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);

sound/soc/soc-core.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,22 +2096,6 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev,
20962096
return 0;
20972097
}
20982098

2099-
struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
2100-
const char *name)
2101-
{
2102-
struct snd_card *card = soc_card->snd_card;
2103-
struct snd_kcontrol *kctl;
2104-
2105-
if (unlikely(!name))
2106-
return NULL;
2107-
2108-
list_for_each_entry(kctl, &card->controls, list)
2109-
if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name)))
2110-
return kctl;
2111-
return NULL;
2112-
}
2113-
EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);
2114-
21152099
/**
21162100
* snd_soc_add_component_controls - Add an array of controls to a component.
21172101
*

0 commit comments

Comments
 (0)