ASoC: simple-card: simplify code
Rename the pointer to the private data structure to 'priv' to avoid confusion with the platform data pointer. Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
45fce59496
commit
b367a3252b
|
@ -47,18 +47,18 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
|
||||||
|
|
||||||
static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
|
static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
struct simple_card_data *info =
|
struct simple_card_data *priv =
|
||||||
snd_soc_card_get_drvdata(rtd->card);
|
snd_soc_card_get_drvdata(rtd->card);
|
||||||
struct snd_soc_dai *codec = rtd->codec_dai;
|
struct snd_soc_dai *codec = rtd->codec_dai;
|
||||||
struct snd_soc_dai *cpu = rtd->cpu_dai;
|
struct snd_soc_dai *cpu = rtd->cpu_dai;
|
||||||
unsigned int daifmt = info->daifmt;
|
unsigned int daifmt = priv->daifmt;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = __asoc_simple_card_dai_init(codec, &info->codec_dai, daifmt);
|
ret = __asoc_simple_card_dai_init(codec, &priv->codec_dai, daifmt);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = __asoc_simple_card_dai_init(cpu, &info->cpu_dai, daifmt);
|
ret = __asoc_simple_card_dai_init(cpu, &priv->cpu_dai, daifmt);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -129,21 +129,21 @@ parse_error:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int asoc_simple_card_parse_of(struct device_node *node,
|
static int asoc_simple_card_parse_of(struct device_node *node,
|
||||||
struct simple_card_data *info,
|
struct simple_card_data *priv,
|
||||||
struct device *dev)
|
struct device *dev)
|
||||||
{
|
{
|
||||||
struct snd_soc_dai_link *dai_link = info->snd_card.dai_link;
|
struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
char *name;
|
char *name;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* get CPU/CODEC common format via simple-audio-card,format */
|
/* get CPU/CODEC common format via simple-audio-card,format */
|
||||||
info->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
|
priv->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
|
||||||
(SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK);
|
(SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK);
|
||||||
|
|
||||||
/* DAPM routes */
|
/* DAPM routes */
|
||||||
if (of_property_read_bool(node, "simple-audio-card,routing")) {
|
if (of_property_read_bool(node, "simple-audio-card,routing")) {
|
||||||
ret = snd_soc_of_parse_audio_routing(&info->snd_card,
|
ret = snd_soc_of_parse_audio_routing(&priv->snd_card,
|
||||||
"simple-audio-card,routing");
|
"simple-audio-card,routing");
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -154,7 +154,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
|
||||||
np = of_get_child_by_name(node, "simple-audio-card,cpu");
|
np = of_get_child_by_name(node, "simple-audio-card,cpu");
|
||||||
if (np)
|
if (np)
|
||||||
ret = asoc_simple_card_sub_parse_of(np,
|
ret = asoc_simple_card_sub_parse_of(np,
|
||||||
&info->cpu_dai,
|
&priv->cpu_dai,
|
||||||
&dai_link->cpu_of_node,
|
&dai_link->cpu_of_node,
|
||||||
&dai_link->cpu_dai_name);
|
&dai_link->cpu_dai_name);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -165,7 +165,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
|
||||||
np = of_get_child_by_name(node, "simple-audio-card,codec");
|
np = of_get_child_by_name(node, "simple-audio-card,codec");
|
||||||
if (np)
|
if (np)
|
||||||
ret = asoc_simple_card_sub_parse_of(np,
|
ret = asoc_simple_card_sub_parse_of(np,
|
||||||
&info->codec_dai,
|
&priv->codec_dai,
|
||||||
&dai_link->codec_of_node,
|
&dai_link->codec_of_node,
|
||||||
&dai_link->codec_dai_name);
|
&dai_link->codec_dai_name);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -181,22 +181,22 @@ static int asoc_simple_card_parse_of(struct device_node *node,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
sprintf(name, "%s-%s", dai_link->cpu_dai_name,
|
sprintf(name, "%s-%s", dai_link->cpu_dai_name,
|
||||||
dai_link->codec_dai_name);
|
dai_link->codec_dai_name);
|
||||||
info->snd_card.name = name;
|
priv->snd_card.name = name;
|
||||||
dai_link->name = dai_link->stream_name = name;
|
dai_link->name = dai_link->stream_name = name;
|
||||||
|
|
||||||
/* simple-card assumes platform == cpu */
|
/* simple-card assumes platform == cpu */
|
||||||
dai_link->platform_of_node = dai_link->cpu_of_node;
|
dai_link->platform_of_node = dai_link->cpu_of_node;
|
||||||
|
|
||||||
dev_dbg(dev, "card-name : %s\n", name);
|
dev_dbg(dev, "card-name : %s\n", name);
|
||||||
dev_dbg(dev, "platform : %04x\n", info->daifmt);
|
dev_dbg(dev, "platform : %04x\n", priv->daifmt);
|
||||||
dev_dbg(dev, "cpu : %s / %04x / %d\n",
|
dev_dbg(dev, "cpu : %s / %04x / %d\n",
|
||||||
dai_link->cpu_dai_name,
|
dai_link->cpu_dai_name,
|
||||||
info->cpu_dai.fmt,
|
priv->cpu_dai.fmt,
|
||||||
info->cpu_dai.sysclk);
|
priv->cpu_dai.sysclk);
|
||||||
dev_dbg(dev, "codec : %s / %04x / %d\n",
|
dev_dbg(dev, "codec : %s / %04x / %d\n",
|
||||||
dai_link->codec_dai_name,
|
dai_link->codec_dai_name,
|
||||||
info->codec_dai.fmt,
|
priv->codec_dai.fmt,
|
||||||
info->codec_dai.sysclk);
|
priv->codec_dai.sysclk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue