qcacld-3.0: Add support for multiple instances of the host driver

Propagation from qcacld-2.0 to qcacld-3.0.

If the module name is changed to something other than wlan in
Makefile or Kbuild, then MULTI_IF_NAME is defined to be the module name.
When MULTI_IF_NAME is defined, the names for the config files, log files,
and firmware files are prepended or appended with MULTI_IF_NAME. This
prevents file name collisions allowing multiple instances of this driver
to be loaded with different module names.

Change-Id: Id880c5fe423eb0b2a2c01677d8fa7c4a784c74df
CRs-Fixed: 946520
diff --git a/Kbuild b/Kbuild
index ebdbbf1..68ce38d 100644
--- a/Kbuild
+++ b/Kbuild
@@ -1670,6 +1670,23 @@
 ifeq ($(call cc-option-yn, -Wheader-guard),y)
 EXTRA_CFLAGS += -Wheader-guard
 endif
+# If the module name is not "wlan", then the define MULTI_IF_NAME to be the
+# same a the module name. The host driver will then append MULTI_IF_NAME to
+# any string that must be unique for all instances of the driver on the system.
+# This allows multiple instances of the driver with different module names.
+# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
+# treat the driver as the primary driver.
+ifneq ($(MODNAME), wlan)
+CDEFINES += -DMULTI_IF_NAME=\"$(MODNAME)\"
+endif
+
+# WLAN_HDD_ADAPTER_MAGIC must be unique for all instances of the driver on the
+# system. If it is not defined, then the host driver will use the first 4
+# characters (including NULL) of MULTI_IF_NAME to construct
+# WLAN_HDD_ADAPTER_MAGIC.
+ifdef WLAN_HDD_ADAPTER_MAGIC
+CDEFINES += -DWLAN_HDD_ADAPTER_MAGIC=$(WLAN_HDD_ADAPTER_MAGIC)
+endif
 
 # Module information used by KBuild framework
 obj-$(CONFIG_QCA_CLD_WLAN) += $(MODNAME).o