[PATCH 20/20] headers: add of_property_present backport for kernels < 5.18

Yi Cong <[email protected]> Wed, 24 Jun 2026 15:38:44 +0800
Newsgroups org.kernel.vger.backports
Message-ID <[email protected]>
From: Yi Cong <[email protected]>

of_property_present() was introduced in v5.18 as a wrapper around
of_property_read_bool(). This is needed when CONFIG_OF is enabled
(e.g. arm64, loongarch defconfigs) as brcmfmac/of.c uses it.

Signed-off-by: Yi Cong <[email protected]>
---
 backport/backport-include/linux/of.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 backport/backport-include/linux/of.h

diff --git a/backport/backport-include/linux/of.h b/backport/backport-include/linux/of.h
new file mode 100644
index 00000000..7dc83e1f
--- /dev/null
+++ b/backport/backport-include/linux/of.h
@@ -0,0 +1,14 @@
+#ifndef __BACKPORT_LINUX_OF_H
+#define __BACKPORT_LINUX_OF_H
+#include_next <linux/of.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_IS_LESS(5,18,0)
+static inline bool of_property_present(const struct device_node *np,
+				       const char *propname)
+{
+	return of_property_read_bool(np, propname);
+}
+#endif
+
+#endif /* __BACKPORT_LINUX_OF_H */
-- 
2.43.0