Patchwork ata: pata_samsung_cf: Use devm_clk_get()

login
register
mail settings
Submitter Jingoo Han
Date Jan. 9, 2013, 1:22 a.m.
Message ID <002c01cdee07$d1ddacc0$75990640$%han@samsung.com>
Download mbox | patch
Permalink /patch/210586/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Jingoo Han - Jan. 9, 2013, 1:22 a.m.
The devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_clk_get() for these functions.
These make the code smaller and a bit simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/ata/pata_samsung_cf.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
Sergei Shtylyov - Jan. 9, 2013, 12:13 p.m.
Hello.

On 09-01-2013 5:22, Jingoo Han wrote:

> The devm_ functions allocate memory that is released when a driver
> detaches.

    They don't do only that.

> This patch uses devm_clk_get() for these functions.

    Which doesn't allocate any memory.

> These make the code smaller and a bit simpler.

> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

MBR, Sergei


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c
index 63ffb00..70b0e01 100644
--- a/drivers/ata/pata_samsung_cf.c
+++ b/drivers/ata/pata_samsung_cf.c
@@ -512,7 +512,7 @@  static int __init pata_s3c_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	info->clk = clk_get(&pdev->dev, "cfcon");
+	info->clk = devm_clk_get(&pdev->dev, "cfcon");
 	if (IS_ERR(info->clk)) {
 		dev_err(dev, "failed to get access to cf controller clock\n");
 		ret = PTR_ERR(info->clk);
@@ -589,7 +589,6 @@  static int __init pata_s3c_probe(struct platform_device *pdev)
 
 stop_clk:
 	clk_disable(info->clk);
-	clk_put(info->clk);
 	return ret;
 }
 
@@ -601,7 +600,6 @@  static int __exit pata_s3c_remove(struct platform_device *pdev)
 	ata_host_detach(host);
 
 	clk_disable(info->clk);
-	clk_put(info->clk);
 
 	return 0;
 }