diff mbox series

[v2,1/3] ASoC: fsl_audmix: remove "model" attribute

Message ID 1554809242-27475-2-git-send-email-viorel.suman@nxp.com
State Superseded, archived
Headers show
Series ASoC: fsl: audmix: remove "model" attribute and fix ref leaks | expand

Checks

Context Check Description
robh/checkpatch warning "total: 0 errors, 1 warnings, 67 lines checked"

Commit Message

Viorel Suman April 9, 2019, 11:27 a.m. UTC
Use "of_device_id.data" to specify the machine driver
instead of "model" DTS attribute.

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

Comments

Nicolin Chen April 10, 2019, 4:29 a.m. UTC | #1
On Tue, Apr 09, 2019 at 11:27:39AM +0000, Viorel Suman wrote:
> 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(-)

> +	priv->pdev = platform_device_register_data(&pdev->dev, mdrv, 0, NULL,
> +						   0);

Would you please send a separate patch to replace "pdev->dev"?
Daniel Baluta April 10, 2019, 6:20 a.m. UTC | #2
Hi Nicolin,

On Wed, Apr 10, 2019 at 7:30 AM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
>
> On Tue, Apr 09, 2019 at 11:27:39AM +0000, Viorel Suman wrote:
> > 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(-)
>
> > +     priv->pdev = platform_device_register_data(&pdev->dev, mdrv, 0, NULL,
> > +                                                0);
>
> Would you please send a separate patch to replace "pdev->dev"?

I am not sure exactly how to explain this change in the commit message. It does
make code easier to read and avoids dereferencing pdev pointer each time.

Is it enough for commit description?

thanks,
Daniel.
Nicolin Chen April 10, 2019, 6:37 a.m. UTC | #3
On Wed, Apr 10, 2019 at 09:20:29AM +0300, Daniel Baluta wrote:
> Hi Nicolin,
> 
> On Wed, Apr 10, 2019 at 7:30 AM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> >
> > On Tue, Apr 09, 2019 at 11:27:39AM +0000, Viorel Suman wrote:
> > > 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(-)
> >
> > > +     priv->pdev = platform_device_register_data(&pdev->dev, mdrv, 0, NULL,
> > > +                                                0);
> >
> > Would you please send a separate patch to replace "pdev->dev"?
> 
> I am not sure exactly how to explain this change in the commit message. It does
> make code easier to read and avoids dereferencing pdev pointer each time.
> 
> Is it enough for commit description?

You mean this? https://lore.kernel.org/patchwork/patch/862610/
Daniel Baluta April 10, 2019, 6:48 a.m. UTC | #4
On Wed, Apr 10, 2019 at 9:37 AM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
>
> On Wed, Apr 10, 2019 at 09:20:29AM +0300, Daniel Baluta wrote:
> > Hi Nicolin,
> >
> > On Wed, Apr 10, 2019 at 7:30 AM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> > >
> > > On Tue, Apr 09, 2019 at 11:27:39AM +0000, Viorel Suman wrote:
> > > > 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(-)
> > >
> > > > +     priv->pdev = platform_device_register_data(&pdev->dev, mdrv, 0, NULL,
> > > > +                                                0);
> > >
> > > Would you please send a separate patch to replace "pdev->dev"?
> >
> > I am not sure exactly how to explain this change in the commit message. It does
> > make code easier to read and avoids dereferencing pdev pointer each time.
> >
> > Is it enough for commit description?
>
> You mean this? https://lore.kernel.org/patchwork/patch/862610/

Yes! Thanks.
Viorel Suman April 10, 2019, 10:34 a.m. UTC | #5
Hi Nicolin,

On Ma, 2019-04-09 at 21:29 -0700, Nicolin Chen wrote:
> WARNING: This email was created outside of NXP. DO NOT CLICK links or
> attachments unless you recognize the sender and know the content is
> safe.
> 
> 
> 
> On Tue, Apr 09, 2019 at 11:27:39AM +0000, Viorel Suman wrote:
> > 
> > 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(-)
> > 
> > +     priv->pdev = platform_device_register_data(&pdev->dev, mdrv,
> > 0, NULL,
> > +                                                0);
> Would you please send a separate patch to replace "pdev->dev"?

Thank you for review. Yes, will send V3.

/Viorel
Nicolin Chen April 10, 2019, 5:51 p.m. UTC | #6
On Wed, Apr 10, 2019 at 10:34:57AM +0000, Viorel Suman wrote:
> Hi Nicolin,
> 
> On Ma, 2019-04-09 at 21:29 -0700, Nicolin Chen wrote:
> > WARNING: This email was created outside of NXP. DO NOT CLICK links or
> > attachments unless you recognize the sender and know the content is
> > safe.
> > 
> > 
> > 
> > On Tue, Apr 09, 2019 at 11:27:39AM +0000, Viorel Suman wrote:
> > > 
> > > 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(-)
> > > 
> > > +     priv->pdev = platform_device_register_data(&pdev->dev, mdrv,
> > > 0, NULL,
> > > +                                                0);
> > Would you please send a separate patch to replace "pdev->dev"?
> 
> Thank you for review. Yes, will send V3.

Ah...when I said that, I was literally saying that you should
send a separate patch individually, not resend the series.

Now I see you sent v3/v4 almost at the same time as "Applied"
mails from Mark. And I am totally confused which version got
applied....

Please rebase your local tree and find out which version got
applied and then send the diff with a separate patch.

Thanks
Nicolin
diff mbox series

Patch

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,