[alsa-devel] [PATCH 1/2] ASoC: fsl_dma: Remove 'path' field from dma_object struct
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;
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);
Fabio Estevam wrote:
ssi_np->full_name);
of_node_put(ssi_np); return ret; }pdev->name);
- 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.
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);
of_node_put(ssi_np); return ret; }pdev->name);
- 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);
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.
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;
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.
Fabio Estevam wrote:
From: Fabio Estevamfabio.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.
participants (3)
-
Fabio Estevam
-
Lars-Peter Clausen
-
Timur Tabi