* [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
* Re: [PATCH 1/2] i2c: stu300: use clk_prepare/unprepare
[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-07-09 12:20 ` Wolfram Sang
1 sibling, 1 reply; 4+ messages in thread
From: Shubhrajyoti Datta @ 2012-06-13 6:22 UTC (permalink / raw)
To: Linus Walleij
Cc: Ben Dooks, Wolfram Sang, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
Linus Walleij
Hi Linus,
On Tue, Jun 12, 2012 at 11:03 PM, Linus Walleij
<linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org> wrote:
> 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.
Not a comment rather a doubt.
The transfer is still using enable and disable?
Can you help me understand the difference.
>
> 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);
So this also fixes an earlier lack of disable also?
> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] i2c: stu300: use clk_prepare/unprepare
[not found] ` <CAM=Q2ct+-URf8VT569Re2GTOFsVQLLspV6EyEj0GAt9qvn67Hg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-06-14 7:17 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2012-06-14 7:17 UTC (permalink / raw)
To: Shubhrajyoti Datta
Cc: Linus Walleij, Ben Dooks, Wolfram Sang,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
On Wed, Jun 13, 2012 at 8:22 AM, Shubhrajyoti Datta
<omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org> wrote:
>>
>> 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.
>
> Not a comment rather a doubt.
>
> The transfer is still using enable and disable?
> Can you help me understand the difference.
Do you mean you want me to explain the difference
between enable/disable and prepare/unprepare?
>> 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);
>
> So this also fixes an earlier lack of disable also?
No, there was no lack of disable earlier. If you look just a few lines
up in the patch there is a disable immediately after the
stu300_init_hw() call.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] i2c: stu300: use clk_prepare/unprepare
[not found] ` <1339522410-570-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2012-06-13 6:22 ` Shubhrajyoti Datta
@ 2012-07-09 12:20 ` Wolfram Sang
1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2012-07-09 12:20 UTC (permalink / raw)
To: Linus Walleij; +Cc: Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA, Linus Walleij
[-- Attachment #1: Type: text/plain, Size: 739 bytes --]
On Tue, Jun 12, 2012 at 07:33:30PM +0200, Linus Walleij wrote:
> 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>
Applied to next.
BTW sparse throws this for me, maybe you are interested:
drivers/i2c/busses/i2c-stu300.c:464:55: warning: cast removes address space of expression
Thanks,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [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).