* [PATCH 1/3] ASoC: Davinci: Use resource_size() helper function
@ 2011-02-09 13:09 Vaibhav Bedia
2011-02-09 13:09 ` [PATCH 2/3] ASoC: Davinci: Call clk_disable() and clk_put() in case of error Vaibhav Bedia
2011-02-09 21:53 ` [PATCH 1/3] ASoC: Davinci: Use resource_size() helper function Liam Girdwood
0 siblings, 2 replies; 5+ messages in thread
From: Vaibhav Bedia @ 2011-02-09 13:09 UTC (permalink / raw)
To: alsa-devel
Cc: davinci-linux-open-source, broonie, Vaibhav Bedia, sshtylyov, lrg
This patch modifies the Davinci i2s and mcasp drivers
to make use of the resource_size() helper function for readability.
Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
---
sound/soc/davinci/davinci-i2s.c | 6 +++---
sound/soc/davinci/davinci-mcasp.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index 9e0e565..f8c8487 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -658,7 +658,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
return -ENODEV;
}
- ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1,
+ ioarea = request_mem_region(mem->start, resource_size(mem),
pdev->name);
if (!ioarea) {
dev_err(&pdev->dev, "McBSP region already claimed\n");
@@ -731,7 +731,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
err_free_mem:
kfree(dev);
err_release_region:
- release_mem_region(mem->start, (mem->end - mem->start) + 1);
+ release_mem_region(mem->start, resource_size(mem));
return ret;
}
@@ -747,7 +747,7 @@ static int davinci_i2s_remove(struct platform_device *pdev)
dev->clk = NULL;
kfree(dev);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(mem->start, (mem->end - mem->start) + 1);
+ release_mem_region(mem->start, resource_size(mem));
return 0;
}
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index fb55d2c..9b5d5ca 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -868,7 +868,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
}
ioarea = request_mem_region(mem->start,
- (mem->end - mem->start) + 1, pdev->name);
+ resource_size(mem), pdev->name);
if (!ioarea) {
dev_err(&pdev->dev, "Audio region already claimed\n");
ret = -EBUSY;
@@ -933,7 +933,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
return 0;
err_release_region:
- release_mem_region(mem->start, (mem->end - mem->start) + 1);
+ release_mem_region(mem->start, resource_size(mem));
err_release_data:
kfree(dev);
@@ -951,7 +951,7 @@ static int davinci_mcasp_remove(struct platform_device *pdev)
dev->clk = NULL;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(mem->start, (mem->end - mem->start) + 1);
+ release_mem_region(mem->start, resource_size(mem));
kfree(dev);
--
1.6.2.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] ASoC: Davinci: Call clk_disable() and clk_put() in case of error
2011-02-09 13:09 [PATCH 1/3] ASoC: Davinci: Use resource_size() helper function Vaibhav Bedia
@ 2011-02-09 13:09 ` Vaibhav Bedia
[not found] ` <1297256994-17137-2-git-send-email-vaibhav.bedia-l0cyMroinI0@public.gmane.org>
2011-02-09 21:53 ` [PATCH 1/3] ASoC: Davinci: Use resource_size() helper function Liam Girdwood
1 sibling, 1 reply; 5+ messages in thread
From: Vaibhav Bedia @ 2011-02-09 13:09 UTC (permalink / raw)
To: alsa-devel
Cc: davinci-linux-open-source, broonie, Vaibhav Bedia, sshtylyov, lrg
In case of any error in probe() function, clk_disable() and clk_put()
should be called if clk_enable() and clk_get() went through.
Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
---
sound/soc/davinci/davinci-i2s.c | 9 ++++++---
sound/soc/davinci/davinci-mcasp.c | 9 ++++++---
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index f8c8487..e763d58 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -707,7 +707,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENXIO;
- goto err_free_mem;
+ goto err_release_clk;
}
dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start;
@@ -715,7 +715,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENXIO;
- goto err_free_mem;
+ goto err_release_clk;
}
dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start;
dev->dev = &pdev->dev;
@@ -724,10 +724,13 @@ static int davinci_i2s_probe(struct platform_device *pdev)
ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai);
if (ret != 0)
- goto err_free_mem;
+ goto err_release_clk;
return 0;
+err_release_clk:
+ clk_disable(dev->clk);
+ clk_put(dev->clk);
err_free_mem:
kfree(dev);
err_release_region:
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 9b5d5ca..e7ae621 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -906,7 +906,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENODEV;
- goto err_release_region;
+ goto err_release_clk;
}
dma_data->channel = res->start;
@@ -921,7 +921,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENODEV;
- goto err_release_region;
+ goto err_release_clk;
}
dma_data->channel = res->start;
@@ -929,9 +929,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]);
if (ret != 0)
- goto err_release_region;
+ goto err_release_clk;
return 0;
+err_release_clk:
+ clk_disable(dev->clk);
+ clk_put(dev->clk);
err_release_region:
release_mem_region(mem->start, resource_size(mem));
err_release_data:
--
1.6.2.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] ASoC: Davinci: Replace usage of IO_ADDRESS with ioremap()
[not found] ` <1297256994-17137-2-git-send-email-vaibhav.bedia-l0cyMroinI0@public.gmane.org>
@ 2011-02-09 13:09 ` Vaibhav Bedia
0 siblings, 0 replies; 5+ messages in thread
From: Vaibhav Bedia @ 2011-02-09 13:09 UTC (permalink / raw)
To: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E,
sshtylyov-Igf4POYTYCDQT0dZR+AlfA, lrg-kDsPt+C1G03kYMGBc/C6ZA
This patch modifies the Davinci i2s and mcasp drivers to make use of
ioremap() instead of IO_ADDRESS()
Signed-off-by: Vaibhav Bedia <vaibhav.bedia-l0cyMroinI0@public.gmane.org>
---
v2:
Don't call iounmap when ioremap has failed.
Other comments from Sergie on the previous patch has been incorporated in a different patch.
v1:
http://thread.gmane.org/gmane.linux.alsa.devel/80120
sound/soc/davinci/davinci-i2s.c | 19 +++++++++++++------
sound/soc/davinci/davinci-mcasp.c | 20 ++++++++++++++------
2 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index e763d58..d0d60b8 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -694,20 +694,25 @@ static int davinci_i2s_probe(struct platform_device *pdev)
}
clk_enable(dev->clk);
- dev->base = (void __iomem *)IO_ADDRESS(mem->start);
+ dev->base = ioremap(mem->start, resource_size(mem));
+ if (!dev->base) {
+ dev_err(&pdev->dev, "ioremap failed\n");
+ ret = -ENOMEM;
+ goto err_release_clk;
+ }
dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr =
- (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG);
+ (dma_addr_t)(mem->start + DAVINCI_MCBSP_DXR_REG);
dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr =
- (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG);
+ (dma_addr_t)(mem->start + DAVINCI_MCBSP_DRR_REG);
/* first TX, then RX */
res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENXIO;
- goto err_release_clk;
+ goto err_iounmap;
}
dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start;
@@ -715,7 +720,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENXIO;
- goto err_release_clk;
+ goto err_iounmap;
}
dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start;
dev->dev = &pdev->dev;
@@ -724,10 +729,12 @@ static int davinci_i2s_probe(struct platform_device *pdev)
ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai);
if (ret != 0)
- goto err_release_clk;
+ goto err_iounmap;
return 0;
+err_iounmap:
+ iounmap(dev->base);
err_release_clk:
clk_disable(dev->clk);
clk_put(dev->clk);
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index e7ae621..a5af834 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -885,7 +885,13 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
clk_enable(dev->clk);
dev->clk_active = 1;
- dev->base = (void __iomem *)IO_ADDRESS(mem->start);
+ dev->base = ioremap(mem->start, resource_size(mem));
+ if (!dev->base) {
+ dev_err(&pdev->dev, "ioremap failed\n");
+ ret = -ENOMEM;
+ goto err_release_clk;
+ }
+
dev->op_mode = pdata->op_mode;
dev->tdm_slots = pdata->tdm_slots;
dev->num_serializer = pdata->num_serializer;
@@ -899,14 +905,14 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
dma_data->asp_chan_q = pdata->asp_chan_q;
dma_data->ram_chan_q = pdata->ram_chan_q;
dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
- io_v2p(dev->base));
+ mem->start);
/* first TX, then RX */
res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENODEV;
- goto err_release_clk;
+ goto err_iounmap;
}
dma_data->channel = res->start;
@@ -915,13 +921,13 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
dma_data->asp_chan_q = pdata->asp_chan_q;
dma_data->ram_chan_q = pdata->ram_chan_q;
dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
- io_v2p(dev->base));
+ mem->start);
res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENODEV;
- goto err_release_clk;
+ goto err_iounmap;
}
dma_data->channel = res->start;
@@ -929,9 +935,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]);
if (ret != 0)
- goto err_release_clk;
+ goto err_iounmap;
return 0;
+err_iounmap:
+ iounmap(dev->base);
err_release_clk:
clk_disable(dev->clk);
clk_put(dev->clk);
--
1.6.2.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] ASoC: Davinci: Use resource_size() helper function
2011-02-09 13:09 [PATCH 1/3] ASoC: Davinci: Use resource_size() helper function Vaibhav Bedia
2011-02-09 13:09 ` [PATCH 2/3] ASoC: Davinci: Call clk_disable() and clk_put() in case of error Vaibhav Bedia
@ 2011-02-09 21:53 ` Liam Girdwood
2011-02-09 22:35 ` Mark Brown
1 sibling, 1 reply; 5+ messages in thread
From: Liam Girdwood @ 2011-02-09 21:53 UTC (permalink / raw)
To: Vaibhav Bedia; +Cc: alsa-devel, broonie, davinci-linux-open-source, sshtylyov
On Wed, 2011-02-09 at 18:39 +0530, Vaibhav Bedia wrote:
> This patch modifies the Davinci i2s and mcasp drivers
> to make use of the resource_size() helper function for readability.
>
> Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
All
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] ASoC: Davinci: Use resource_size() helper function
2011-02-09 21:53 ` [PATCH 1/3] ASoC: Davinci: Use resource_size() helper function Liam Girdwood
@ 2011-02-09 22:35 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-02-09 22:35 UTC (permalink / raw)
To: Liam Girdwood
Cc: sshtylyov, alsa-devel, davinci-linux-open-source, Vaibhav Bedia
On Wed, Feb 09, 2011 at 09:53:46PM +0000, Liam Girdwood wrote:
> On Wed, 2011-02-09 at 18:39 +0530, Vaibhav Bedia wrote:
> > This patch modifies the Davinci i2s and mcasp drivers
> > to make use of the resource_size() helper function for readability.
> >
> > Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
>
> All
>
> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-09 22:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-09 13:09 [PATCH 1/3] ASoC: Davinci: Use resource_size() helper function Vaibhav Bedia
2011-02-09 13:09 ` [PATCH 2/3] ASoC: Davinci: Call clk_disable() and clk_put() in case of error Vaibhav Bedia
[not found] ` <1297256994-17137-2-git-send-email-vaibhav.bedia-l0cyMroinI0@public.gmane.org>
2011-02-09 13:09 ` [PATCH v2 3/3] ASoC: Davinci: Replace usage of IO_ADDRESS with ioremap() Vaibhav Bedia
2011-02-09 21:53 ` [PATCH 1/3] ASoC: Davinci: Use resource_size() helper function Liam Girdwood
2011-02-09 22:35 ` Mark Brown
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.