Browse Source

wlan_platform: Add CONFIG_CNSS_OUT_OF_TREE flag

Use CONFIG_CNSS_OUT_OF_TREE to control if CNSS family drivers are
built from in-kernel-tree source or out-of-kernel-tree source since
the exposed header files will be in different paths. This is also
for backward compatibility.

Change-Id: I24111fdb76607bf911c29e415d42d25609f9b26c
Yue Ma 3 years ago
parent
commit
7e3754303f

+ 7 - 1
cnss2/Makefile

@@ -1,8 +1,14 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+ifeq ($(CONFIG_CNSS_OUT_OF_TREE),y)
+ccflags-y += -I$(WLAN_PLATFORM_ROOT)/cnss_utils
+ccflags-y += -I$(WLAN_PLATFORM_ROOT)/inc
+else
+ccflags-y += -I$(srctree)/drivers/net/wireless/cnss_utils
+endif
+
 obj-$(CONFIG_CNSS2) += cnss2.o
 
-ccflags-y += -I$(srctree)/drivers/net/wireless/cnss_utils/
 cnss2-y := main.o
 cnss2-y += bus.o
 cnss2-y += debug.o

+ 4 - 0
cnss2/main.h

@@ -19,7 +19,11 @@
 #include <linux/pm_qos.h>
 #include <linux/platform_device.h>
 #include <linux/time64.h>
+#ifdef CONFIG_CNSS_OUT_OF_TREE
+#include "cnss2.h"
+#else
 #include <net/cnss2.h>
+#endif
 #if IS_ENABLED(CONFIG_QCOM_MEMORY_DUMP_V2)
 #include <soc/qcom/memory_dump.h>
 #endif

+ 4 - 0
cnss_genl/Makefile

@@ -1,3 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+ifeq ($(CONFIG_CNSS_OUT_OF_TREE),y)
+ccflags-y += -I$(WLAN_PLATFORM_ROOT)/inc
+endif
+
 obj-$(CONFIG_CNSS_GENL) := cnss_nl.o

+ 4 - 0
cnss_genl/cnss_nl.c

@@ -2,7 +2,11 @@
 /* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. */
 
 #include <net/genetlink.h>
+#ifdef CONFIG_CNSS_OUT_OF_TREE
+#include "cnss_nl.h"
+#else
 #include <net/cnss_nl.h>
+#endif
 #include <linux/module.h>
 #include <linux/of.h>
 

+ 4 - 0
cnss_prealloc/Makefile

@@ -1,3 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+ifeq ($(CONFIG_CNSS_OUT_OF_TREE),y)
+ccflags-y += -I$(WLAN_PLATFORM_ROOT)/inc
+endif
+
 obj-$(CONFIG_WCNSS_MEM_PRE_ALLOC) += cnss_prealloc.o

+ 4 - 0
cnss_prealloc/cnss_prealloc.c

@@ -7,7 +7,11 @@
 #include <linux/mm.h>
 #include <linux/err.h>
 #include <linux/of.h>
+#ifdef CONFIG_CNSS_OUT_OF_TREE
+#include "cnss_prealloc.h"
+#else
 #include <net/cnss_prealloc.h>
+#endif
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("CNSS prealloc driver");

+ 5 - 0
cnss_utils/Makefile

@@ -1,6 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+ifeq ($(CONFIG_CNSS_OUT_OF_TREE),y)
+ccflags-y += -I$(WLAN_PLATFORM_ROOT)/inc
+endif
+
 obj-$(CONFIG_CNSS_UTILS) += cnss_utils.o
+
 obj-$(CONFIG_CNSS_QMI_SVC) += wlan_firmware_service.o
 wlan_firmware_service-y := wlan_firmware_service_v01.o device_management_service_v01.o
 

+ 4 - 0
cnss_utils/cnss_utils.c

@@ -9,7 +9,11 @@
 #include <linux/etherdevice.h>
 #include <linux/debugfs.h>
 #include <linux/of.h>
+#ifdef CONFIG_CNSS_OUT_OF_TREE
+#include "cnss_utils.h"
+#else
 #include <net/cnss_utils.h>
+#endif
 
 #define CNSS_MAX_CH_NUM 157
 struct cnss_unsafe_channel_list {