@@ -1435,4 +1435,27 @@ static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
}
#endif
+#ifdef NEED_CLK_HELPERS
+#include <linux/clk.h>
+static inline int clk_prepare_enable(struct clk *clk)
+{
+ int ret;
+
+ ret = clk_prepare(clk);
+ if (ret)
+ return ret;
+ ret = clk_enable(clk);
+ if (ret)
+ clk_unprepare(clk);
+
+ return ret;
+}
+
+static inline void clk_disable_unprepare(struct clk *clk)
+{
+ clk_disable(clk);
+ clk_unprepare(clk);
+}
+#endif
+
#endif /* _COMPAT_H */
@@ -606,6 +606,7 @@ sub check_other_dependencies()
check_files_for_func("devm_kmalloc", "NEED_DEVM_KMALLOC", "include/linux/device.h");
check_files_for_func("usb_speed_string", "NEED_USB_SPEED_STRING", "include/linux/usb/ch9.h");
check_files_for_func("ether_addr_equal", "NEED_ETHER_ADDR_EQUAL", "include/linux/etherdevice.h");
+ check_files_for_func("clk_prepare_enable", "NEED_CLOCK_HELPERS", "include/linux/clk.h");
# For tests for uapi-dependent logic
check_files_for_func_uapi("usb_endpoint_maxp", "NEED_USB_ENDPOINT_MAXP", "usb/ch9.h");
The clk_prepare_enable() and clk_disable_unprepare() clock helpers were introduced in kernel v3.3. Add them to compat.h for kernels that don't provide them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- v4l/compat.h | 23 +++++++++++++++++++++++ v4l/scripts/make_config_compat.pl | 1 + 2 files changed, 24 insertions(+)