Browse Source

cnss_prealloc: add wrapper APIs if MEM_PRE_ALLOC flag not enabled

Add wrapper api to avoid compilaton failure if
CONFIG_WCNSS_MEM_PRE_ALLOC flag is not enabled.

Change-Id: Ic0625d68f587c79f38f33495b53645f1d7582144
CRs-Fixed: 3492092
Sandeep Singh 1 year ago
parent
commit
ff9d11362f
3 changed files with 48 additions and 6 deletions
  1. 6 0
      Kbuild
  2. 21 3
      cnss2/main.c
  3. 21 3
      icnss2/main.c

+ 6 - 0
Kbuild

@@ -22,6 +22,12 @@ ifeq ($(CONFIG_ICNSS2_QMI),y)
 KBUILD_CPPFLAGS += -DCONFIG_ICNSS2_QMI
 endif
 
+# CONFIG_WCNSS_MEM_PRE_ALLOC should never be "y" here since it
+# can be only compiled as a module from out-of-kernel-tree source.
+ifeq ($(CONFIG_WCNSS_MEM_PRE_ALLOC),m)
+KBUILD_CPPFLAGS += -DCONFIG_WCNSS_MEM_PRE_ALLOC
+endif
+
 # CONFIG_CNSS_PLAT_IPC_QMI_SVC should never be "y" here since it
 # can be only compiled as a module from out-of-kernel-tree source.
 ifeq ($(CONFIG_CNSS_PLAT_IPC_QMI_SVC),m)

+ 21 - 3
cnss2/main.c

@@ -4310,6 +4310,24 @@ static void cnss_sram_dump_init(struct cnss_plat_data *plat_priv)
 }
 #endif
 
+#ifdef CONFIG_WCNSS_MEM_PRE_ALLOC
+static void cnss_initialize_mem_pool(unsigned long device_id)
+{
+	cnss_initialize_prealloc_pool(device_id);
+}
+static void cnss_deinitialize_mem_pool(void)
+{
+	cnss_deinitialize_prealloc_pool();
+}
+#else
+static void cnss_initialize_mem_pool(unsigned long device_id)
+{
+}
+static void cnss_deinitialize_mem_pool(void)
+{
+}
+#endif
+
 static int cnss_misc_init(struct cnss_plat_data *plat_priv)
 {
 	int ret;
@@ -4900,7 +4918,7 @@ static int cnss_probe(struct platform_device *plat_dev)
 		goto reset_plat_dev;
 	}
 
-	cnss_initialize_prealloc_pool(plat_priv->device_id);
+	cnss_initialize_mem_pool(plat_priv->device_id);
 
 	ret = cnss_get_pld_bus_ops_name(plat_priv);
 	if (ret)
@@ -5005,7 +5023,7 @@ free_res:
 	cnss_put_resources(plat_priv);
 reset_ctx:
 	platform_set_drvdata(plat_dev, NULL);
-	cnss_deinitialize_prealloc_pool();
+	cnss_deinitialize_mem_pool();
 reset_plat_dev:
 	cnss_clear_plat_priv(plat_priv);
 out:
@@ -5035,7 +5053,7 @@ static int cnss_remove(struct platform_device *plat_dev)
 	if (!IS_ERR_OR_NULL(plat_priv->mbox_chan))
 		mbox_free_channel(plat_priv->mbox_chan);
 
-	cnss_deinitialize_prealloc_pool();
+	cnss_deinitialize_mem_pool();
 
 	platform_set_drvdata(plat_dev, NULL);
 	cnss_clear_plat_priv(plat_priv);

+ 21 - 3
icnss2/main.c

@@ -4503,6 +4503,24 @@ static void rproc_restart_level_notifier(void *data, struct rproc *rproc)
 	}
 }
 
+#ifdef CONFIG_WCNSS_MEM_PRE_ALLOC
+static void icnss_initialize_mem_pool(unsigned long device_id)
+{
+	cnss_initialize_prealloc_pool(device_id);
+}
+static void icnss_deinitialize_mem_pool(void)
+{
+	cnss_deinitialize_prealloc_pool();
+}
+#else
+static void icnss_initialize_mem_pool(unsigned long device_id)
+{
+}
+static void icnss_deinitialize_mem_pool(void)
+{
+}
+#endif
+
 static int icnss_probe(struct platform_device *pdev)
 {
 	int ret = 0;
@@ -4541,7 +4559,7 @@ static int icnss_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&priv->clk_list);
 	icnss_allow_recursive_recovery(dev);
 
-	cnss_initialize_prealloc_pool(priv->device_id);
+	icnss_initialize_mem_pool(priv->device_id);
 
 	icnss_init_control_params(priv);
 
@@ -4658,7 +4676,7 @@ smmu_cleanup:
 out_free_resources:
 	icnss_put_resources(priv);
 out_reset_drvdata:
-	cnss_deinitialize_prealloc_pool();
+	icnss_deinitialize_mem_pool();
 	dev_set_drvdata(dev, NULL);
 	return ret;
 }
@@ -4753,7 +4771,7 @@ static int icnss_remove(struct platform_device *pdev)
 
 	icnss_put_resources(priv);
 
-	cnss_deinitialize_prealloc_pool();
+	icnss_deinitialize_mem_pool();
 
 	dev_set_drvdata(&pdev->dev, NULL);