Message ID | 1473731689-11974-2-git-send-email-wenyou.yang@atmel.com |
---|---|
State | Accepted |
Commit | 3f56b1321593c0081e77a3bc900177e6cf2f21d6 |
Headers | show |
On 09/12/2016 07:54 PM, Wenyou Yang wrote: > In order to make clk->dev available in ops->of_xlate() to get the > clock ID from the 'reg' property of the clock node, assign the > clk->dev before calling ops->of_xlate(). It does seem reasonable to me to allow using the same of_xlate implementation across multiple similar-but-different clock providers, and this change is required to allow that. I note that the reset and power domain uclasses already work this way. So, from that perspective, you get an ack. > diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c > @@ -80,6 +80,9 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk) > __func__, ret); > return ret; > } > + > + clk->dev = dev_clk; That assignment also happens in clk_request() itself. I'm tempted to say that we should modify clk_request() to remove the dev parameter, and remove the assignment of clk->dev. clk_request()'s documentation says: > * @clock: A pointer to a clock struct to initialize. The caller must > * have already initialized any field in this struct which the > * clock provider uses to identify the clock. ... and since clk->dev is a field that is used to identify the clock, it really should be set already, thus removing the need for this function to set clk->dev. However, I suppose we can clean that up later, so, Acked-by: Stephen Warren <swarren@nvidia.com>
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 4d78e3f..4a3248b 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -80,6 +80,9 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk) __func__, ret); return ret; } + + clk->dev = dev_clk; + ops = clk_dev_ops(dev_clk); if (ops->of_xlate)
In order to make clk->dev available in ops->of_xlate() to get the clock ID from the 'reg' property of the clock node, assign the clk->dev before calling ops->of_xlate(). Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> --- drivers/clk/clk-uclass.c | 3 +++ 1 file changed, 3 insertions(+)