diff mbox series

[12/74] backports: adjust namespace argument const

Message ID 20240524190906.2fce117fbf36.Iedd62c5e3204ee9d1ba2b370a930d19409d7ef37@changeid (mailing list archive)
State New, archived
Headers show
Series backport updates from Intel | expand

Commit Message

Johannes Berg May 24, 2024, 5:07 p.m. UTC
From: Gregory Greenman <gregory.greenman@intel.com>

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 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 mbox series

Patch

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
+ )
+{
+	...
+}