diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2024-03-15 13:15:18 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-03-15 13:15:18 +0100 |
commit | e4a37472999e8b8305cdcc77998514fae7c785d1 (patch) | |
tree | cc4ca3a24c07a4e861781cfe54e83dd7b3933ee8 /include/linux | |
parent | 22de6c70a26c3c62ddb03a89602fb5d720c7c860 (diff) | |
parent | 276048a59a225f543e16563ac35103cfe5f2a6e8 (diff) | |
download | barebox-e4a37472999e8b8305cdcc77998514fae7c785d1.tar.gz barebox-e4a37472999e8b8305cdcc77998514fae7c785d1.tar.xz |
Merge branch 'for-next/hwrng'
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/clk.h | 33 | ||||
-rw-r--r-- | include/linux/hw_random.h | 6 |
2 files changed, 39 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 diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h index 9143ba1f8d..ff6d3bb582 100644 --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h @@ -33,6 +33,7 @@ struct hwrng { struct cdev cdev; struct device *dev; void *buf; + unsigned long priv; }; /* Register a new Hardware Random Number Generator driver. */ @@ -51,4 +52,9 @@ static inline int hwrng_get_data(struct hwrng *rng, void *buffer, size_t size, i void hwrng_unregister(struct hwrng *rng); +static inline long hwrng_yield(struct hwrng *rng) +{ + return 0; +} + #endif /* LINUX_HWRANDOM_H_ */ |