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 <asunka@codeaurora.org>
This commit is contained in:
Anand N Sunkad 2014-09-30 19:58:18 +05:30 committed by Gerrit - the friendly Code Review server
parent 320436c3e7
commit 0622b8e734
1 changed files with 15 additions and 14 deletions

View File

@ -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: