linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] DMA: PL330: Clock and runtime cleanup
@ 2012-09-07  6:44 Inderpal Singh
  2012-09-07  6:44 ` [PATCH 1/2] DMA: PL330: Remove controller clock enable/disable Inderpal Singh
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Inderpal Singh @ 2012-09-07  6:44 UTC (permalink / raw)
  To: linux-samsung-soc, linux-kernel
  Cc: kgene.kim, vinod.koul, patches, boojin.kim, jassisinghbrar,
	Inderpal Singh

The controller clock is being managed at AMBA bus level probe/remove and
pm_runtime/suspend functions. The existing driver does the clock enable/disable
again in the same code paths, which unneccessarily increments the usage count of
the clock for the same device. 

The following patches remove the redundant clock enable/disable from the driver.

Inderpal Singh (2):
  DMA: PL330: Remove controller clock enable/disable
  DMA: PL330: Remove redundant runtime_suspend/resume functions

 drivers/dma/pl330.c |   73 ++++-----------------------------------------------
 1 file changed, 5 insertions(+), 68 deletions(-)

-- 
1.7.9.5


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

* [PATCH 1/2] DMA: PL330: Remove controller clock enable/disable
  2012-09-07  6:44 [PATCH 0/2] DMA: PL330: Clock and runtime cleanup Inderpal Singh
@ 2012-09-07  6:44 ` Inderpal Singh
  2012-09-07  6:44 ` [PATCH 2/2] DMA: PL330: Remove redundant runtime_suspend/resume functions Inderpal Singh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Inderpal Singh @ 2012-09-07  6:44 UTC (permalink / raw)
  To: linux-samsung-soc, linux-kernel
  Cc: kgene.kim, vinod.koul, patches, boojin.kim, jassisinghbrar,
	Inderpal Singh

The controller clock is being enabled/disabled in AMBA bus
infrastructre in probe/remove functions. Hence, its not required
at driver level probe/remove.

Signed-off-by: Inderpal Singh <inderpal.singh@linaro.org>
---
 drivers/dma/pl330.c |   12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index e4feba6..f70e783 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2896,11 +2896,6 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 
 	amba_set_drvdata(adev, pdmac);
 
-#ifndef CONFIG_PM_RUNTIME
-	/* enable dma clk */
-	clk_enable(pdmac->clk);
-#endif
-
 	irq = adev->irq[0];
 	ret = request_irq(irq, pl330_irq_handler, 0,
 			dev_name(&adev->dev), pi);
@@ -2987,9 +2982,6 @@ probe_err5:
 probe_err4:
 	free_irq(irq, pi);
 probe_err3:
-#ifndef CONFIG_PM_RUNTIME
-	clk_disable(pdmac->clk);
-#endif
 	clk_put(pdmac->clk);
 probe_err2:
 	iounmap(pi->base);
@@ -3037,10 +3029,6 @@ static int __devexit pl330_remove(struct amba_device *adev)
 	res = &adev->res;
 	release_mem_region(res->start, resource_size(res));
 
-#ifndef CONFIG_PM_RUNTIME
-	clk_disable(pdmac->clk);
-#endif
-
 	kfree(pdmac);
 
 	return 0;
-- 
1.7.9.5


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

* [PATCH 2/2] DMA: PL330: Remove redundant runtime_suspend/resume functions
  2012-09-07  6:44 [PATCH 0/2] DMA: PL330: Clock and runtime cleanup Inderpal Singh
  2012-09-07  6:44 ` [PATCH 1/2] DMA: PL330: Remove controller clock enable/disable Inderpal Singh
