Merge "[qca-nss-ecm] Add DT condition."
diff --git a/ecm_init.c b/ecm_init.c
index fd16445..ec704b2 100644
--- a/ecm_init.c
+++ b/ecm_init.c
@@ -14,6 +14,7 @@
**************************************************************************
*/
#include <linux/module.h>
+#include <linux/of.h>
extern int ecm_tracker_init(void);
extern void ecm_tracker_exit(void);
@@ -79,6 +80,16 @@
static int __init ecm_init(void)
{
int ret;
+
+ /*
+ * Run only for IPQ8064 platform, if the device tree is used.
+ */
+#ifdef CONFIG_OF
+ if (!of_machine_is_compatible("qcom,ipq8064")) {
+ printk(KERN_WARNING "Not compatible platform for ECM\n");
+ return 0;
+ }
+#endif
printk(KERN_INFO "ECM init\n");
ret = ecm_tracker_init();
@@ -212,6 +223,17 @@
{
printk(KERN_INFO "ECM exit\n");
+ /*
+ * If the platform is not IPQ8064 and device tree is enabled,
+ * this means ECM started but none of the features are used.
+ * So, just return here.
+ */
+#ifdef CONFIG_OF
+ if (!of_machine_is_compatible("qcom,ipq8064")) {
+ return;
+ }
+#endif
+
/* call stop on anything that requires a prepare-to-exit signal */
printk(KERN_INFO "stop conntrack notifier\n");
ecm_conntrack_notifier_stop(1);