Skip to contentSkip to conversation

backports: add definition for dev_of_node()

PATCH New Arend van Spriel 1 participant 1 message Feb 2, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backports: add definition for dev_of_node()

Since 4.10-rc1 there is use of dev_of_node() added to cfg80211, which was introduced in 4.1 kernel. So backport the function for older kernels.

---
 backport/backport-include/linux/device.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
backport/backport-include/linux/device.h +12 -0
index 079b00d..4a1ca64 100644
@@ -252,4 +252,16 @@ extern char *devm_kasprintf(struct device *dev, gfp_t gfp,
 			    const char *fmt, ...);
 #endif /* < 3.17 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
+#define dev_of_node LINUX_BACKPORT(dev_of_node)
+static inline struct device_node *dev_of_node(struct device *dev)
+{
+#ifndef CONFIG_OF
+	return NULL;
+#else
+	return dev->of_node;
+#endif
+}
+#endif
+
 #endif /* __BACKPORT_DEVICE_H */
Signature · 4 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in