@ 2012-09-07  6:44 ` Inderpal Singh
  2012-09-14  3:15 ` [PATCH 0/2] DMA: PL330: Clock and runtime cleanup Vinod Koul
  2012-09-18  3:30 ` Vinod Koul
  3 siblings, 0 replies; 6+ messages in thread
From: Inderpal Singh @ 2012-09-07  6:44 UTC (permalink / raw)
  To: linux-samsung-soc, linux-kernel
  Cc: kgene.kim, vinod.koul, patches, boojin.kim, jassisinghbrar,
	Inderpal Singh

The driver's  runtime_suspend/resume functions just disable/enable
the clock which is already being managed at AMBA bus level
runtime_suspend/resume functions.

Hence, remove the driver's runtime_suspend/resume functions.

Signed-off-by: Inderpal Singh <inderpal.singh@linaro.org>
---
 drivers/dma/pl330.c |   61 +++++----------------------------------------------
 1 file changed, 5 insertions(+), 56 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index f70e783..d9e1433 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -23,7 +23,6 @@
 #include <linux/dmaengine.h>
 #include <linux/amba/bus.h>
 #include <linux/amba/pl330.h>
-#include <linux/pm_runtime.h>
 #include <linux/scatterlist.h>
 #include <linux/of.h>
 
@@ -586,8 +585,6 @@ struct dma_pl330_dmac {
 
 	/* Peripheral channels connected to this DMAC */
 	struct dma_pl330_chan *peripherals; /* keep at end */
-
-	struct clk *clk;
 };
 
 struct dma_pl330_desc {
@@ -2887,24 +2884,17 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 		goto probe_err1;
 	}
 
-	pdmac->clk = clk_get(&adev->dev, "dma");
-	if (IS_ERR(pdmac->clk)) {
-		dev_err(&adev->dev, "Cannot get operation clock.\n");
-		ret = -EINVAL;
-		goto probe_err2;
-	}
-
 	amba_set_drvdata(adev, pdmac);
 
 	irq = adev->irq[0];
 	ret = request_irq(irq, pl330_irq_handler, 0,
 			dev_name(&adev->dev), pi);
 	if (ret)
-		goto probe_err3;
+		goto probe_err2;
 
 	ret = pl330_add(pi);
 	if (ret)
-		goto probe_err4;
+		goto probe_err3;
 
 	INIT_LIST_HEAD(&pdmac->desc_pool);
 	spin_lock_init(&pdmac->pool_lock);
@@ -2964,7 +2954,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 	ret = dma_async_device_register(pd);
 	if (ret) {
 		dev_err(&adev->dev, "unable to register DMAC\n");
-		goto probe_err5;
+		goto probe_err4;
 	}
 
 	dev_info(&adev->dev,
@@ -2977,12 +2967,10 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 
 	return 0;
 
-probe_err5:
-	pl330_del(pi);
 probe_err4:
-	free_irq(irq, pi);
+	pl330_del(pi);
 probe_err3:
-	clk_put(pdmac->clk);
+	free_irq(irq, pi);
 probe_err2:
 	iounmap(pi->base);
 probe_err1:
@@ -3044,49 +3032,10 @@ static struct amba_id pl330_ids[] = {
 
 MODULE_DEVICE_TABLE(amba, pl330_ids);
 
-#ifdef CONFIG_PM_RUNTIME
-static int pl330_runtime_suspend(struct device *dev)
-{
-	struct dma_pl330_dmac *pdmac = dev_get_drvdata(dev);
-
-	if (!pdmac) {
-		dev_err(dev, "failed to get dmac\n");
-		return -ENODEV;
-	}
-
-	clk_disable(pdmac->clk);
-
-	return 0;
-}
-
-static int pl330_runtime_resume(struct device *dev)
-{
-	struct dma_pl330_dmac *pdmac = dev_get_drvdata(dev);
-
-	if (!pdmac) {
-		dev_err(dev, "failed to get dmac\n");
-		return -ENODEV;
-	}
-
-	clk_enable(pdmac->clk);
-
-	return 0;
-}
-#else
-#define pl330_runtime_suspend	NULL
-#define pl330_runtime_resume	NULL
-#endif /* CONFIG_PM_RUNTIME */
-
-static const struct dev_pm_ops pl330_pm_ops = {
-	.runtime_suspend = pl330_runtime_suspend,
-	.runtime_resume = pl330_runtime_resume,
-};
-
 static struct amba_driver pl330_driver = {
 	.drv = {
 		.owner = THIS_MODULE,
 		.name = "dma-pl330",
-		.pm = &pl330_pm_ops,
 	},
 	.id_table = pl330_ids,
 	.probe = pl330_probe,
-- 
1.7.9.5


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

* Re: [PATCH 0/2] DMA: PL330: Clock and runtime cleanup
  2012-09-07  6:44 [PATCH 0/2] DMA: PL330: Clock and runtime cleanup Inderpal Singh
  2012-09-07  6:44 ` [PATCH 1/2] DMA: PL330: Remove controller clock enable/disable Inderpal Singh
  2012-09-07  6:44 ` [PATCH 2/2] DMA: PL330: Remove redundant runtime_suspend/resume functions Inderpal Singh
@ 2012-09-14  3:15 ` Vinod Koul
  2012-09-14 11:25   ` Chander Kashyap
  2012-09-18  3:30 ` Vinod Koul
  3 siblings, 1 reply; 6+ messages in thread
