diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-05-21 15:43:37 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-05-21 15:43:46 +0200 |
commit | 31d782ce046db726335fcda4c5cad82db9b45e63 (patch) | |
tree | 2c647a91dbd818c075626476d3a96e80043c95cc | |
parent | 985526ed455a72d7bfba300899a6c23eb816e031 (diff) | |
download | patches-31d782ce046db726335fcda4c5cad82db9b45e63.tar.gz |
add container of const patch
-rw-r--r-- | container_of_const_switch.patch | 31 | ||||
-rw-r--r-- | series | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/container_of_const_switch.patch b/container_of_const_switch.patch new file mode 100644 index 00000000000000..649b168578bd3d --- /dev/null +++ b/container_of_const_switch.patch @@ -0,0 +1,31 @@ + + +--- + include/linux/container_of.h | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/include/linux/container_of.h ++++ b/include/linux/container_of.h +@@ -15,7 +15,7 @@ + * + * WARNING: any const qualifier of @ptr is lost. + */ +-#define container_of(ptr, type, member) ({ \ ++#define __container_of(ptr, type, member) ({ \ + void *__mptr = (void *)(ptr); \ + static_assert(__same_type(*(ptr), ((type *)0)->member) || \ + __same_type(*(ptr), void), \ +@@ -31,8 +31,11 @@ + */ + #define container_of_const(ptr, type, member) \ + _Generic(ptr, \ +- const typeof(*(ptr)) *: ((const type *)container_of(ptr, type, member)),\ +- default: ((type *)container_of(ptr, type, member)) \ ++ const typeof(*(ptr)) *: ((const type *)__container_of(ptr, type, member)),\ ++ default: ((type *)__container_of(ptr, type, member)) \ + ) + ++#define container_of(ptr, type, member) container_of_const(ptr, type, member) ++ ++ + #endif /* _LINUX_CONTAINER_OF_H */ @@ -1,4 +1,5 @@ # +container_of_const_switch.patch 0001-misc-convert-to-guards.patch 0001-USB-gadget-dummy_hcd-switch-char-to-u8.patch 0001-driver-core-add-printk-debugging.patch |