summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-03-13 11:56:31 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-15 08:07:39 +0100
commit276048a59a225f543e16563ac35103cfe5f2a6e8 (patch)
treeede1676501134ea611db2ca77a978b048f0933be /include/linux
parent45080577a633cb4b2270e2dcbcef0752913d692d (diff)
downloadbarebox-276048a59a225f543e16563ac35103cfe5f2a6e8.tar.gz
barebox-276048a59a225f543e16563ac35103cfe5f2a6e8.tar.xz
hw_random: add OMAP RNG driver
To enable proper hardening with stack protector, add support for the OMAP RNG driver. This has been tested on a Beagle Bone Black. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240313105631.686778-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/clk.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h
index fe0b1ce3e3..7ba0679d03 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -1098,6 +1098,39 @@ static inline struct clk *clk_get_enabled(struct device *dev, const char *id)
}
/**
+ * clk_get_optional_enabled - clk_get_optional() +
+ * clk_prepare_enable()
+ * @dev: device for clock "consumer"
+ * @id: clock consumer ID
+ *
+ * Return: a struct clk corresponding to the clock producer, or
+ * valid IS_ERR() condition containing errno. The implementation
+ * uses @dev and @id to determine the clock consumer, and thereby
+ * the clock producer. If no such clk is found, it returns NULL
+ * which serves as a dummy clk. That's the only difference compared
+ * to clk_get_enabled().
+ *
+ * The returned clk (if valid) is enabled.
+ */
+static inline struct clk *clk_get_optional_enabled(struct device *dev, const char *id)
+{
+ struct clk *clk;
+ int ret;
+
+ clk = clk_get_optional(dev, id);
+ if (IS_ERR_OR_NULL(clk))
+ return clk;
+
+ ret = clk_enable(clk);
+ if (ret) {
+ clk_put(clk);
+ return ERR_PTR(ret);
+ }
+
+ return clk;
+}
+
+/**
* clk_get_if_available - get clock, ignoring known unavailable clock controller
* @dev: device for clock "consumer"
* @id: clock consumer ID