From: Stephen Boyd Date: Thu, 21 Apr 2016 21:47:18 +0000 (-0700) Subject: Merge branch 'clk-hw-register' (early part) into clk-next X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=58657d189a2f626a568308f70a6b34255650c87e;p=linux-beck.git Merge branch 'clk-hw-register' (early part) into clk-next * 'clk-hw-register' (early part): clk: fixed-rate: Add hw based registration APIs clk: gpio: Add hw based registration APIs clk: composite: Add hw based registration APIs clk: fractional-divider: Add hw based registration APIs clk: fixed-factor: Add hw based registration APIs clk: mux: Add hw based registration APIs clk: gate: Add hw based registration APIs clk: divider: Add hw based registration APIs clkdev: Add clk_hw based registration APIs clk: Add clk_hw OF clk providers clk: Add {devm_}clk_hw_{register,unregister}() APIs clkdev: Remove clk_register_clkdevs() --- 58657d189a2f626a568308f70a6b34255650c87e diff --cc drivers/clk/clk-composite.c index 8aec4b3d5859,463fadd5a68f..00269de2f390 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@@ -317,20 -288,22 +321,37 @@@ struct clk_hw *clk_hw_register_composit err: kfree(composite); - return clk; + return hw; + } + + struct clk *clk_register_composite(struct device *dev, const char *name, + const char * const *parent_names, int num_parents, + struct clk_hw *mux_hw, const struct clk_ops *mux_ops, + struct clk_hw *rate_hw, const struct clk_ops *rate_ops, + struct clk_hw *gate_hw, const struct clk_ops *gate_ops, + unsigned long flags) + { + struct clk_hw *hw; + + hw = clk_hw_register_composite(dev, name, parent_names, num_parents, + mux_hw, mux_ops, rate_hw, rate_ops, gate_hw, gate_ops, + flags); + if (IS_ERR(hw)) + return ERR_CAST(hw); + return hw->clk; } + +void clk_unregister_composite(struct clk *clk) +{ + struct clk_composite *composite; + struct clk_hw *hw; + + hw = __clk_get_hw(clk); + if (!hw) + return; + + composite = to_clk_composite(hw); + + clk_unregister(clk); + kfree(composite); +} diff --cc include/linux/clk-provider.h index 02a8f15b528a,c3fc042d517c..0c72204c75fc --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@@ -604,7 -645,13 +646,14 @@@ struct clk *clk_register_composite(stru struct clk_hw *rate_hw, const struct clk_ops *rate_ops, struct clk_hw *gate_hw, const struct clk_ops *gate_ops, unsigned long flags); +void clk_unregister_composite(struct clk *clk); + struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name, + const char * const *parent_names, int num_parents, + struct clk_hw *mux_hw, const struct clk_ops *mux_ops, + struct clk_hw *rate_hw, const struct clk_ops *rate_ops, + struct clk_hw *gate_hw, const struct clk_ops *gate_ops, + unsigned long flags); + void clk_hw_unregister_composite(struct clk_hw *hw); /*** * struct clk_gpio_gate - gpio gated clock