All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: fsl_dma: Remove 'path' field from dma_object struct
@ 2015-01-07 17:21 Fabio Estevam
  2015-01-07 17:21 ` [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference Fabio Estevam
  2015-01-07 17:23 ` [PATCH 1/2] ASoC: fsl_dma: Remove 'path' field from dma_object struct Timur Tabi
  0 siblings, 2 replies; 8+ messages in thread
From: Fabio Estevam @ 2015-01-07 17:21 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, alsa-devel, timur

From: Fabio Estevam <fabio.estevam@freescale.com>

The 'path' field has not a real purpose, so let's get rid of it.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Buit tested only.

 sound/soc/fsl/fsl_dma.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 93d7e56..026da0a 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -63,7 +63,6 @@ struct dma_object {
 	struct ccsr_dma_channel __iomem *channel;
 	unsigned int irq;
 	bool assigned;
-	char path[1];
 };
 
 /*
@@ -910,7 +909,6 @@ static int fsl_soc_dma_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	strcpy(dma->path, np->full_name);
 	dma->dai.ops = &fsl_dma_ops;
 	dma->dai.pcm_new = fsl_dma_new;
 	dma->dai.pcm_free = fsl_dma_free_dma_buffers;
-- 
1.9.1

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

* [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
  2015-01-07 17:21 [PATCH 1/2] ASoC: fsl_dma: Remove 'path' field from dma_object struct Fabio Estevam
@ 2015-01-07 17:21 ` Fabio Estevam
  2015-01-07 17:26   ` Timur Tabi
  2015-01-07 17:26   ` Lars-Peter Clausen
  2015-01-07 17:23 ` [PATCH 1/2] ASoC: fsl_dma: Remove 'path' field from dma_object struct Timur Tabi
  1 sibling, 2 replies; 8+ messages in thread
From: Fabio Estevam @ 2015-01-07 17:21 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, alsa-devel, timur

From: Fabio Estevam <fabio.estevam@freescale.com>

The only usage of 'full_name' is inside an error message, which provides a 
rather verbose node path.

A more concise error message can be obtained by using 'pdev->name' instead. It 
also makes the kzalloc calculation simpler, as we don't need to take the length
of full_name into account.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Buit tested only.

 sound/soc/fsl/fsl_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 026da0a..770de20 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -897,12 +897,12 @@ static int fsl_soc_dma_probe(struct platform_device *pdev)
 	ret = of_address_to_resource(ssi_np, 0, &res);
 	if (ret) {
 		dev_err(&pdev->dev, "could not determine resources for %s\n",
-			ssi_np->full_name);
+			pdev->name);
 		of_node_put(ssi_np);
 		return ret;
 	}
 
-	dma = kzalloc(sizeof(*dma) + strlen(np->full_name), GFP_KERNEL);
+	dma = kzalloc(sizeof(*dma), GFP_KERNEL);
 	if (!dma) {
 		dev_err(&pdev->dev, "could not allocate dma object\n");
 		of_node_put(ssi_np);
-- 
1.9.1

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

* Re: [PATCH 1/2] ASoC: fsl_dma: Remove 'path' field from dma_object struct
  2015-01-07 17:21 [PATCH 1/2] ASoC: fsl_dma: Remove 'path' field from dma_object struct Fabio Estevam
  2015-01-07 17:21 ` [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference Fabio Estevam
@ 2015-01-07 17:23 ` Timur Tabi
  1 sibling, 0 replies; 8+ messages in thread
From: Timur Tabi @ 2015-01-07 17:23 UTC (permalink / raw)
  To: Fabio Estevam, broonie; +Cc: Fabio Estevam, alsa-devel

Fabio Estevam wrote:
> From: Fabio Estevam<fabio.estevam@freescale.com>
>
> The 'path' field has not a real purpose, so let's get rid of it.

I'm pretty sure that it *did* have a real purpose, but it's not needed 
any more.  Let me try to figure out what happened, so you can specify 
that in the changelog.

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

* Re: [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
  2015-01-07 17:21 ` [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference Fabio Estevam
@ 2015-01-07 17:26   ` Timur Tabi
  2015-01-07 17:26   ` Lars-Peter Clausen
  1 sibling, 0 replies; 8+ messages in thread
From: Timur Tabi @ 2015-01-07 17:26 UTC (permalink / raw)
  To: Fabio Estevam, broonie; +Cc: Fabio Estevam, alsa-devel

Fabio Estevam wrote:
> -			ssi_np->full_name);
> +			pdev->name);
>   		of_node_put(ssi_np);
>   		return ret;
>   	}
>
> -	dma = kzalloc(sizeof(*dma) + strlen(np->full_name), GFP_KERNEL);
> +	dma = kzalloc(sizeof(*dma), GFP_KERNEL);

Something is missing here.  Since we're no longer allocating space in 
the 'dma' object for the name, then you should probably delete the code 
that copies the string to the 'dma' object.

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

* Re: [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
  2015-01-07 17:21 ` [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference Fabio Estevam
  2015-01-07 17:26   ` Timur Tabi
@ 2015-01-07 17:26   ` Lars-Peter Clausen
  2015-01-07 17:27     ` Timur Tabi
  1 sibling, 1 reply; 8+ messages in thread
From: Lars-Peter Clausen @ 2015-01-07 17:26 UTC (permalink / raw)
  To: Fabio Estevam, broonie; +Cc: Fabio Estevam, alsa-devel, timur

On 01/07/2015 06:21 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> The only usage of 'full_name' is inside an error message, which provides a
> rather verbose node path.
>
> A more concise error message can be obtained by using 'pdev->name' instead.

It's probably best to drop it altogether in that case. dev_err() already 
prints the name of the device.

  It
> also makes the kzalloc calculation simpler, as we don't need to take the length
> of full_name into account.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> Buit tested only.
>
>   sound/soc/fsl/fsl_dma.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
> index 026da0a..770de20 100644
> --- a/sound/soc/fsl/fsl_dma.c
> +++ b/sound/soc/fsl/fsl_dma.c
> @@ -897,12 +897,12 @@ static int fsl_soc_dma_probe(struct platform_device *pdev)
>   	ret = of_address_to_resource(ssi_np, 0, &res);
>   	if (ret) {
>   		dev_err(&pdev->dev, "could not determine resources for %s\n",
> -			ssi_np->full_name);
> +			pdev->name);
>   		of_node_put(ssi_np);
>   		return ret;
>   	}
>
> -	dma = kzalloc(sizeof(*dma) + strlen(np->full_name), GFP_KERNEL);
> +	dma = kzalloc(sizeof(*dma), GFP_KERNEL);

This should probably be part of patch 1.

>   	if (!dma) {
>   		dev_err(&pdev->dev, "could not allocate dma object\n");
>   		of_node_put(ssi_np);
>

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

* Re: [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
  2015-01-07 17:26   ` Lars-Peter Clausen
@ 2015-01-07 17:27     ` Timur Tabi
  2015-01-07 17:47       ` Fabio Estevam
  0 siblings, 1 reply; 8+ messages in thread
From: Timur Tabi @ 2015-01-07 17:27 UTC (permalink / raw)
  To: Lars-Peter Clausen, Fabio Estevam, broonie; +Cc: Fabio Estevam, alsa-devel

Lars-Peter Clausen wrote:
>>
>> -    dma = kzalloc(sizeof(*dma) + strlen(np->full_name), GFP_KERNEL);
>> +    dma = kzalloc(sizeof(*dma), GFP_KERNEL);
>
> This should probably be part of patch 1.

I think you're right.

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

* Re: [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
  2015-01-07 17:27     ` Timur Tabi
@ 2015-01-07 17:47       ` Fabio Estevam
  2015-01-07 17:54         ` Timur Tabi
  0 siblings, 1 reply; 8+ messages in thread
From: Fabio Estevam @ 2015-01-07 17:47 UTC (permalink / raw)
  To: Timur Tabi; +Cc: Fabio Estevam, Mark Brown, Lars-Peter Clausen, alsa-devel

On Wed, Jan 7, 2015 at 3:27 PM, Timur Tabi <timur@tabi.org> wrote:
> Lars-Peter Clausen wrote:
>>>
>>>
>>> -    dma = kzalloc(sizeof(*dma) + strlen(np->full_name), GFP_KERNEL);
>>> +    dma = kzalloc(sizeof(*dma), GFP_KERNEL);
>>
>>
>> This should probably be part of patch 1.
>
>
> I think you're right.

Thanks, so I can do it on a single patch then:

diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 93d7e56..72e7979 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -63,7 +63,6 @@ struct dma_object {
     struct ccsr_dma_channel __iomem *channel;
     unsigned int irq;
     bool assigned;
-    char path[1];
 };

 /*
@@ -897,20 +896,18 @@ static int fsl_soc_dma_probe(struct platform_device *pdev)

     ret = of_address_to_resource(ssi_np, 0, &res);
     if (ret) {
-        dev_err(&pdev->dev, "could not determine resources for %s\n",
-            ssi_np->full_name);
+        dev_err(&pdev->dev, "could not determine resources: %d\n", ret);
         of_node_put(ssi_np);
         return ret;
     }

-    dma = kzalloc(sizeof(*dma) + strlen(np->full_name), GFP_KERNEL);
+    dma = kzalloc(sizeof(*dma), GFP_KERNEL);
     if (!dma) {
         dev_err(&pdev->dev, "could not allocate dma object\n");
         of_node_put(ssi_np);
         return -ENOMEM;
     }

-    strcpy(dma->path, np->full_name);
     dma->dai.ops = &fsl_dma_ops;
     dma->dai.pcm_new = fsl_dma_new;
     dma->dai.pcm_free = fsl_dma_free_dma_buffers;

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

* Re: [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
  2015-01-07 17:47       ` Fabio Estevam
@ 2015-01-07 17:54         ` Timur Tabi
  0 siblings, 0 replies; 8+ messages in thread
From: Timur Tabi @ 2015-01-07 17:54 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, Mark Brown, Lars-Peter Clausen, alsa-devel

Fabio Estevam wrote:
> -        dev_err(&pdev->dev, "could not determine resources for %s\n",
> -            ssi_np->full_name);
> +        dev_err(&pdev->dev, "could not determine resources: %d\n", ret);

I remember now why I did this, and I might need to NACK this patch. 
ssi_np->full_name is the name of the SSI node, but here, dev_err will 
print the name of the DMA node.  So the intent is to help the user 
determine which SSI node has a broken DMA node pointer.  This probably 
is useful only on PowerPC, which uses the old ssi->dma linkage.

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

end of thread, other threads:[~2015-01-07 17:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 17:21 [PATCH 1/2] ASoC: fsl_dma: Remove 'path' field from dma_object struct Fabio Estevam
2015-01-07 17:21 ` [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference Fabio Estevam
2015-01-07 17:26   ` Timur Tabi
2015-01-07 17:26   ` Lars-Peter Clausen
2015-01-07 17:27     ` Timur Tabi
2015-01-07 17:47       ` Fabio Estevam
2015-01-07 17:54         ` Timur Tabi
2015-01-07 17:23 ` [PATCH 1/2] ASoC: fsl_dma: Remove 'path' field from dma_object struct Timur Tabi

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.