Эх сурвалжийг харах

qcacld-3.0: Decouple state control file from module name

wlan_hdd_state_ctrl_param_create() creates a control file that is
used to synchronize the wlan driver with the Wi-Fi HAL in
userspace.

Currently the driver creates the file at the path /dev/<module>.

The WIFI_DRIVER_STATE_CTRL_PARAM configuration item defines the path
that the Wi-Fi HAL uses, and this is /dev/wlan.

So when the driver is built with a module name of "wlan" the file is
created at the expected path. However when the driver is built with a
different name, as is done when TARGET_MULTI_WLAN is enabled, the file
is not created at the expected path.

Therefore change the driver to always create the file at the path
specified in the WIFI_DRIVER_STATE_CTRL_PARAM configuration item.

In addition do not even enable the functionality if the
WIFI_DRIVER_STATE_CTRL_PARAM configuration item is not set
(i.e. on non-Android platforms).

Change-Id: I8a7f0a9b22e3f49d02f896150bd452f80af9c022
CRs-Fixed: 2905381
Jeff Johnson 4 жил өмнө
parent
commit
216957b430
3 өөрчлөгдсөн 40 нэмэгдсэн , 12 устгасан
  1. 8 0
      Android.mk
  2. 5 0
      Kbuild
  3. 27 12
      core/hdd/src/wlan_hdd_main.c

+ 8 - 0
Android.mk

@@ -130,6 +130,14 @@ ifneq ($(WLAN_CFG_OVERRIDE_$(LOCAL_DEV_NAME)),)
 KBUILD_OPTIONS += WLAN_CFG_OVERRIDE="$(WLAN_CFG_OVERRIDE_$(LOCAL_DEV_NAME))"
 endif
 
+# driver expects "/dev/<name>" for WIFI_DRIVER_STATE_CTRL_PARAM
+$(call wlog,WIFI_DRIVER_STATE_CTRL_PARAM=$(WIFI_DRIVER_STATE_CTRL_PARAM))
+PARAM := $(patsubst "%",%,$(WIFI_DRIVER_STATE_CTRL_PARAM))
+$(call wlog,PARAM=$(PARAM))
+ifeq ($(dir $(PARAM)),/dev/)
+KBUILD_OPTIONS += WLAN_CTRL_NAME=$(notdir $(PARAM))
+endif
+
 # Pass build options per chip to Kbuild. This will be injected from upper layer
 # makefile.
 #

+ 5 - 0
Kbuild

@@ -3957,6 +3957,11 @@ else
 	ccflags-y += -DWLAN_HOST_ARCH_ARM=1
 endif
 
+# Android wifi state control interface
+ifneq ($(WLAN_CTRL_NAME),)
+ccflags-y += -DWLAN_CTRL_NAME=\"$(WLAN_CTRL_NAME)\"
+endif
+
 # inject some build related information
 ifeq ($(CONFIG_BUILD_TAG), y)
 CLD_CHECKOUT = $(shell cd "$(WLAN_ROOT)" && \

+ 27 - 12
core/hdd/src/wlan_hdd_main.c

@@ -241,10 +241,6 @@
 int wlan_start_ret_val;
 static DECLARE_COMPLETION(wlan_start_comp);
 static qdf_atomic_t wlan_hdd_state_fops_ref;
-static unsigned int dev_num = 1;
-static struct cdev wlan_hdd_state_cdev;
-static struct class *class;
-static dev_t device;
 #ifndef MODULE
 static struct gwlan_loader *wlan_loader;
 static ssize_t wlan_boot_cb(struct kobject *kobj,
@@ -16221,6 +16217,17 @@ void hdd_deinit(void)
 #define HDD_WLAN_START_WAIT_TIME (CDS_WMA_TIMEOUT + 5000)
 #endif
 
+void hdd_init_start_completion(void)
+{
+	INIT_COMPLETION(wlan_start_comp);
+}
+
+#ifdef WLAN_CTRL_NAME
+static unsigned int dev_num = 1;
+static struct cdev wlan_hdd_state_cdev;
+static struct class *class;
+static dev_t device;
+
 static void hdd_set_adapter_wlm_def_level(struct hdd_context *hdd_ctx)
 {
 	struct hdd_adapter *adapter, *next_adapter = NULL;
@@ -16278,11 +16285,6 @@ static void hdd_inform_wifi_off(void)
 	osif_psoc_sync_op_stop(psoc_sync);
 }
 
-void hdd_init_start_completion(void)
-{
-	INIT_COMPLETION(wlan_start_comp);
-}
-
 static ssize_t wlan_hdd_state_ctrl_param_write(struct file *filp,
 						const char __user *user_buf,
 						size_t count,
@@ -16382,13 +16384,13 @@ static int  wlan_hdd_state_ctrl_param_create(void)
 	}
 	wlan_hdd_state_major = MAJOR(device);
 
-	class = class_create(THIS_MODULE, WLAN_MODULE_NAME);
+	class = class_create(THIS_MODULE, WLAN_CTRL_NAME);
 	if (IS_ERR(class)) {
 		pr_err("wlan_hdd_state class_create error");
 		goto class_err;
 	}
 
-	dev = device_create(class, NULL, device, NULL, WLAN_MODULE_NAME);
+	dev = device_create(class, NULL, device, NULL, WLAN_CTRL_NAME);
 	if (IS_ERR(dev)) {
 		pr_err("wlan_hdd_statedevice_create error");
 		goto err_class_destroy;
@@ -16405,7 +16407,7 @@ static int  wlan_hdd_state_ctrl_param_create(void)
 	}
 
 	pr_info("wlan_hdd_state %s major(%d) initialized",
-		WLAN_MODULE_NAME, wlan_hdd_state_major);
+		WLAN_CTRL_NAME, wlan_hdd_state_major);
 
 	return 0;
 
@@ -16429,6 +16431,19 @@ static void wlan_hdd_state_ctrl_param_destroy(void)
 	pr_info("Device node unregistered");
 }
 
+#else /* WLAN_CTRL_NAME */
+
+static int  wlan_hdd_state_ctrl_param_create(void)
+{
+	return 0;
+}
+
+static void wlan_hdd_state_ctrl_param_destroy(void)
+{
+}
+
+#endif /* WLAN_CTRL_NAME */
+
 /**
  * hdd_component_cb_init() - Initialize component callbacks
  *