All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Francois Moine <moinejf@free.fr>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	linux-kernel@vger.kernel.org, Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH v3 1/4] ASoC: simple-card: Simplify code
Date: Sat, 15 Mar 2014 11:32:42 +0100	[thread overview]
Message-ID: <c74668c9277d538b105ab93affe7d33a64342ee9.1394883134.git.moinejf@free.fr> (raw)
In-Reply-To: <cover.1394883134.git.moinejf@free.fr>

The global DAI format is used only in the function
asoc_simple_card_parse_of(). So, move it from the private data
to the stack.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
 sound/soc/generic/simple-card.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index dcf37fb..ca7e63e 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -20,7 +20,6 @@
 
 struct simple_card_data {
 	struct snd_soc_card snd_card;
-	unsigned int daifmt;
 	struct asoc_simple_dai cpu_dai;
 	struct asoc_simple_dai codec_dai;
 	struct snd_soc_dai_link snd_link;
@@ -154,13 +153,14 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link;
 	struct device_node *np;
 	char *name;
+	unsigned int daifmt;
 	int ret;
 
 	/* parsing the card name from DT */
 	snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name");
 
 	/* get CPU/CODEC common format via simple-audio-card,format */
-	priv->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
+	daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
 		(SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK);
 
 	/* off-codec widgets */
@@ -183,7 +183,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	ret = -EINVAL;
 	np = of_get_child_by_name(node, "simple-audio-card,cpu");
 	if (np) {
-		ret = asoc_simple_card_sub_parse_of(np, priv->daifmt,
+		ret = asoc_simple_card_sub_parse_of(np, daifmt,
 						  &priv->cpu_dai,
 						  &dai_link->cpu_of_node,
 						  &dai_link->cpu_dai_name);
@@ -196,7 +196,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	ret = -EINVAL;
 	np = of_get_child_by_name(node, "simple-audio-card,codec");
 	if (np) {
-		ret = asoc_simple_card_sub_parse_of(np, priv->daifmt,
+		ret = asoc_simple_card_sub_parse_of(np, daifmt,
 						  &priv->codec_dai,
 						  &dai_link->codec_of_node,
 						  &dai_link->codec_dai_name);
@@ -223,7 +223,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	dai_link->platform_of_node = dai_link->cpu_of_node;
 
 	dev_dbg(dev, "card-name : %s\n", name);
-	dev_dbg(dev, "platform : %04x\n", priv->daifmt);
+	dev_dbg(dev, "platform : %04x\n", daifmt);
 	dev_dbg(dev, "cpu : %s / %04x / %d\n",
 		dai_link->cpu_dai_name,
 		priv->cpu_dai.fmt,
-- 
1.9.0


WARNING: multiple messages have this Message-ID (diff)
From: Jean-Francois Moine <moinejf@free.fr>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, Xiubo Li <Li.Xiubo@freescale.com>,
	linux-kernel@vger.kernel.org,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Subject: [PATCH v3 1/4] ASoC: simple-card: Simplify code
Date: Sat, 15 Mar 2014 11:32:42 +0100	[thread overview]
Message-ID: <c74668c9277d538b105ab93affe7d33a64342ee9.1394883134.git.moinejf@free.fr> (raw)
In-Reply-To: <cover.1394883134.git.moinejf@free.fr>

The global DAI format is used only in the function
asoc_simple_card_parse_of(). So, move it from the private data
to the stack.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
 sound/soc/generic/simple-card.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index dcf37fb..ca7e63e 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -20,7 +20,6 @@
 
 struct simple_card_data {
 	struct snd_soc_card snd_card;
-	unsigned int daifmt;
 	struct asoc_simple_dai cpu_dai;
 	struct asoc_simple_dai codec_dai;
 	struct snd_soc_dai_link snd_link;
@@ -154,13 +153,14 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link;
 	struct device_node *np;
 	char *name;
+	unsigned int daifmt;
 	int ret;
 
 	/* parsing the card name from DT */
 	snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name");
 
 	/* get CPU/CODEC common format via simple-audio-card,format */
-	priv->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
+	daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
 		(SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK);
 
 	/* off-codec widgets */
@@ -183,7 +183,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	ret = -EINVAL;
 	np = of_get_child_by_name(node, "simple-audio-card,cpu");
 	if (np) {
-		ret = asoc_simple_card_sub_parse_of(np, priv->daifmt,
+		ret = asoc_simple_card_sub_parse_of(np, daifmt,
 						  &priv->cpu_dai,
 						  &dai_link->cpu_of_node,
 						  &dai_link->cpu_dai_name);
@@ -196,7 +196,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	ret = -EINVAL;
 	np = of_get_child_by_name(node, "simple-audio-card,codec");
 	if (np) {
-		ret = asoc_simple_card_sub_parse_of(np, priv->daifmt,
+		ret = asoc_simple_card_sub_parse_of(np, daifmt,
 						  &priv->codec_dai,
 						  &dai_link->codec_of_node,
 						  &dai_link->codec_dai_name);
@@ -223,7 +223,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	dai_link->platform_of_node = dai_link->cpu_of_node;
 
 	dev_dbg(dev, "card-name : %s\n", name);
-	dev_dbg(dev, "platform : %04x\n", priv->daifmt);
+	dev_dbg(dev, "platform : %04x\n", daifmt);
 	dev_dbg(dev, "cpu : %s / %04x / %d\n",
 		dai_link->cpu_dai_name,
 		priv->cpu_dai.fmt,
-- 
1.9.0

  reply	other threads:[~2014-03-15 11:42 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-15 11:32 [PATCH v3 0/4] ASoC: simple-card: multi DAI links extension Jean-Francois Moine
2014-03-15 11:32 ` Jean-Francois Moine
2014-03-15 10:32 ` Jean-Francois Moine [this message]
2014-03-15 10:32   ` [PATCH v3 1/4] ASoC: simple-card: Simplify code Jean-Francois Moine
2014-03-17 16:24   ` Mark Brown
2014-03-15 11:09 ` [PATCH v3 2/4] ASoC: simple-card: dynamically allocate the DAI link and properties Jean-Francois Moine
2014-03-17  9:29   ` [alsa-devel] " Jyri Sarha
2014-03-17  9:29     ` Jyri Sarha
2014-03-17 10:23     ` Jean-Francois Moine
2014-03-17 10:23       ` Jean-Francois Moine
2014-03-17 10:27       ` [alsa-devel] " Jyri Sarha
2014-03-17 10:27         ` Jyri Sarha
2014-03-17 16:24   ` Mark Brown
2014-03-18 20:18   ` Mark Brown
2014-03-15 11:26 ` [PATCH v3 3/4] ASoC: simple-card: Handle many DAI links Jean-Francois Moine
2014-03-17 16:29   ` Mark Brown
2014-03-15 11:30 ` [PATCH v3 4/4] ASoC: simple-card: Add DT documentation for multi-DAI links Jean-Francois Moine
2014-03-17 10:19   ` [alsa-devel] " Jyri Sarha
2014-03-17 10:19     ` Jyri Sarha
2014-03-17 16:43   ` Mark Brown
2014-03-17 16:43     ` Mark Brown
2014-03-18  8:17     ` Jean-Francois Moine
2014-03-18 10:41       ` Mark Brown
2014-03-18 10:41         ` Mark Brown
2014-03-19 10:08       ` Jyri Sarha
2014-03-19 10:08         ` Jyri Sarha
2014-03-19 13:46         ` Mark Brown
2014-03-19 13:46           ` Mark Brown
2014-03-19 18:32           ` Jyri Sarha
2014-03-19 18:32             ` Jyri Sarha
2014-03-19 19:14             ` Mark Brown
2014-03-19 19:14               ` Mark Brown
2014-03-19 16:07         ` Jean-Francois Moine
2014-03-19 16:07           ` Jean-Francois Moine
2014-03-19 18:51         ` [alsa-devel] " Lars-Peter Clausen
2014-03-19 18:51           ` Lars-Peter Clausen
2014-03-19 19:15           ` Jyri Sarha
2014-03-19 19:15             ` Jyri Sarha
2014-03-19 19:21             ` Mark Brown
2014-03-19 19:21               ` Mark Brown
2014-03-19 19:31               ` Lars-Peter Clausen
2014-03-19 19:31                 ` Lars-Peter Clausen
2014-03-20 11:24                 ` Jyri Sarha
2014-03-20 11:24                   ` Jyri Sarha
2014-03-17  3:49 ` [PATCH v3 0/4] ASoC: simple-card: multi DAI links extension Li.Xiubo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c74668c9277d538b105ab93affe7d33a64342ee9.1394883134.git.moinejf@free.fr \
    --to=moinejf@free.fr \
    --cc=Li.Xiubo@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.