linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: Use of_node_name_eq for node name comparisons
@ 2018-12-05 19:50 Rob Herring
  2018-12-06  1:30 ` [alsa-devel] " Kuninori Morimoto
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rob Herring @ 2018-12-05 19:50 UTC (permalink / raw)
  To: devicetree, linux-kernel
  Cc: Timur Tabi, Nicolin Chen, Xiubo Li, Fabio Estevam, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	linuxppc-dev

Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.

For the FSL ASoC card, the full node names appear to be "ssi", "esai",
and "sai", so there's not any reason to use strstr and of_node_name_eq
can be used instead.

Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
 sound/soc/fsl/fsl-asoc-card.c       | 6 +++---
 sound/soc/generic/simple-scu-card.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 44433b20435c..81f2fe2c6d23 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -571,17 +571,17 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
 	}
 
 	/* Common settings for corresponding Freescale CPU DAI driver */
-	if (strstr(cpu_np->name, "ssi")) {
+	if (of_node_name_eq(cpu_np, "ssi")) {
 		/* Only SSI needs to configure AUDMUX */
 		ret = fsl_asoc_card_audmux_init(np, priv);
 		if (ret) {
 			dev_err(&pdev->dev, "failed to init audmux\n");
 			goto asrc_fail;
 		}
-	} else if (strstr(cpu_np->name, "esai")) {
+	} else if (of_node_name_eq(cpu_np, "esai")) {
 		priv->cpu_priv.sysclk_id[1] = ESAI_HCKT_EXTAL;
 		priv->cpu_priv.sysclk_id[0] = ESAI_HCKR_EXTAL;
-	} else if (strstr(cpu_np->name, "sai")) {
+	} else if (of_node_name_eq(cpu_np, "sai")) {
 		priv->cpu_priv.sysclk_id[1] = FSL_SAI_CLK_MAST1;
 		priv->cpu_priv.sysclk_id[0] = FSL_SAI_CLK_MAST1;
 	}
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index 85b46f0eae0f..e9a1acffcf5b 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -216,7 +216,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
 	i = 0;
 	for_each_child_of_node(node, np) {
 		is_fe = false;
-		if (strcmp(np->name, PREFIX "cpu") == 0)
+		if (of_node_name_eq(np, PREFIX "cpu"))
 			is_fe = true;
 
 		ret = asoc_simple_card_dai_link_of(np, priv, daifmt, i, is_fe);
-- 
2.19.1


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

* Re: [alsa-devel] [PATCH] ASoC: Use of_node_name_eq for node name comparisons
  2018-12-05 19:50 [PATCH] ASoC: Use of_node_name_eq for node name comparisons Rob Herring
@ 2018-12-06  1:30 ` Kuninori Morimoto
  2018-12-06  1:53 ` Nicolin Chen
  2018-12-06 20:26 ` Applied "ASoC: Use of_node_name_eq for node name comparisons" to the asoc tree Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2018-12-06  1:30 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-kernel, alsa-devel, Timur Tabi, Xiubo Li,
	Takashi Iwai, Liam Girdwood, Nicolin Chen, Mark Brown,
	Fabio Estevam, linuxppc-dev


Hi Rob

> Convert string compares of DT node names to use of_node_name_eq helper
> instead. This removes direct access to the node name pointer.
> 
> For the FSL ASoC card, the full node names appear to be "ssi", "esai",
> and "sai", so there's not any reason to use strstr and of_node_name_eq
> can be used instead.

I guess this patch is for FSL ?

> ---
>  sound/soc/fsl/fsl-asoc-card.c       | 6 +++---
>  sound/soc/generic/simple-scu-card.c | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)

But, this patch is including simple-scu-card.
Is this miss ?


Best regards
---
Kuninori Morimoto

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

* Re: [PATCH] ASoC: Use of_node_name_eq for node name comparisons
  2018-12-05 19:50 [PATCH] ASoC: Use of_node_name_eq for node name comparisons Rob Herring
  2018-12-06  1:30 ` [alsa-devel] " Kuninori Morimoto
@ 2018-12-06  1:53 ` Nicolin Chen
  2018-12-06 13:34   ` Rob Herring
  2018-12-06 20:26 ` Applied "ASoC: Use of_node_name_eq for node name comparisons" to the asoc tree Mark Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Nicolin Chen @ 2018-12-06  1:53 UTC (permalink / raw)
  To: Rob Herring, Fabio Estevam
  Cc: devicetree, LKML, Timur Tabi, Xiubo Li, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, Linux-ALSA,
	linuxppc-dev

Hi Rob,

On Thu, Dec 6, 2018 at 3:51 AM Rob Herring <robh@kernel.org> wrote:
>
> Convert string compares of DT node names to use of_node_name_eq helper
> instead. This removes direct access to the node name pointer.
>
> For the FSL ASoC card, the full node names appear to be "ssi", "esai",
> and "sai", so there's not any reason to use strstr and of_node_name_eq

I am not quite sure about the replacement of strstr.
IIRC, a node name in fsl dts might appear to be "ssi@xxxx".

