All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix some minor issues in simple card driver
@ 2014-04-24 11:13 Nicolin Chen
  2014-04-24 11:13 ` [PATCH 1/3] ASoC: simple-card: Drop node->name checking Nicolin Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Nicolin Chen @ 2014-04-24 11:13 UTC (permalink / raw)
  To: broonie
  Cc: moinejf, alsa-devel, kuninori.morimoto.gx, tiwai, lgirdwood, jsarha

The series fixes one name limitation and code style problems.

Nicolin Chen (3):
  ASoC: simple-card: Drop node->name checking
  ASoC: simple-card: Simplify error msg in simple_card_dai_link_of()
  ASoC: simple-card: Improve coding style

 sound/soc/generic/simple-card.c | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

-- 
1.8.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] ASoC: simple-card: Drop node->name checking
  2014-04-24 11:13 [PATCH 0/3] Fix some minor issues in simple card driver Nicolin Chen
@ 2014-04-24 11:13 ` Nicolin Chen
  2014-04-24 12:47   ` Jyri Sarha
  2014-04-24 11:13 ` [PATCH 2/3] ASoC: simple-card: Simplify error msg in simple_card_dai_link_of() Nicolin Chen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Nicolin Chen @ 2014-04-24 11:13 UTC (permalink / raw)
  To: broonie
  Cc: moinejf, alsa-devel, kuninori.morimoto.gx, tiwai, lgirdwood, jsarha

The current simple-card driver limits the DT node name to "sound".
Any of other names is forbidden while actually we should allow DT
to pass other node names.

And if this function is being called, the node must already have
the compatible "simple-audio-card" in DTB. So there should be no
need to check the name here.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
---
 sound/soc/generic/simple-card.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 3f2e580..383a4a1 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -156,8 +156,7 @@ static int simple_card_dai_link_of(struct device_node *node,
 	char *prefix = "";
 	int ret;
 
-	if (!strcmp("sound", node->name))
-		prefix = "simple-audio-card,";
+	prefix = "simple-audio-card,";
 
 	daifmt = snd_soc_of_parse_daifmt(node, prefix,
 					 &bitclkmaster, &framemaster);
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] ASoC: simple-card: Simplify error msg in simple_card_dai_link_of()
  2014-04-24 11:13 [PATCH 0/3] Fix some minor issues in simple card driver Nicolin Chen
  2014-04-24 11:13 ` [PATCH 1/3] ASoC: simple-card: Drop node->name checking Nicolin Chen
@ 2014-04-24 11:13 ` Nicolin Chen
  2014-04-24 11:14 ` [PATCH 3/3] ASoC: simple-card: Improve coding style Nicolin Chen
  2014-04-24 12:20 ` [PATCH 0/3] Fix some minor issues in simple card driver Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Nicolin Chen @ 2014-04-24 11:13 UTC (permalink / raw)
  To: broonie
  Cc: moinejf, alsa-devel, kuninori.morimoto.gx, tiwai, lgirdwood, jsarha

