* [PATCH] clk: clk_set_parent() with current parent shouldn't fail
@ 2015-02-02 22:11 Stephen Boyd
2015-02-03 9:42 ` Philipp Zabel
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2015-02-02 22:11 UTC (permalink / raw)
To: Mike Turquette, Stephen Boyd; +Cc: linux-kernel, Philipp Zabel
If a driver calls clk_set_parent(clk, parent) and parent is the
current parent of clk we shouldn't fail in any case.
Unfortunately if clk is a read-only mux we return -ENOSYS
because we think we can't change the parent, except for in this
special case where we don't actually need to change the parent at
all. Return 0 in such a situation.
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
Based on clk-next
drivers/clk/clk.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index b82714a84f5e..670c8c86ce9f 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1969,16 +1969,18 @@ static int clk_core_set_parent(struct clk_core *clk, struct clk_core *parent)
if (!clk)
return 0;
- /* verify ops for for multi-parent clks */
- if ((clk->num_parents > 1) && (!clk->ops->set_parent))
- return -ENOSYS;
-
/* prevent racing with updates to the clock topology */
clk_prepare_lock();
if (clk->parent == parent)
goto out;
+ /* verify ops for for multi-parent clks */
+ if ((clk->num_parents > 1) && (!clk->ops->set_parent)) {
+ ret = -ENOSYS;
+ goto out;
+ }
+
/* check that we are allowed to re-parent if the clock is in use */
if ((clk->flags & CLK_SET_PARENT_GATE) && clk->prepare_count) {
ret = -EBUSY;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: clk_set_parent() with current parent shouldn't fail
2015-02-02 22:11 [PATCH] clk: clk_set_parent() with current parent shouldn't fail Stephen Boyd
@ 2015-02-03 9:42 ` Philipp Zabel
2015-02-25 20:46 ` Mike Turquette
0 siblings, 1 reply; 3+ messages in thread
From: Philipp Zabel @ 2015-02-03 9:42 UTC (permalink / raw)
To: Stephen Boyd; +Cc: Mike Turquette, linux-kernel
Am Montag, den 02.02.2015, 14:11 -0800 schrieb Stephen Boyd:
> If a driver calls clk_set_parent(clk, parent) and parent is the
> current parent of clk we shouldn't fail in any case.
> Unfortunately if clk is a read-only mux we return -ENOSYS
> because we think we can't change the parent, except for in this
> special case where we don't actually need to change the parent at
> all. Return 0 in such a situation.
>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
regards
Philipp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: clk_set_parent() with current parent shouldn't fail
2015-02-03 9:42 ` Philipp Zabel
@ 2015-02-25 20:46 ` Mike Turquette
0 siblings, 0 replies; 3+ messages in thread
From: Mike Turquette @ 2015-02-25 20:46 UTC (permalink / raw)
To: Philipp Zabel, Stephen Boyd; +Cc: linux-kernel
Quoting Philipp Zabel (2015-02-03 01:42:34)
> Am Montag, den 02.02.2015, 14:11 -0800 schrieb Stephen Boyd:
> > If a driver calls clk_set_parent(clk, parent) and parent is the
> > current parent of clk we shouldn't fail in any case.
> > Unfortunately if clk is a read-only mux we return -ENOSYS
> > because we think we can't change the parent, except for in this
> > special case where we don't actually need to change the parent at
> > all. Return 0 in such a situation.
> >
> > Cc: Philipp Zabel <p.zabel@pengutronix.de>
> > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
>
> Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Applied to clk-next.
Regards,
Mike
>
> regards
> Philipp
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-25 20:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-02 22:11 [PATCH] clk: clk_set_parent() with current parent shouldn't fail Stephen Boyd
2015-02-03 9:42 ` Philipp Zabel
2015-02-25 20:46 ` Mike Turquette
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox