From 0622b8e734b5aec131e644db64e8cd16a39479c5 Mon Sep 17 00:00:00 2001 From: Anand N Sunkad Date: Tue, 30 Sep 2014 19:58:18 +0530 Subject: [PATCH] wcnss: invoke PIL only after completing intialization Delay PIL operation until all data structures used by WCNSS SMD interrupt handler are initialized. There could be a race condition where the SMD interrupt handler is called even before the WCNSS trigger function is completed. Change-Id: I1e411ca515eaa53e96875df62d9f654d4b32999c CRs-Fixed: 496402 Signed-off-by: Anand N Sunkad --- drivers/net/wireless/wcnss/wcnss_wlan.c | 29 +++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/wcnss/wcnss_wlan.c b/drivers/net/wireless/wcnss/wcnss_wlan.c index 83466bfc469..d33cd9ba5f0 100644 --- a/drivers/net/wireless/wcnss/wcnss_wlan.c +++ b/drivers/net/wireless/wcnss/wcnss_wlan.c @@ -538,7 +538,7 @@ fail: static int __devinit wcnss_wlan_ctrl_probe(struct platform_device *pdev) { - if (!penv) + if (!penv || !penv->triggered) return -ENODEV; penv->smd_channel_ready = 1; @@ -593,7 +593,7 @@ wcnss_ctrl_probe(struct platform_device *pdev) { int ret = 0; - if (!penv) + if (!penv || !penv->triggered) return -ENODEV; ret = smd_named_open_on_edge(WCNSS_CTRL_CHANNEL, SMD_APPS_WCNSS, @@ -1520,15 +1520,6 @@ wcnss_trigger_config(struct platform_device *pdev) goto fail_power; } - /* trigger initialization of the WCNSS */ - penv->pil = pil_get(WCNSS_PIL_DEVICE); - if (IS_ERR(penv->pil)) { - dev_err(&pdev->dev, "Peripheral Loader failed on WCNSS.\n"); - ret = PTR_ERR(penv->pil); - penv->pil = NULL; - goto fail_pil; - } - /* allocate resources */ penv->mmio_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wcnss_mmio"); @@ -1555,15 +1546,25 @@ wcnss_trigger_config(struct platform_device *pdev) goto fail_wake; } + /* trigger initialization of the WCNSS */ + penv->pil = pil_get(WCNSS_PIL_DEVICE); + if (IS_ERR(penv->pil)) { + dev_err(&pdev->dev, "Peripheral Loader failed on WCNSS.\n"); + ret = PTR_ERR(penv->pil); + penv->pil = NULL; + goto fail_pil; + } + return 0; +fail_pil: + if (penv->msm_wcnss_base) + iounmap(penv->msm_wcnss_base); + fail_wake: wake_lock_destroy(&penv->wcnss_wake_lock); fail_res: - if (penv->pil) - pil_put(penv->pil); -fail_pil: wcnss_wlan_power(&pdev->dev, &penv->wlan_config, WCNSS_WLAN_SWITCH_OFF); fail_power: