linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks
@ 2019-04-10 11:06 Viorel Suman
  2019-04-10 11:06 ` [PATCH v4 1/4] ASoC: fsl_audmix: remove "model" attribute Viorel Suman
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Viorel Suman @ 2019-04-10 11:06 UTC (permalink / raw)
  To: Timur Tabi, Nicolin Chen, Xiubo Li, Fabio Estevam, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Rob Herring, Mark Rutland,
	Takashi Iwai, Shawn Guo, Sascha Hauer, Julia Lawall
  Cc: Viorel Suman, Viorel Suman, Pengutronix Kernel Team,
	dl-linux-imx, alsa-devel, devicetree, linux-kernel, linuxppc-dev,
	linux-arm-kernel

The latest audmix patch-set (v5) had the "model" attribute removed as
requested by Nicolin Chen, but looks like (v4) version of DAI driver
reached "for-next" branch - fix this by removing "model" attribute.
Asside of this fix object reference leaks in machine probe reported by
Julia Lawall.

Viorel Suman (4):
  ASoC: fsl_audmix: remove "model" attribute
  ASoC: fsl_audmix: remove "model" attribute from DT document
  ASoC: imx-audmix: fix object reference leaks in probe
  ASoC: fsl_audmix: cache pdev->dev pointer

Changes since V1:
  a) Removed "model" attribute from dt-bindings documentation
  b) Adressed Daniel's comments

Changes since V2:
  a) Cache pdev->dev pointer in fsl_audmix probe as suggested by Nicolin

Changes since V3:
  a) Use subject lines matching the style for the subsystem.

 .../devicetree/bindings/sound/fsl,audmix.txt       |  4 --
 sound/soc/fsl/fsl_audmix.c                         | 60 +++++++++++-----------
 sound/soc/fsl/imx-audmix.c                         |  4 ++
 3 files changed, 35 insertions(+), 33 deletions(-)

-- 
2.7.4


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

* [PATCH v4 1/4] ASoC: fsl_audmix: remove "model" attribute
  2019-04-10 11:06 [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks Viorel Suman
@ 2019-04-10 11:06 ` Viorel Suman
  2019-04-10 11:06 ` [PATCH v4 2/4] ASoC: fsl_audmix: remove "model" attribute from DT document Viorel Suman
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Viorel Suman @ 2019-04-10 11:06 UTC (permalink / raw)
  To: Timur Tabi, Nicolin Chen, Xiubo Li, Fabio Estevam, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Rob Herring, Mark Rutland,
	Takashi Iwai, Shawn Guo, Sascha Hauer, Julia Lawall
  Cc: Viorel Suman, Viorel Suman, Pengutronix Kernel Team,
	dl-linux-imx, alsa-devel, devicetree, linux-kernel, linuxppc-dev,
	linux-arm-kernel

Use "of_device_id.data" to specify the machine driver
instead of "model" DTS attribute.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
 sound/soc/fsl/fsl_audmix.c | 43 +++++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c
index dabde03..dc802d5 100644
--- a/sound/soc/fsl/fsl_audmix.c
+++ b/sound/soc/fsl/fsl_audmix.c
@@ -445,13 +445,29 @@ static const struct regmap_config fsl_audmix_regmap_config = {
 	.cache_type = REGCACHE_FLAT,
 };
 
+static const struct of_device_id fsl_audmix_ids[] = {
+	{
+		.compatible = "fsl,imx8qm-audmix",
+		.data = "imx-audmix",
+	},
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, fsl_audmix_ids);
+
 static int fsl_audmix_probe(struct platform_device *pdev)
 {
 	struct fsl_audmix *priv;
 	struct resource *res;
+	const char *mdrv;
+	const struct of_device_id *of_id;
 	void __iomem *regs;
 	int ret;
-	const char *sprop;
+
+	of_id = of_match_device(fsl_audmix_ids, &pdev->dev);
+	if (!of_id || !of_id->data)
+		return -EINVAL;
+
+	mdrv = of_id->data;
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -487,19 +503,12 @@ static int fsl_audmix_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	sprop = of_get_property(pdev->dev.of_node, "model", NULL);
-	if (sprop) {
-		priv->pdev = platform_device_register_data(&pdev->dev, sprop, 0,
-							   NULL, 0);
-		if (IS_ERR(priv->pdev)) {
-			ret = PTR_ERR(priv->pdev);
-			dev_err(&pdev->dev,
-				"failed to register platform %s: %d\n", sprop,
-				 ret);
-		}
-	} else {
-		dev_err(&pdev->dev, "[model] attribute missing.\n");
-		ret = -EINVAL;
+	priv->pdev = platform_device_register_data(&pdev->dev, mdrv, 0, NULL,
+						   0);
+	if (IS_ERR(priv->pdev)) {
+		ret = PTR_ERR(priv->pdev);
+		dev_err(&pdev->dev, "failed to register platform %s: %d\n",
+			mdrv, ret);
 	}
 
 	return ret;
@@ -553,12 +562,6 @@ static const struct dev_pm_ops fsl_audmix_pm = {
 				pm_runtime_force_resume)
 };
 
-static const struct of_device_id fsl_audmix_ids[] = {
-	{ .compatible = "fsl,imx8qm-audmix", },
-	{ /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(of, fsl_audmix_ids);
-
 static struct platform_driver fsl_audmix_driver = {
 	.probe = fsl_audmix_probe,
 	.remove = fsl_audmix_remove,
-- 
2.7.4


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

* [PATCH v4 2/4] ASoC: fsl_audmix: remove "model" attribute from DT document
  2019-04-10 11:06 [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks Viorel Suman
  2019-04-10 11:06 ` [PATCH v4 1/4] ASoC: fsl_audmix: remove "model" attribute Viorel Suman