It would look better to use prop instead.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
---
 sound/soc/generic/simple-card.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 383a4a1..c091557 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -166,8 +166,7 @@ static int simple_card_dai_link_of(struct device_node *node,
 	np = of_get_child_by_name(node, prop);
 	if (!np) {
 		ret = -EINVAL;
-		dev_err(dev, "%s: Can't find simple-audio-card,cpu DT node\n",
-			__func__);
+		dev_err(dev, "%s: Can't find %s DT node\n", __func__, prop);
 		goto dai_link_of_err;
 	}
 
@@ -198,8 +197,7 @@ static int simple_card_dai_link_of(struct device_node *node,
 	np = of_get_child_by_name(node, prop);
 	if (!np) {
 		ret = -EINVAL;
-		dev_err(dev, "%s: Can't find simple-audio-card,codec DT node\n",
-			__func__);
+		dev_err(dev, "%s: Can't find %s DT node\n", __func__, prop);
 		goto dai_link_of_err;
 	}
 
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] ASoC: simple-card: Improve coding style
  2014-04-24 11:13 [PATCH 0/3] Fix some minor issues in simple card driver Nicolin Chen
  2014-04-24 11:13 ` [PATCH 1/3] ASoC: simple-card: Drop node->name checking Nicolin Chen
  2014-04-24 11:13 ` [PATCH 2/3] ASoC: simple-card: Simplify error msg in simple_card_dai_link_of() Nicolin Chen
@ 2014-04-24 11:14 ` Nicolin Chen
  2014-04-24 12:20 ` [PATCH 0/3] Fix some minor issues in simple card driver Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Nicolin Chen @ 2014-04-24 11:14 UTC (permalink / raw)
  To: broonie
  Cc: moinejf, alsa-devel, kuninori.morimoto.gx, tiwai, lgirdwood, jsarha

Improve indentation and space.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
---
 sound/soc/generic/simple-card.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index c091557..98f97e5 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -66,8 +66,7 @@ err:
 
 static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
-	struct simple_card_data *priv =
-				snd_soc_card_get_drvdata(rtd->card);
+	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *codec = rtd->codec_dai;
 	struct snd_soc_dai *cpu = rtd->cpu_dai;
 	struct simple_dai_props *dai_props;
@@ -177,7 +176,7 @@ static int simple_card_dai_link_of(struct device_node *node,
 		goto dai_link_of_err;
 
 	dai_props->cpu_dai.fmt = daifmt;
-	switch (((np == bitclkmaster)<<4)|(np == framemaster)) {
+	switch (((np == bitclkmaster) << 4) | (np == framemaster)) {
 	case 0x11:
 		dai_props->cpu_dai.fmt |= SND_SOC_DAIFMT_CBS_CFS;
 		break;
@@ -218,7 +217,7 @@ static int simple_card_dai_link_of(struct device_node *node,
 			(daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
 	} else {
 		dai_props->codec_dai.fmt = daifmt;
-		switch (((np == bitclkmaster)<<4)|(np == framemaster)) {
+		switch (((np == bitclkmaster) << 4) | (np == framemaster)) {
 		case 0x11:
 			dai_props->codec_dai.fmt |= SND_SOC_DAIFMT_CBM_CFM;
 			break;
@@ -235,8 +234,8 @@ static int simple_card_dai_link_of(struct device_node *node,
 	}
 
 	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
-			ret = -EINVAL;
-			goto dai_link_of_err;
+		ret = -EINVAL;
+		goto dai_link_of_err;
 	}
 
 	/* simple-card assumes platform == cpu */
@@ -417,10 +416,10 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 			return -EINVAL;
 		}
 
-		if (!cinfo->name	||
-		    !cinfo->codec_dai.name	||
-		    !cinfo->codec	||
-		    !cinfo->platform	||
+		if (!cinfo->name ||
+		    !cinfo->codec_dai.name ||
+		    !cinfo->codec ||
+		    !cinfo->platform ||
 		    !cinfo->cpu_dai.name) {
 			dev_err(dev, "insufficient asoc_simple_card_info settings\n");
 			return -EINVAL;
@@ -464,11 +463,11 @@ MODULE_DEVICE_TABLE(of, asoc_simple_of_match);
 
 static struct platform_driver asoc_simple_card = {
 	.driver = {
-		.name	= "asoc-simple-card",
+		.name = "asoc-simple-card",
 		.owner = THIS_MODULE,
 		.of_match_table = asoc_simple_of_match,
 	},
-	.probe		= asoc_simple_card_probe,
+	.probe = asoc_simple_card_probe,
 };
 
 module_platform_driver(asoc_simple_card);
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Fix some minor issues in simple card driver
  2014-04-24 11:13 [PATCH 0/3] Fix some minor issues in simple card driver Nicolin Chen
                   ` (2 preceding siblings ...)
  2014-04-24 11:14 ` [PATCH 3/3] ASoC: simple-card: Improve coding style Nicolin Chen
@ 2014-04-24 12:20 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2014-04-24 12:20 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: moinejf, alsa-devel, kuninori.morimoto.gx, tiwai, lgirdwood, jsarha


[-- Attachment #1.1: Type: text/plain, Size: 148 bytes --]

On Thu, Apr 24, 2014 at 07:13:57PM +0800, Nicolin Chen wrote:
> The series fixes one name limitation and code style problems.

Applied all, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] ASoC: simple-card: Drop node->name checking
  2014-04-24 11:13 ` [PATCH 1/3] ASoC: simple-card: Drop node->name checking Nicolin Chen
@ 2014-04-24 12:47   ` Jyri Sarha
  2014-04-24 13:03     ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Jyri Sarha @ 2014-04-24 12:47 UTC (permalink / raw)
  To: Nicolin Chen, broonie
  Cc: moinejf, alsa-devel, kuninori.morimoto.gx, tiwai, lgirdwood

On 04/24/2014 02:13 PM, Nicolin Chen wrote:
> The current simple-card driver limits the DT node name to "sound".
> Any of other names is forbidden while actually we should allow DT
> to pass other node names.
>
> And if this function is being called, the node must already have
> the compatible "simple-audio-card" in DTB. So there should be no
> need to check the name here.
>
> Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
> ---
>   sound/soc/generic/simple-card.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
> index 3f2e580..383a4a1 100644
> --- a/sound/soc/generic/simple-card.c
> +++ b/sound/soc/generic/simple-card.c
> @@ -156,8 +156,7 @@ static int simple_card_dai_link_of(struct device_node *node,
>   	char *prefix = "";
>   	int ret;
>
> -	if (!strcmp("sound", node->name))
> -		prefix = "simple-audio-card,";
> +	prefix = "simple-audio-card,";
>
>   	daifmt = snd_soc_of_parse_daifmt(node, prefix,
>   					 &bitclkmaster, &framemaster);
>

I think you have missed the point of selecting the prefix based on the 
node name.

Before the change the "simple-audio-card,"-prefix was only needed for 
dai-link properties and subnodes if the dai-link node was omitted in a 
single dai-link setup.

After your change the prefix is also needed for the properties and 
subnodes inside dai-link subnodes.

See the details in: Documentation/devicetree/bindings/sound/simple-card.txt

Maybe the implementation could have been more explicit, but I think the 
old behavior is more convenient. If we anyway decide to go with this 
change then at least the DT binding document should be updated.

Best regards,
Jyri

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] ASoC: simple-card: Drop node->name checking
  2014-04-24 12:47   ` Jyri Sarha
@ 2014-04-24 13:03     ` Mark Brown
  2014-04-24 13:05       ` Jyri Sarha
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2014-04-24 13:03 UTC (permalink / raw)
  To: Jyri Sarha
  Cc: moinejf, alsa-devel, kuninori.morimoto.gx, tiwai, lgirdwood,
	Nicolin Chen


[-- Attachment #1.1: Type: text/plain, Size: 779 bytes --]

On Thu, Apr 24, 2014 at 03:47:59PM +0300, Jyri Sarha wrote:
> On 04/24/2014 02:13 PM, Nicolin Chen wrote:

Please delete unneeded context from your mails...

> >-	if (!strcmp("sound", node->name))
> >-		prefix = "simple-audio-card,";
> >+	prefix = "simple-audio-card,";

> I think you have missed the point of selecting the prefix based on the node
> name.

...

> Maybe the implementation could have been more explicit, but I think the old
> behavior is more convenient. If we anyway decide to go with this change then
> at least the DT binding document should be updated.

Yes, the implementation needs to be *way* more explicit - I'd expect a
parameter/variable saying which level we're at depending on where we're
at in the parse rather than guessing based on the node name.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] ASoC: simple-card: Drop node->name checking
  2014-04-24 13:03     ` Mark Brown
@ 2014-04-24 13:05       ` Jyri Sarha
  0 siblings, 0 replies; 8+ messages in thread
From: Jyri Sarha @ 2014-04-24 13:05 UTC (permalink / raw)
  To: Mark Brown
  Cc: moinejf, alsa-devel, kuninori.morimoto.gx, tiwai, lgirdwood,
	Nicolin Chen

On 04/24/2014 04:03 PM, Mark Brown wrote:
> On Thu, Apr 24, 2014 at 03:47:59PM +0300, Jyri Sarha wrote:
>> On 04/24/2014 02:13 PM, Nicolin Chen wrote:
>
> Please delete unneeded context from your mails...
>
>>> -	if (!strcmp("sound", node->name))
>>> -		prefix = "simple-audio-card,";
>>> +	prefix = "simple-audio-card,";
>
>> I think you have missed the point of selecting the prefix based on the node
>> name.
>
> ...
>
>> Maybe the implementation could have been more explicit, but I think the old
>> behavior is more convenient. If we anyway decide to go with this change then
>> at least the DT binding document should be updated.
>
> Yes, the implementation needs to be *way* more explicit - I'd expect a
> parameter/variable saying which level we're at depending on where we're
> at in the parse rather than guessing based on the node name.
>

Ok, I'll come up with a patch soon.

Best regards,
Jyri

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-24 13:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-24 11:13 [PATCH 0/3] Fix some minor issues in simple card driver Nicolin Chen
2014-04-24 11:13 ` [PATCH 1/3] ASoC: simple-card: Drop node->name checking Nicolin Chen
2014-04-24 12:47   ` Jyri Sarha
2014-04-24 13:03     ` Mark Brown
2014-04-24 13:05       ` Jyri Sarha
2014-04-24 11:13 ` [PATCH 2/3] ASoC: simple-card: Simplify error msg in simple_card_dai_link_of() Nicolin Chen
2014-04-24 11:14 ` [PATCH 3/3] ASoC: simple-card: Improve coding style Nicolin Chen
2014-04-24 12:20 ` [PATCH 0/3] Fix some minor issues in simple card driver Mark Brown

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.