1 // SPDX-License-Identifier: GPL-2.0 2 3 #include <linux/clk.h> 4 5 /* 6 * The "inline" implementation of below helpers are only available when 7 * CONFIG_HAVE_CLK or CONFIG_HAVE_CLK_PREPARE aren't set. 8 */ 9 #ifndef CONFIG_HAVE_CLK rust_helper_clk_get(struct device * dev,const char * id)10struct clk *rust_helper_clk_get(struct device *dev, const char *id) 11 { 12 return clk_get(dev, id); 13 } 14 rust_helper_clk_put(struct clk * clk)15void rust_helper_clk_put(struct clk *clk) 16 { 17 clk_put(clk); 18 } 19 rust_helper_clk_enable(struct clk * clk)20int rust_helper_clk_enable(struct clk *clk) 21 { 22 return clk_enable(clk); 23 } 24 rust_helper_clk_disable(struct clk * clk)25void rust_helper_clk_disable(struct clk *clk) 26 { 27 clk_disable(clk); 28 } 29 rust_helper_clk_get_rate(struct clk * clk)30unsigned long rust_helper_clk_get_rate(struct clk *clk) 31 { 32 return clk_get_rate(clk); 33 } 34 rust_helper_clk_set_rate(struct clk * clk,unsigned long rate)35int rust_helper_clk_set_rate(struct clk *clk, unsigned long rate) 36 { 37 return clk_set_rate(clk, rate); 38 } 39 #endif 40 41 #ifndef CONFIG_HAVE_CLK_PREPARE rust_helper_clk_prepare(struct clk * clk)42int rust_helper_clk_prepare(struct clk *clk) 43 { 44 return clk_prepare(clk); 45 } 46 rust_helper_clk_unprepare(struct clk * clk)47void rust_helper_clk_unprepare(struct clk *clk) 48 { 49 clk_unprepare(clk); 50 } 51 #endif 52 rust_helper_clk_get_optional(struct device * dev,const char * id)53struct clk *rust_helper_clk_get_optional(struct device *dev, const char *id) 54 { 55 return clk_get_optional(dev, id); 56 } 57 rust_helper_clk_prepare_enable(struct clk * clk)58int rust_helper_clk_prepare_enable(struct clk *clk) 59 { 60 return clk_prepare_enable(clk); 61 } 62 rust_helper_clk_disable_unprepare(struct clk * clk)63void rust_helper_clk_disable_unprepare(struct clk *clk) 64 { 65 clk_disable_unprepare(clk); 66 } 67