@ 2019-04-10 11:06 ` Viorel Suman
  2019-04-10 14:26   ` Fabio Estevam
  2019-04-10 11:06 ` [PATCH v4 3/4] ASoC: imx-audmix: fix object reference leaks in probe Viorel Suman
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Viorel Suman @ 2019-04-10 11:06 UTC (permalink / raw)
  To: Timur Tabi, Nicolin Chen, Xiubo Li, Fabio Estevam, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Rob Herring, Mark Rutland,
	Takashi Iwai, Shawn Guo, Sascha Hauer, Julia Lawall
  Cc: Viorel Suman, Viorel Suman, Pengutronix Kernel Team,
	dl-linux-imx, alsa-devel, devicetree, linux-kernel, linuxppc-dev,
	linux-arm-kernel

Remove "model" attribute from fsl_audmix DT document.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
 Documentation/devicetree/bindings/sound/fsl,audmix.txt | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/fsl,audmix.txt b/Documentation/devicetree/bindings/sound/fsl,audmix.txt
index 45f807e..840b7e0 100644
--- a/Documentation/devicetree/bindings/sound/fsl,audmix.txt
+++ b/Documentation/devicetree/bindings/sound/fsl,audmix.txt
@@ -38,9 +38,6 @@ Device driver required properties:
 			  to SAI interfaces to be provided, the first SAI in the
 			  list being used to route the AUDMIX output.
 
-  - model		: Must contain machine driver name which will configure
-			  and instantiate the appropriate audio card.
-
 Device driver configuration example:
 ======================================
   audmix: audmix@59840000 {
@@ -50,5 +47,4 @@ Device driver configuration example:
     clock-names = "ipg";
     power-domains = <&pd_audmix>;
     dais = <&sai4>, <&sai5>;
-    model = "imx-audmix";
   };
-- 
2.7.4


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

* [PATCH v4 3/4] ASoC: imx-audmix: fix object reference leaks in probe
  2019-04-10 11:06 [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks Viorel Suman
  2019-04-10 11:06 ` [PATCH v4 1/4] ASoC: fsl_audmix: remove "model" attribute Viorel Suman
  2019-04-10 11:06 ` [PATCH v4 2/4] ASoC: fsl_audmix: remove "model" attribute from DT document Viorel Suman
@ 2019-04-10 11:06 ` Viorel Suman
  2019-04-10 14:26   ` Fabio Estevam
  2019-04-10 11:06 ` [PATCH v4 4/4] ASoC: fsl_audmix: cache pdev->dev pointer Viorel Suman
  2019-04-10 11:12 ` [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks Mark Brown
  4 siblings, 1 reply; 10+ messages in thread
From: Viorel Suman @ 2019-04-10 11:06 UTC (permalink / raw)
  To: Timur Tabi, Nicolin Chen, Xiubo Li, Fabio Estevam, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Rob Herring, Mark Rutland,
	Takashi Iwai, Shawn Guo, Sascha Hauer, Julia Lawall
  Cc: Viorel Suman, Viorel Suman, Pengutronix Kernel Team,
	dl-linux-imx, alsa-devel, devicetree, linux-kernel, linuxppc-dev,
	linux-arm-kernel

Release the reference to the underlying device taken
by of_find_device_by_node() call.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reported-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
 sound/soc/fsl/imx-audmix.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c
index 7983bd3..9aaf3e5 100644
--- a/sound/soc/fsl/imx-audmix.c
+++ b/sound/soc/fsl/imx-audmix.c
@@ -171,6 +171,7 @@ static int imx_audmix_probe(struct platform_device *pdev)
 			np->full_name);
 		return -EINVAL;
 	}
+	put_device(&audmix_pdev->dev);
 
 	num_dai = of_count_phandle_with_args(audmix_np, "dais", NULL);
 	if (num_dai != FSL_AUDMIX_MAX_DAIS) {
@@ -216,6 +217,7 @@ static int imx_audmix_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev, "failed to find SAI platform device\n");
 			return -EINVAL;
 		}
+		put_device(&cpu_pdev->dev);
 
 		dai_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s%s",
 					  fe_name_pref, args.np->full_name + 1);
@@ -280,6 +282,8 @@ static int imx_audmix_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failed to find SAI platform device\n");
 		return -EINVAL;
 	}
+	put_device(&cpu_pdev->dev);
+
 	priv->cpu_mclk = devm_clk_get(&cpu_pdev->dev, "mclk1");
 	if (IS_ERR(priv->cpu_mclk)) {
 		ret = PTR_ERR(priv->cpu_mclk);
-- 
2.7.4


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

* [PATCH v4 4/4] ASoC: fsl_audmix: cache pdev->dev pointer
  2019-04-10 11:06 [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks Viorel Suman
                   ` (2 preceding siblings ...)
  2019-04-10 11:06 ` [PATCH v4 3/4] ASoC: imx-audmix: fix object reference leaks in probe Viorel Suman
@ 2019-04-10 11:06 ` Viorel Suman
  2019-04-11 20:21   ` Nicolin Chen
  2019-05-02  2:18   ` Applied "ASoC: fsl_audmix: cache pdev->dev pointer" to the asoc tree Mark Brown
  2019-04-10 11:12 ` [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks Mark Brown
  4 siblings, 2 replies; 10+ messages in thread
From: Viorel Suman @ 2019-04-10 11:06 UTC (permalink / raw)
  To: Timur Tabi, Nicolin Chen, Xiubo Li, Fabio Estevam, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Rob Herring, Mark Rutland,
	Takashi Iwai, Shawn Guo, Sascha Hauer, Julia Lawall
  Cc: Viorel Suman, Viorel Suman, Pengutronix Kernel Team,
	dl-linux-imx, alsa-devel, devicetree, linux-kernel, linuxppc-dev,
	linux-arm-kernel

There should be no trouble to understand dev = pdev->dev.
This can save some space to have more print info or save
some wrapped lines.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
 sound/soc/fsl/fsl_audmix.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c
index dc802d5..3897a54 100644
--- a/sound/soc/fsl/fsl_audmix.c
+++ b/sound/soc/fsl/fsl_audmix.c
@@ -456,6 +456,7 @@ MODULE_DEVICE_TABLE(of, fsl_audmix_ids);
 
 static int fsl_audmix_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct fsl_audmix *priv;
 	struct resource *res;
 	const char *mdrv;
@@ -463,52 +464,50 @@ static int fsl_audmix_probe(struct platform_device *pdev)
 	void __iomem *regs;
 	int ret;
 
-	of_id = of_match_device(fsl_audmix_ids, &pdev->dev);
+	of_id = of_match_device(fsl_audmix_ids, dev);
 	if (!of_id || !of_id->data)
 		return -EINVAL;
 
 	mdrv = of_id->data;
 
-	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
 	/* Get the addresses */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	regs = devm_ioremap_resource(&pdev->dev, res);
+	regs = devm_ioremap_resource(dev, res);
 	if (IS_ERR(regs))
 		return PTR_ERR(regs);
 
-	priv->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "ipg", regs,
+	priv->regmap = devm_regmap_init_mmio_clk(dev, "ipg", regs,
 						 &fsl_audmix_regmap_config);
 	if (IS_ERR(priv->regmap)) {
-		dev_err(&pdev->dev, "failed to init regmap\n");
+		dev_err(dev, "failed to init regmap\n");
 		return PTR_ERR(priv->regmap);
 	}
 
-	priv->ipg_clk = devm_clk_get(&pdev->dev, "ipg");
+	priv->ipg_clk = devm_clk_get(dev, "ipg");
 	if (IS_ERR(priv->ipg_clk)) {
-		dev_err(&pdev->dev, "failed to get ipg clock\n");
+		dev_err(dev, "failed to get ipg clock\n");
 		return PTR_ERR(priv->ipg_clk);
 	}
 
 	platform_set_drvdata(pdev, priv);
-	pm_runtime_enable(&pdev->dev);
+	pm_runtime_enable(dev);
 
-	ret = devm_snd_soc_register_component(&pdev->dev, &fsl_audmix_component,
+	ret = devm_snd_soc_register_component(dev, &fsl_audmix_component,
 					      fsl_audmix_dai,
 					      ARRAY_SIZE(fsl_audmix_dai));
 	if (ret) {
-		dev_err(&pdev->dev, "failed to register ASoC DAI\n");
+		dev_err(dev, "failed to register ASoC DAI\n");
 		return ret;
 	}
 
-	priv->pdev = platform_device_register_data(&pdev->dev, mdrv, 0, NULL,
-						   0);
+	priv->pdev = platform_device_register_data(dev, mdrv, 0, NULL, 0);
 	if (IS_ERR(priv->pdev)) {
 		ret = PTR_ERR(priv->pdev);
-		dev_err(&pdev->dev, "failed to register platform %s: %d\n",
-			mdrv, ret);
+		dev_err(dev, "failed to register platform %s: %d\n", mdrv, ret);
 	}
 
 	return ret;
-- 
2.7.4


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

* Re: [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks
  2019-04-10 11:06 [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks Viorel Suman
                   ` (3 preceding siblings ...)
  2019-04-10 11:06 ` [PATCH v4 4/4] ASoC: fsl_audmix: cache pdev->dev pointer Viorel Suman
@ 2019-04-10 11:12 ` Mark Brown
  4 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2019-04-10 11:12 UTC (permalink / raw)
  To: Viorel Suman
  Cc: Timur Tabi, Nicolin Chen, Xiubo Li, Fabio Estevam, Liam Girdwood,
	Jaroslav Kysela, Rob Herring, Mark Rutland, Takashi Iwai,
	Shawn Guo, Sascha Hauer, Julia Lawall, Viorel Suman,
	Pengutronix Kernel Team, dl-linux-imx, alsa-devel, devicetree,
	linux-kernel, linuxppc-dev, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

On Wed, Apr 10, 2019 at 11:06:35AM +0000, Viorel Suman wrote:
> The latest audmix patch-set (v5) had the "model" attribute removed as
> requested by Nicolin Chen, but looks like (v4) version of DAI driver
> reached "for-next" branch - fix this by removing "model" attribute.
> Asside of this fix object reference leaks in machine probe reported by
> Julia Lawall.

This is the second version sent out in the past hour or so :(  Please
allow a bit more time for review and comments, people might still be
looking at the earlier versions so any additional changes they spot will
result in yet another resend and more noise in people's inboxes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v4 2/4] ASoC: fsl_audmix: remove "model" attribute from DT document
  2019-04-10 11:06 ` [PATCH v4 2/4] ASoC: fsl_audmix: remove "model" attribute from DT document Viorel Suman
@ 2019-04-10 14:26   ` Fabio Estevam
  0 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2019-04-10 14:26 UTC (permalink / raw)
  To: Viorel Suman
  Cc: Timur Tabi, Nicolin Chen, Xiubo Li, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Rob Herring, Mark Rutland, Takashi Iwai,
	Shawn Guo, Sascha Hauer, Julia Lawall, Viorel Suman,
	Pengutronix Kernel Team, dl-linux-imx, alsa-devel, devicetree,
	linux-kernel, linuxppc-dev, linux-arm-kernel

On Wed, Apr 10, 2019 at 8:06 AM Viorel Suman <viorel.suman@nxp.com> wrote:
>
> Remove "model" attribute from fsl_audmix DT document.

Please provide the reasoning.

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

* Re: [PATCH v4 3/4] ASoC: imx-audmix: fix object reference leaks in probe
  2019-04-10 11:06 ` [PATCH v4 3/4] ASoC: imx-audmix: fix object reference leaks in probe Viorel Suman
@ 2019-04-10 14:26   ` Fabio Estevam
  0 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2019-04-10 14:26 UTC (permalink / raw)
  To: Viorel Suman
  Cc: Timur Tabi, Nicolin Chen, Xiubo Li, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Rob Herring, Mark Rutland, Takashi Iwai,
	Shawn Guo, Sascha Hauer, Julia Lawall, Viorel Suman,
	Pengutronix Kernel Team, dl-linux-imx, alsa-devel, devicetree,
	linux-kernel, linuxppc-dev, linux-arm-kernel

On Wed, Apr 10, 2019 at 8:06 AM Viorel Suman <viorel.suman@nxp.com> wrote:
>
> Release the reference to the underlying device taken
> by of_find_device_by_node() call.
>
> Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
> Reported-by: Julia Lawall <Julia.Lawall@lip6.fr>
> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>

Please provide a Fixes tag.

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

* Re: [PATCH v4 4/4] ASoC: fsl_audmix: cache pdev->dev pointer
  2019-04-10 11:06 ` [PATCH v4 4/4] ASoC: fsl_audmix: cache pdev->dev pointer Viorel Suman
@ 2019-04-11 20:21   ` Nicolin Chen
  2019-05-02  2:18   ` Applied "ASoC: fsl_audmix: cache pdev->dev pointer" to the asoc tree Mark Brown
  1 sibling, 0 replies; 10+ messages in thread
From: Nicolin Chen @ 2019-04-11 20:21 UTC (permalink / raw)
  To: Viorel Suman
  Cc: Timur Tabi, Xiubo Li, Fabio Estevam, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Rob Herring, Mark Rutland, Takashi Iwai,
	Shawn Guo, Sascha Hauer, Julia Lawall, Viorel Suman,
	Pengutronix Kernel Team, dl-linux-imx, alsa-devel, devicetree,
	linux-kernel, linuxppc-dev, linux-arm-kernel

On Wed, Apr 10, 2019 at 11:06:39AM +0000, Viorel Suman wrote:
> There should be no trouble to understand dev = pdev->dev.
> This can save some space to have more print info or save
> some wrapped lines.

Change looks fine. Ack.

> Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
> Suggested-by: Nicolin Chen <nicoleotsuka@gmail.com>

I think usually Suggested-by comes above Signed-off-by.

This was originally in your change already, so you can replace:
-Suggested-by: Nicolin Chen <nicoleotsuka@gmail.com>
-Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>

Just a chance for it to get resent without being a noise :)

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

* Applied "ASoC: fsl_audmix: cache pdev->dev pointer" to the asoc tree
  2019-04-10 11:06 ` [PATCH v4 4/4] ASoC: fsl_audmix: cache pdev->dev pointer Viorel Suman
  2019-04-11 20:21   ` Nicolin Chen
@ 2019-05-02  2:18   ` Mark Brown
  1 sibling, 0 replies; 10+ messages in thread
From: Mark Brown @ 2019-05-02  2:18 UTC (permalink / raw)
  To: Viorel Suman
  Cc: alsa-devel, alsa-devel, devicetree, dl-linux-imx, Fabio Estevam,
	Jaroslav Kysela, Julia Lawall, Liam Girdwood, linux-arm-kernel,
	linux-kernel, linuxppc-dev, Mark Brown, Mark Rutland,
	Nicolin Chen, Pengutronix Kernel Team, Rob Herring, Sascha Hauer,
	Shawn Guo, Takashi Iwai, Timur Tabi, Viorel Suman, Xiubo Li

The patch

   ASoC: fsl_audmix: cache pdev->dev pointer

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 62be484f7ad8443c393293a415392fbf3190c864 Mon Sep 17 00:00:00 2001
From: Viorel Suman <viorel.suman@nxp.com>
Date: Wed, 10 Apr 2019 11:06:39 +0000
Subject: [PATCH] ASoC: fsl_audmix: cache pdev->dev pointer

There should be no trouble to understand dev = pdev->dev.
This can save some space to have more print info or save
some wrapped lines.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/fsl/fsl_audmix.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c
index dc802d5c4ccd..3897a54a11fe 100644
--- a/sound/soc/fsl/fsl_audmix.c
+++ b/sound/soc/fsl/fsl_audmix.c
@@ -456,6 +456,7 @@ MODULE_DEVICE_TABLE(of, fsl_audmix_ids);
 
 static int fsl_audmix_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct fsl_audmix *priv;
 	struct resource *res;
 	const char *mdrv;
@@ -463,52 +464,50 @@ static int fsl_audmix_probe(struct platform_device *pdev)
 	void __iomem *regs;
 	int ret;
 
-	of_id = of_match_device(fsl_audmix_ids, &pdev->dev);
+	of_id = of_match_device(fsl_audmix_ids, dev);
 	if (!of_id || !of_id->data)
 		return -EINVAL;
 
 	mdrv = of_id->data;
 
-	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
 	/* Get the addresses */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	regs = devm_ioremap_resource(&pdev->dev, res);
+	regs = devm_ioremap_resource(dev, res);
 	if (IS_ERR(regs))
 		return PTR_ERR(regs);
 
-	priv->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "ipg", regs,
+	priv->regmap = devm_regmap_init_mmio_clk(dev, "ipg", regs,
 						 &fsl_audmix_regmap_config);
 	if (IS_ERR(priv->regmap)) {
-		dev_err(&pdev->dev, "failed to init regmap\n");
+		dev_err(dev, "failed to init regmap\n");
 		return PTR_ERR(priv->regmap);
 	}
 
-	priv->ipg_clk = devm_clk_get(&pdev->dev, "ipg");
+	priv->ipg_clk = devm_clk_get(dev, "ipg");
 	if (IS_ERR(priv->ipg_clk)) {
-		dev_err(&pdev->dev, "failed to get ipg clock\n");
+		dev_err(dev, "failed to get ipg clock\n");
 		return PTR_ERR(priv->ipg_clk);
 	}
 
 	platform_set_drvdata(pdev, priv);
-	pm_runtime_enable(&pdev->dev);
+	pm_runtime_enable(dev);
 
-	ret = devm_snd_soc_register_component(&pdev->dev, &fsl_audmix_component,
+	ret = devm_snd_soc_register_component(dev, &fsl_audmix_component,
 					      fsl_audmix_dai,
 					      ARRAY_SIZE(fsl_audmix_dai));
 	if (ret) {
-		dev_err(&pdev->dev, "failed to register ASoC DAI\n");
+		dev_err(dev, "failed to register ASoC DAI\n");
 		return ret;
 	}
 
-	priv->pdev = platform_device_register_data(&pdev->dev, mdrv, 0, NULL,
-						   0);
+	priv->pdev = platform_device_register_data(dev, mdrv, 0, NULL, 0);
 	if (IS_ERR(priv->pdev)) {
 		ret = PTR_ERR(priv->pdev);
-		dev_err(&pdev->dev, "failed to register platform %s: %d\n",
-			mdrv, ret);
+		dev_err(dev, "failed to register platform %s: %d\n", mdrv, ret);
 	}
 
 	return ret;
-- 
2.20.1


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

end of thread, other threads:[~2019-05-02  2:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-10 11:06 [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks Viorel Suman
2019-04-10 11:06 ` [PATCH v4 1/4] ASoC: fsl_audmix: remove "model" attribute Viorel Suman
2019-04-10 11:06 ` [PATCH v4 2/4] ASoC: fsl_audmix: remove "model" attribute from DT document Viorel Suman
2019-04-10 14:26   ` Fabio Estevam
2019-04-10 11:06 ` [PATCH v4 3/4] ASoC: imx-audmix: fix object reference leaks in probe Viorel Suman
2019-04-10 14:26   ` Fabio Estevam
2019-04-10 11:06 ` [PATCH v4 4/4] ASoC: fsl_audmix: cache pdev->dev pointer Viorel Suman
2019-04-11 20:21   ` Nicolin Chen
2019-05-02  2:18   ` Applied "ASoC: fsl_audmix: cache pdev->dev pointer" to the asoc tree Mark Brown
2019-04-10 11:12 ` [PATCH v4 0/4] ASoC: fsl: audmix: remove "model" attribute and fix ref leaks 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).