diff options
author | Ahmad Fatoum <ahmad@a3f.at> | 2023-04-24 14:02:11 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-05-02 11:23:57 +0200 |
commit | 69435e9707b50de89cd75dfa3d5f777d0d77b3d1 (patch) | |
tree | 3bbffd53090a64f603fa05a10fd6d7032b4b26e1 /include/linux/kernel.h | |
parent | f5d6ae54b31b5832c67bf38d5457021856c207c2 (diff) | |
download | barebox-69435e9707b50de89cd75dfa3d5f777d0d77b3d1.tar.gz barebox-69435e9707b50de89cd75dfa3d5f777d0d77b3d1.tar.xz |
clk: implement clk_to_clk_hw using container_of_safe
We basically opencode container_of_safe. The kernel implementation of
container_of has also got a better diagnostic for mismatched arguments,
so let's import it and use it.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Link: https://lore.barebox.org/20230424120211.115610-1-ahmad@a3f.at
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 44fc02df0b..0eb7bd21fe 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -7,6 +7,7 @@ #include <linux/barebox-wrapper.h> #include <linux/limits.h> #include <linux/math64.h> +#include <linux/container_of.h> #define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1) #define ALIGN_DOWN(x, a) ALIGN((x) - ((a) - 1), (a)) @@ -256,17 +257,6 @@ extern int hex_to_bin(char ch); extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); extern char *bin2hex(char *dst, const void *src, size_t count); -/** - * container_of - cast a member of a structure out to the containing structure - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - /* * swap - swap value of @a and @b */ |