From: Vinod Koul @ 2012-09-14  3:15 UTC (permalink / raw)
  To: Inderpal Singh
  Cc: linux-samsung-soc, linux-kernel, kgene.kim, patches, boojin.kim,
	jassisinghbrar

On Fri, 2012-09-07 at 12:14 +0530, Inderpal Singh wrote:
> The controller clock is being managed at AMBA bus level probe/remove and
> pm_runtime/suspend functions. The existing driver does the clock enable/disable
> again in the same code paths, which unneccessarily increments the usage count of
> the clock for the same device. 
> 
> The following patches remove the redundant clock enable/disable from the driver.
Looks good, any tested by before I apply this.. Kukjin?
> 
> Inderpal Singh (2):
>   DMA: PL330: Remove controller clock enable/disable
>   DMA: PL330: Remove redundant runtime_suspend/resume functions
> 
>  drivers/dma/pl330.c |   73 ++++-----------------------------------------------
>  1 file changed, 5 insertions(+), 68 deletions(-)
> 


-- 
~Vinod


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

* Re: [PATCH 0/2] DMA: PL330: Clock and runtime cleanup
  2012-09-14  3:15 ` [PATCH 0/2] DMA: PL330: Clock and runtime cleanup Vinod Koul
@ 2012-09-14 11:25   ` Chander Kashyap
  0 siblings, 0 replies; 6+ messages in thread
From: Chander Kashyap @ 2012-09-14 11:25 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Inderpal Singh, linux-samsung-soc, linux-kernel, kgene.kim,
	patches, boojin.kim, jassisinghbrar

On 14 September 2012 08:45, Vinod Koul <vinod.koul@linux.intel.com> wrote:
> On Fri, 2012-09-07 at 12:14 +0530, Inderpal Singh wrote:
>> The controller clock is being managed at AMBA bus level probe/remove and
>> pm_runtime/suspend functions. The existing driver does the clock enable/disable
>> again in the same code paths, which unneccessarily increments the usage count of
>> the clock for the same device.
>>
>> The following patches remove the redundant clock enable/disable from the driver.
> Looks good, any tested by before I apply this.. Kukjin?
if it matters,
Tested-by: Chander Kashyap <chander.kashyap@linaro.org>

>>
>> Inderpal Singh (2):
>>   DMA: PL330: Remove controller clock enable/disable
>>   DMA: PL330: Remove redundant runtime_suspend/resume functions
>>
>>  drivers/dma/pl330.c |   73 ++++-----------------------------------------------
>>  1 file changed, 5 insertions(+), 68 deletions(-)
>>
>
>
> --
> ~Vinod
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
with warm regards,
Chander Kashyap

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

* Re: [PATCH 0/2] DMA: PL330: Clock and runtime cleanup
  2012-09-07  6:44 [PATCH 0/2] DMA: PL330: Clock and runtime cleanup Inderpal Singh
                   ` (2 preceding siblings ...)
  2012-09-14  3:15 ` [PATCH 0/2] DMA: PL330: Clock and runtime cleanup Vinod Koul
@ 2012-09-18  3:30 ` Vinod Koul
  3 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2012-09-18  3:30 UTC (permalink / raw)
  To: Inderpal Singh
  Cc: linux-samsung-soc, linux-kernel, kgene.kim, patches, boojin.kim,
	jassisinghbrar

On Fri, 2012-09-07 at 12:14 +0530, Inderpal Singh wrote:
> The controller clock is being managed at AMBA bus level probe/remove and
> pm_runtime/suspend functions. The existing driver does the clock enable/disable
> again in the same code paths, which unneccessarily increments the usage count of
> the clock for the same device. 
> 
> The following patches remove the redundant clock enable/disable from the driver.
Applied thanks

-- 
~Vinod


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

end of thread, other threads:[~2012-09-18  3:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-07  6:44 [PATCH 0/2] DMA: PL330: Clock and runtime cleanup Inderpal Singh
2012-09-07  6:44 ` [PATCH 1/2] DMA: PL330: Remove controller clock enable/disable Inderpal Singh
2012-09-07  6:44 ` [PATCH 2/2] DMA: PL330: Remove redundant runtime_suspend/resume functions Inderpal Singh
2012-09-14  3:15 ` [PATCH 0/2] DMA: PL330: Clock and runtime cleanup Vinod Koul
2012-09-14 11:25   ` Chander Kashyap
2012-09-18  3:30 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).