Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: u300: Migrate to clk_hw based registration APIs

Now that we have clk_hw based provider APIs to register clks, we
can get rid of struct clk pointers while registering clks in
these drivers, allowing us to move closer to a clear split of
consumer and provider clk APIs.

Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

authored by

Stephen Boyd and committed by
Stephen Boyd
fb2cd7d0 7b38d1b2

+33 -26
+33 -26
drivers/clk/clk-u300.c
··· 689 689 .set_rate = syscon_clk_set_rate, 690 690 }; 691 691 692 - static struct clk * __init 692 + static struct clk_hw * __init 693 693 syscon_clk_register(struct device *dev, const char *name, 694 694 const char *parent_name, unsigned long flags, 695 695 bool hw_ctrld, ··· 697 697 void __iomem *en_reg, u8 en_bit, 698 698 u16 clk_val) 699 699 { 700 - struct clk *clk; 700 + struct clk_hw *hw; 701 701 struct clk_syscon *sclk; 702 702 struct clk_init_data init; 703 + int ret; 703 704 704 705 sclk = kzalloc(sizeof(struct clk_syscon), GFP_KERNEL); 705 706 if (!sclk) { ··· 723 722 sclk->en_bit = en_bit; 724 723 sclk->clk_val = clk_val; 725 724 726 - clk = clk_register(dev, &sclk->hw); 727 - if (IS_ERR(clk)) 725 + hw = &sclk->hw; 726 + ret = clk_hw_register(dev, hw); 727 + if (ret) { 728 728 kfree(sclk); 729 + hw = ERR_PTR(ret); 730 + } 729 731 730 - return clk; 732 + return hw; 731 733 } 732 734 733 735 #define U300_CLK_TYPE_SLOW 0 ··· 872 868 873 869 static void __init of_u300_syscon_clk_init(struct device_node *np) 874 870 { 875 - struct clk *clk = ERR_PTR(-EINVAL); 871 + struct clk_hw *hw = ERR_PTR(-EINVAL); 876 872 const char *clk_name = np->name; 877 873 const char *parent_name; 878 874 void __iomem *res_reg; ··· 915 911 const struct u300_clock *u3clk = &u300_clk_lookup[i]; 916 912 917 913 if (u3clk->type == clk_type && u3clk->id == clk_id) 918 - clk = syscon_clk_register(NULL, 919 - clk_name, parent_name, 920 - 0, u3clk->hw_ctrld, 921 - res_reg, u3clk->id, 922 - en_reg, u3clk->id, 923 - u3clk->clk_val); 914 + hw = syscon_clk_register(NULL, clk_name, parent_name, 915 + 0, u3clk->hw_ctrld, 916 + res_reg, u3clk->id, 917 + en_reg, u3clk->id, 918 + u3clk->clk_val); 924 919 } 925 920 926 - if (!IS_ERR(clk)) { 927 - of_clk_add_provider(np, of_clk_src_simple_get, clk); 921 + if (!IS_ERR(hw)) { 922 + of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); 928 923 929 924 /* 930 925 * Some few system clocks - device tree does not ··· 931 928 * for now we add these three clocks here. 932 929 */ 933 930 if (clk_type == U300_CLK_TYPE_REST && clk_id == 5) 934 - clk_register_clkdev(clk, NULL, "pl172"); 931 + clk_hw_register_clkdev(hw, NULL, "pl172"); 935 932 if (clk_type == U300_CLK_TYPE_REST && clk_id == 9) 936 - clk_register_clkdev(clk, NULL, "semi"); 933 + clk_hw_register_clkdev(hw, NULL, "semi"); 937 934 if (clk_type == U300_CLK_TYPE_REST && clk_id == 12) 938 - clk_register_clkdev(clk, NULL, "intcon"); 935 + clk_hw_register_clkdev(hw, NULL, "intcon"); 939 936 } 940 937 } 941 938 ··· 1114 1111 .set_rate = mclk_clk_set_rate, 1115 1112 }; 1116 1113 1117 - static struct clk * __init 1114 + static struct clk_hw * __init 1118 1115 mclk_clk_register(struct device *dev, const char *name, 1119 1116 const char *parent_name, bool is_mspro) 1120 1117 { 1121 - struct clk *clk; 1118 + struct clk_hw *hw; 1122 1119 struct clk_mclk *mclk; 1123 1120 struct clk_init_data init; 1121 + int ret; 1124 1122 1125 1123 mclk = kzalloc(sizeof(struct clk_mclk), GFP_KERNEL); 1126 1124 if (!mclk) { ··· 1137 1133 mclk->hw.init = &init; 1138 1134 mclk->is_mspro = is_mspro; 1139 1135 1140 - clk = clk_register(dev, &mclk->hw); 1141 - if (IS_ERR(clk)) 1136 + hw = &mclk->hw; 1137 + ret = clk_hw_register(dev, hw); 1138 + if (ret) { 1142 1139 kfree(mclk); 1140 + hw = ERR_PTR(ret); 1141 + } 1143 1142 1144 - return clk; 1143 + return hw; 1145 1144 } 1146 1145 1147 1146 static void __init of_u300_syscon_mclk_init(struct device_node *np) 1148 1147 { 1149 - struct clk *clk = ERR_PTR(-EINVAL); 1148 + struct clk_hw *hw; 1150 1149 const char *clk_name = np->name; 1151 1150 const char *parent_name; 1152 1151 1153 1152 parent_name = of_clk_get_parent_name(np, 0); 1154 - clk = mclk_clk_register(NULL, clk_name, parent_name, false); 1155 - if (!IS_ERR(clk)) 1156 - of_clk_add_provider(np, of_clk_src_simple_get, clk); 1153 + hw = mclk_clk_register(NULL, clk_name, parent_name, false); 1154 + if (!IS_ERR(hw)) 1155 + of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); 1157 1156 } 1158 1157 1159 1158 static const struct of_device_id u300_clk_match[] __initconst = {