diff mbox

backports: add definition for dev_of_node()

Message ID 1486060697-28356-1-git-send-email-arend.vanspriel@broadcom.com (mailing list archive)
State Accepted
Headers show

Commit Message

Arend van Spriel Feb. 2, 2017, 6:38 p.m. UTC
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.

Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
 backport/backport-include/linux/device.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox

Patch

diff --git a/backport/backport-include/linux/device.h b/backport/backport-include/linux/device.h
index 079b00d..4a1ca64 100644
--- a/backport/backport-include/linux/device.h
+++ b/backport/backport-include/linux/device.h
@@ -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 */