From: Gregory Greenman <gregory.greenman@xxxxxxxxx> Signed-off-by: Gregory Greenman <gregory.greenman@xxxxxxxxx> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> --- backport/backport-include/linux/device.h | 6 ++++++ patches/0108-namespace-arg-const.cocci | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 patches/0108-namespace-arg-const.cocci diff --git a/backport/backport-include/linux/device.h b/backport/backport-include/linux/device.h index 46f2190b06c4..1e5a5534340e 100644 --- a/backport/backport-include/linux/device.h +++ b/backport/backport-include/linux/device.h @@ -7,4 +7,10 @@ struct device_attribute dev_attr_##_name = __ATTR_RW_MODE(_name, 0600) #endif +#if LINUX_VERSION_IS_LESS(6,2,0) +#define __ns_const +#else +#define __ns_const const +#endif + #endif /* __BACKPORT_DEVICE_H_ */ diff --git a/patches/0108-namespace-arg-const.cocci b/patches/0108-namespace-arg-const.cocci new file mode 100644 index 000000000000..a03f32c0010e --- /dev/null +++ b/patches/0108-namespace-arg-const.cocci @@ -0,0 +1,20 @@ +@ns@ +identifier cls, fn; +identifier __class =~ "class"; +@@ +struct __class cls = { + .namespace = fn, + ... +}; + +@@ +identifier ns.fn, d; +attribute name __ns_const; +@@ +fn( +-const struct device *d ++__ns_const struct device *d + ) +{ + ... +} -- 2.45.1