[PATCH 45/47] headers: Add function devm_clk_get_optional()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The devm_clk_get_optional() function was added with kernel 5.1 and is
used by the wilc1000 driver now.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/clk.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 backport/backport-include/linux/clk.h

diff --git a/backport/backport-include/linux/clk.h b/backport/backport-include/linux/clk.h
new file mode 100644
index 00000000..7b4ab5b0
--- /dev/null
+++ b/backport/backport-include/linux/clk.h
@@ -0,0 +1,20 @@
+#ifndef __BACKPORT_LINUX_CLK_H
+#define __BACKPORT_LINUX_CLK_H
+#include_next <linux/clk.h>
+
+#include <linux/version.h>
+#if LINUX_VERSION_IS_LESS(5,1,0)
+
+static inline
+struct clk *devm_clk_get_optional(struct device *dev, const char *id)
+{
+	struct clk *clk = devm_clk_get(dev, id);
+
+	if (clk == ERR_PTR(-ENOENT))
+		return NULL;
+
+	return clk;
+}
+
+#endif /* < 5.1 */
+#endif /* __BACKPORT_LINUX_CLK_H */
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux