lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 17 Apr 2012 15:22:10 +0530
From:	Viresh Kumar <viresh.kumar@...com>
To:	<vinod.koul@...el.com>
Cc:	<spear-devel@...t.st.com>, <viresh.linux@...il.com>,
	<linux-kernel@...r.kernel.org>, Viresh Kumar <viresh.kumar@...com>
Subject: [PATCH] dmaengine: dw_dmac: Add clk_{un}prepare() support

clk_{un}prepare is mandatory for platforms using common clock framework. Since
this driver is used by SPEAr platform, which supports common clock framework,
add clk_{un}prepare() support for it.

Signed-off-by: Viresh Kumar <viresh.kumar@...com>
---
 drivers/dma/dw_dmac.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 7439079..06d5bff 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1429,7 +1429,9 @@ static int __init dw_probe(struct platform_device *pdev)
 		err = PTR_ERR(dw->clk);
 		goto err_clk;
 	}
-	clk_enable(dw->clk);
+
+	if (!clk_prepare(dw->clk))
+		clk_enable(dw->clk);
 
 	/* force dma off, just in case */
 	dw_dma_off(dw);
@@ -1511,6 +1513,7 @@ static int __init dw_probe(struct platform_device *pdev)
 
 err_irq:
 	clk_disable(dw->clk);
+	clk_unprepare(dw->clk);
 	clk_put(dw->clk);
 err_clk:
 	iounmap(dw->regs);
@@ -1541,6 +1544,7 @@ static int __exit dw_remove(struct platform_device *pdev)
 	}
 
 	clk_disable(dw->clk);
+	clk_unprepare(dw->clk);
 	clk_put(dw->clk);
 
 	iounmap(dw->regs);
@@ -1560,6 +1564,7 @@ static void dw_shutdown(struct platform_device *pdev)
 
 	dw_dma_off(platform_get_drvdata(pdev));
 	clk_disable(dw->clk);
+	clk_unprepare(dw->clk);
 }
 
 static int dw_suspend_noirq(struct device *dev)
@@ -1569,6 +1574,7 @@ static int dw_suspend_noirq(struct device *dev)
 
 	dw_dma_off(platform_get_drvdata(pdev));
 	clk_disable(dw->clk);
+	clk_unprepare(dw->clk);
 
 	return 0;
 }
@@ -1578,7 +1584,9 @@ static int dw_resume_noirq(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct dw_dma	*dw = platform_get_drvdata(pdev);
 
-	clk_enable(dw->clk);
+	if (!clk_prepare(dw->clk))
+		clk_enable(dw->clk);
+
 	dma_writel(dw, CFG, DW_CFG_DMA_EN);
 	return 0;
 }
-- 
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