I am currently out of town so cannot verify the patch.

Fabio, would it be possible for you to run a boot test?

Thanks
Nicolin

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

* Re: [PATCH] ASoC: Use of_node_name_eq for node name comparisons
  2018-12-06  1:53 ` Nicolin Chen
@ 2018-12-06 13:34   ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2018-12-06 13:34 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: Fabio Estevam, devicetree, linux-kernel, Timur Tabi, Xiubo Li,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Linux-ALSA, linuxppc-dev

On Wed, Dec 5, 2018 at 7:53 PM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
>
> Hi Rob,
>
> On Thu, Dec 6, 2018 at 3:51 AM Rob Herring <robh@kernel.org> wrote:
> >
> > Convert string compares of DT node names to use of_node_name_eq helper
> > instead. This removes direct access to the node name pointer.
> >
> > For the FSL ASoC card, the full node names appear to be "ssi", "esai",
> > and "sai", so there's not any reason to use strstr and of_node_name_eq
>
> I am not quite sure about the replacement of strstr.
> IIRC, a node name in fsl dts might appear to be "ssi@xxxx".

That will work fine. Unit-addresses are not part of the node name for
the comparison.

> I am currently out of town so cannot verify the patch.
>
> Fabio, would it be possible for you to run a boot test?
>
> Thanks
> Nicolin

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

* Applied "ASoC: Use of_node_name_eq for node name comparisons" to the asoc tree
  2018-12-05 19:50 [PATCH] ASoC: Use of_node_name_eq for node name comparisons Rob Herring
  2018-12-06  1:30 ` [alsa-devel] " Kuninori Morimoto
  2018-12-06  1:53 ` Nicolin Chen
@ 2018-12-06 20:26 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2018-12-06 20:26 UTC (permalink / raw)
  To: Rob Herring
  Cc: Timur Tabi, Nicolin Chen, Xiubo Li, Fabio Estevam, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	linuxppc-dev, Mark Brown, devicetree, linux-kernel, alsa-devel,
	Timur Tabi, Xiubo Li, Takashi Iwai, Liam Girdwood, Nicolin Chen,
	Mark Brown, Fabio Estevam, linuxppc-dev, alsa-devel

The patch

   ASoC: Use of_node_name_eq for node name comparisons

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 1d52a74ea2300158f87196fa381cde52d98cf4e4 Mon Sep 17 00:00:00 2001
From: Rob Herring <robh@kernel.org>
Date: Wed, 5 Dec 2018 13:50:49 -0600
Subject: [PATCH] ASoC: Use of_node_name_eq for node name comparisons

Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.

For the FSL ASoC card, the full node names appear to be "ssi", "esai",
and "sai", so there's not any reason to use strstr and of_node_name_eq
can be used instead.

Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/fsl/fsl-asoc-card.c       | 6 +++---
 sound/soc/generic/simple-scu-card.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 44433b20435c..81f2fe2c6d23 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -571,17 +571,17 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
 	}
 
 	/* Common settings for corresponding Freescale CPU DAI driver */
-	if (strstr(cpu_np->name, "ssi")) {
+	if (of_node_name_eq(cpu_np, "ssi")) {
 		/* Only SSI needs to configure AUDMUX */
 		ret = fsl_asoc_card_audmux_init(np, priv);
 		if (ret) {
 			dev_err(&pdev->dev, "failed to init audmux\n");
 			goto asrc_fail;
 		}
-	} else if (strstr(cpu_np->name, "esai")) {
+	} else if (of_node_name_eq(cpu_np, "esai")) {
 		priv->cpu_priv.sysclk_id[1] = ESAI_HCKT_EXTAL;
 		priv->cpu_priv.sysclk_id[0] = ESAI_HCKR_EXTAL;
-	} else if (strstr(cpu_np->name, "sai")) {
+	} else if (of_node_name_eq(cpu_np, "sai")) {
 		priv->cpu_priv.sysclk_id[1] = FSL_SAI_CLK_MAST1;
 		priv->cpu_priv.sysclk_id[0] = FSL_SAI_CLK_MAST1;
 	}
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index 7ae1901b2f85..656abe2015e1 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -223,7 +223,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
 	i = 0;
 	for_each_child_of_node(node, np) {
 		is_fe = false;
-		if (strcmp(np->name, PREFIX "cpu") == 0)
+		if (of_node_name_eq(np, PREFIX "cpu"))
 			is_fe = true;
 
 		ret = asoc_simple_card_dai_link_of(np, priv, daifmt, i, is_fe);
-- 
2.19.0.rc2


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

end of thread, other threads:[~2018-12-06 20:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05 19:50 [PATCH] ASoC: Use of_node_name_eq for node name comparisons Rob Herring
2018-12-06  1:30 ` [alsa-devel] " Kuninori Morimoto
2018-12-06  1:53 ` Nicolin Chen
2018-12-06 13:34   ` Rob Herring
2018-12-06 20:26 ` Applied "ASoC: Use of_node_name_eq for node name comparisons" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).