ASoC: fsl_dma: Remove 'path' field from dma_object struct
Subsystems (3)
Fabio Estevam
reviewerPATCH 1/2 ASoC: fsl_dma: Remove 'path' field from dma_object struct
From: Fabio Estevam <[email protected]>
The 'path' field has not a real purpose, so let's get rid of it.
---
Buit tested only.
sound/soc/fsl/fsl_dma.c | 2 -- 1 file changed, 2 deletions(-)
sound/soc/fsl/fsl_dma.c +0 -2
@@ -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;
Signature · 1 line
1.9.1
Fabio Estevam
reviewerPATCH 2/2 ASoC: fsl_dma: Do not use 'full_name' node reference
From: Fabio Estevam <[email protected]>
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.
---
Buit tested only.
sound/soc/fsl/fsl_dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/fsl/fsl_dma.c +2 -2
@@ -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);
Signature · 1 line
1.9.1
Quoted 3 lines · Fabio Estevam
From: Fabio Estevam<[email protected]>
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.
Re: [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
In reply to Fabio Estevamsound/soc/fsl/fsl_dma.c static int fsl_soc_dma_probe(struct platform_device *pdev) · line 905
Quoted 8 lines · Fabio Estevam
sound/soc/fsl/fsl_dma.c +2
-2- 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.
Re: [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
In reply to Fabio EstevamQuoted 6 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
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
Quoted 16 lines
also makes the kzalloc calculation simpler, as we don't need to take the length of
full_nameinto account.Signed-off-by Fabio Estevam <[email protected]>---
Buit tested only.sound/soc/fsl/fsl_dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)sound/soc/fsl/fsl_dma.c +0
-0@@ -897,12 +897,12 @@ static int fsl_soc_dma_probe(struct platform_device *pdev) ret =of_address_to_resource (ssi_np,0 , &res);
sound/soc/fsl/fsl_dma.c static int fsl_soc_dma_probe(struct platform_device *pdev) · line 905
Quoted 10 lines
sound/soc/fsl/fsl_dma.c +2
-2if (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.
Quoted 4 lines
sound/soc/fsl/fsl_dma.c +0
-0if (!dma) {dev_err (&pdev->dev,"could not allocate dma object\n" );of_node_put (ssi_np);
Re: [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
Quoted 5 lines · Lars-Peter Clausen
sound/soc/fsl/fsl_dma.c static int fsl_soc_dma_probe(struct platform_device *pdev) · line 905
Quoted 3 lines
sound/soc/fsl/fsl_dma.c +1
-1- 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.
Fabio Estevam
reviewerRe: [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
Quoted 11 lines · Timur Tabi
Quoted 7 lines · Lars-Peter Clausen
Review
Quoted 4 lines
(quoted diff) +1
-1- 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:
sound/soc/fsl/fsl_dma.c +2 -5
@@ -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;
Re: [PATCH 2/2] ASoC: fsl_dma: Do not use 'full_name' node reference
sound/soc/fsl/fsl_dma.c static int fsl_soc_dma_probe(struct platform_device *pdev) · line 899
Quoted 3 lines · Fabio Estevam
sound/soc/fsl/fsl_dma.c +1
-2-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.