Add .determine_rate to composite clk

2 messages, 2 authors, 2014-01-14 · open the first message on its own page

Add .determine_rate to composite clk

From: Lemon Dai <hidden>
Date: 2014-01-14 14:08:44

Hi Maxime,

The commit 107f3198 in Mike's clk-next branch shows that:
(about line 72 in drivers/clk/clk-composite.c)

        } else if (mux_hw && mux_ops && mux_ops->determine_rate) {
                mux_hw->clk = hw->clk;
                return mux_ops->determine_rate(rate_hw, rate, best_parent_rate,
                                               best_parent_p);


 It should be fixed as follows, at least for reason that  NULL rate_hw
may be used in the old code,

        } else if (mux_hw && mux_ops && mux_ops->determine_rate) {
                mux_hw->clk = hw->clk;
 -              return mux_ops->determine_rate(rate_hw, rate, best_parent_rate,
 +             return mux_ops->determine_rate(mux_hw, rate, best_parent_rate,
                                               best_parent_p);

--
Best regards,
Lemon Dai

On Sun, Jan 12, 2014 at 11:56 AM, Lemon Dai [off-list ref] wrote:
Hi  Maxime,

Thank you for your reply and suggestion.
 I am sorry for sending  a mail with such a lot of style issues before
reading Documentation/SubmittingPatches file.

Best wishes,
Lemon

On Sat, Jan 11, 2014 at 6:28 PM, Maxime Ripard
[off-list ref] wrote:
quoted
Hi Lemon,

On Sat, Jan 11, 2014 at 05:15:58PM +0800, Lemon Dai wrote:
quoted
Hi Mike,

As .determine_rate was added to struct clk and clk_mux_ops, maybe we
should also copy determine_rate operation from mux_ops to
clk_composite_ops in clk_register_composite( ),
to make composite clk implementation more generic.
A similar patch is on its way to 3.14 already (commit 107f3198 in
Mike's clk-next branch).

Also, for future contributions, I'd suggest to read the
Documentation/SubmittingPatches file. Your patch had several style
issues that are covered in this file.

Thanks!
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Add .determine_rate to composite clk

From: Mike Turquette <hidden>
Date: 2014-01-14 21:03:19

Quoting Lemon Dai (2014-01-14 06:08:44)
Hi Maxime,

The commit 107f3198 in Mike's clk-next branch shows that:
(about line 72 in drivers/clk/clk-composite.c)

        } else if (mux_hw && mux_ops && mux_ops->determine_rate) {
                mux_hw->clk = hw->clk;
                return mux_ops->determine_rate(rate_hw, rate, best_parent_rate,
                                               best_parent_p);


 It should be fixed as follows, at least for reason that  NULL rate_hw
may be used in the old code,

        } else if (mux_hw && mux_ops && mux_ops->determine_rate) {
                mux_hw->clk = hw->clk;
 -              return mux_ops->determine_rate(rate_hw, rate, best_parent_rate,
 +             return mux_ops->determine_rate(mux_hw, rate, best_parent_rate,
                                               best_parent_p);
Hi Lemon Dai,

I have applied this fix to clk-next. The patch is below:


From ca01f3f60aa864d7ee8124ca597d4010378926b5 Mon Sep 17 00:00:00 2001
From: Mike Turquette <redacted>
Date: Tue, 14 Jan 2014 12:56:01 -0800
Subject: [PATCH] clk: composite: pass mux_hw into determine_rate

The composite clock's .determine_rate implementation can call the
underyling .determine_rate callback corresponding to rate_hw or the
underlying .determine_rate callback corresponding to mux_hw. In both
cases we pass in rate_hw, which is wrong. Fixed by passing mux_hw into
the correct callback.

Reported-by: Lemon Dai <redacted>
Signed-off-by: Mike Turquette <redacted>
---
 drivers/clk/clk-composite.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index 753d0b7..57a078e 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -71,7 +71,7 @@ static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate,
 						best_parent_p);
 	} else if (mux_hw && mux_ops && mux_ops->determine_rate) {
 		mux_hw->clk = hw->clk;
-		return mux_ops->determine_rate(rate_hw, rate, best_parent_rate,
+		return mux_ops->determine_rate(mux_hw, rate, best_parent_rate,
 					       best_parent_p);
 	} else {
 		pr_err("clk: clk_composite_determine_rate function called, but no mux or rate callback set!\n");
-- 
1.8.3.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help