linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] i2c: stu300: use clk_prepare/unprepare
@ 2012-06-12 17:33 Linus Walleij
       [not found] ` <1339522410-570-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2012-06-12 17:33 UTC (permalink / raw)
  To: Ben Dooks, Wolfram Sang, linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Linus Walleij

From: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Make sure we prepare/unprepare the clock for the ST U300
I2C driver as is required by the clk API especially if you
use common clock.

Signed-off-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/i2c/busses/i2c-stu300.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 4d44af1..79b7851 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -924,7 +924,7 @@ stu300_probe(struct platform_device *pdev)
 
 	dev->speed = scl_frequency;
 
-	clk_enable(dev->clk);
+	clk_prepare_enable(dev->clk);
 	ret = stu300_init_hw(dev);
 	clk_disable(dev->clk);
 
@@ -960,6 +960,7 @@ stu300_probe(struct platform_device *pdev)
 
  err_add_adapter:
  err_init_hw:
+	clk_unprepare(dev->clk);
 	free_irq(dev->irq, dev);
  err_no_irq:
 	iounmap(dev->virtbase);
@@ -1016,6 +1017,7 @@ stu300_remove(struct platform_device *pdev)
 	free_irq(dev->irq, dev);
 	iounmap(dev->virtbase);
 	release_mem_region(dev->phybase, dev->physize);
+	clk_unprepare(dev->clk);
 	clk_put(dev->clk);
 	platform_set_drvdata(pdev, NULL);
 	kfree(dev);
-- 
1.7.9.2

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

end of thread, other threads:[~2012-07-09 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-12 17:33 [PATCH 1/2] i2c: stu300: use clk_prepare/unprepare Linus Walleij
     [not found] ` <1339522410-570-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2012-06-13  6:22   ` Shubhrajyoti Datta
     [not found]     ` <CAM=Q2ct+-URf8VT569Re2GTOFsVQLLspV6EyEj0GAt9qvn67Hg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-06-14  7:17       ` Linus Walleij
2012-07-09 12:20   ` Wolfram Sang

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).