* [PATCH] net/irda: add clk_prepare/clk_unprepare to pxaficp_ir
@ 2012-03-15 18:19 Philipp Zabel
2012-03-17 6:10 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Philipp Zabel @ 2012-03-15 18:19 UTC (permalink / raw)
To: netdev; +Cc: Eric Miao, Haojian Zhuang, Samuel Ortiz
This patch adds clk_prepare/clk_unprepare calls to the pxaficp_ir
driver by using the helper functions clk_prepare_enable and
clk_disable_unprepare.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Samuel Ortiz <samuel@sortiz.org>
---
drivers/net/irda/pxaficp_ir.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 81d5275..ff16daf 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -128,20 +128,20 @@ struct pxa_irda {
static inline void pxa_irda_disable_clk(struct pxa_irda *si)
{
if (si->cur_clk)
- clk_disable(si->cur_clk);
+ clk_disable_unprepare(si->cur_clk);
si->cur_clk = NULL;
}
static inline void pxa_irda_enable_firclk(struct pxa_irda *si)
{
si->cur_clk = si->fir_clk;
- clk_enable(si->fir_clk);
+ clk_prepare_enable(si->fir_clk);
}
static inline void pxa_irda_enable_sirclk(struct pxa_irda *si)
{
si->cur_clk = si->sir_clk;
- clk_enable(si->sir_clk);
+ clk_prepare_enable(si->sir_clk);
}
--
1.7.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] net/irda: add clk_prepare/clk_unprepare to pxaficp_ir
2012-03-15 18:19 [PATCH] net/irda: add clk_prepare/clk_unprepare to pxaficp_ir Philipp Zabel
@ 2012-03-17 6:10 ` David Miller
2012-03-17 10:43 ` Philipp Zabel
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2012-03-17 6:10 UTC (permalink / raw)
To: philipp.zabel; +Cc: netdev, eric.y.miao, haojian.zhuang, samuel
From: Philipp Zabel <philipp.zabel@gmail.com>
Date: Thu, 15 Mar 2012 19:19:29 +0100
> This patch adds clk_prepare/clk_unprepare calls to the pxaficp_ir
> driver by using the helper functions clk_prepare_enable and
> clk_disable_unprepare.
>
> Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
This is terrible.
So the problem was that clk_enable can't be invoked from atomic
context, because it wants to take a mutex for some implementation.
Therefore an existing routine with well defined semantics,
clk_enable(), was turned into a NOP.
And this silently breaks drivers.
Instead of silently breaking things, make direct
clk_enable()/clk_disable() invocations either result in a compile
error or a run-time BUG_ON().
There are other ways this could have been handled as well.
But just making clk_{enable,disable}() essentially stop working
was not a very good one at all.
I'll apply this patch to net-next, but I just wanted to point out
what an absolutely brain-dead way this was handled.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] net/irda: add clk_prepare/clk_unprepare to pxaficp_ir
2012-03-17 6:10 ` David Miller
@ 2012-03-17 10:43 ` Philipp Zabel
0 siblings, 0 replies; 3+ messages in thread
From: Philipp Zabel @ 2012-03-17 10:43 UTC (permalink / raw)
To: David Miller; +Cc: netdev, eric.y.miao, haojian.zhuang, samuel
On Sat, Mar 17, 2012 at 7:10 AM, David Miller <davem@davemloft.net> wrote:
> From: Philipp Zabel <philipp.zabel@gmail.com>
> Date: Thu, 15 Mar 2012 19:19:29 +0100
>
>> This patch adds clk_prepare/clk_unprepare calls to the pxaficp_ir
>> driver by using the helper functions clk_prepare_enable and
>> clk_disable_unprepare.
>>
>> Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
>
> This is terrible.
>
> So the problem was that clk_enable can't be invoked from atomic
> context, because it wants to take a mutex for some implementation.
>
> Therefore an existing routine with well defined semantics,
> clk_enable(), was turned into a NOP.
>
> And this silently breaks drivers.
>
> Instead of silently breaking things, make direct
> clk_enable()/clk_disable() invocations either result in a compile
> error or a run-time BUG_ON().
I expect that anybody who turns clk_enable/clk_disable into
no-ops for their platform will be sensible enough to take care of this.
The common struct clk framework already keeps a prepare_count
variable and clk_enable does WARN_ON(clk->prepare_count == 0).
In case of PXA, it's the clk_prepare/clk_unprepare calls that are the
no-ops anyway, so thanks for applying.
regards
Philipp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-17 10:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15 18:19 [PATCH] net/irda: add clk_prepare/clk_unprepare to pxaficp_ir Philipp Zabel
2012-03-17 6:10 ` David Miller
2012-03-17 10:43 ` Philipp Zabel
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).