diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2021-10-16 18:52:40 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2021-10-19 00:02:23 +0200 |
commit | c803b3aae5a4cf3bc055764cfdc1329a4d3e5141 (patch) | |
tree | 13d9833d27109cb0e5ea62dd841e08776dad5c76 | |
parent | fe070f282cde38e4c9b021baf2d24f42061a2eaa (diff) | |
download | backports-c803b3aae5a4cf3bc055764cfdc1329a4d3e5141.tar.gz |
headers: Add function devm_clk_get_optional()
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@hauke-m.de>
-rw-r--r-- | backport/backport-include/linux/clk.h | 20 |
1 files changed, 20 insertions, 0 deletions
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 */ |