icnss: Re-probe if driver probe returns error of defer

If wlan driver probe returns error of defer, platform driver will
try to recover by calling probe again. The maximun probe count
is 2.

CRs-Fixed: 2124152
Change-Id: Ic973d0f1d76fc59ce5950397d42a9e778cacaa5a
Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
This commit is contained in:
Yuanyuan Liu 2017-10-09 17:58:17 -07:00
parent 8ef07dcccc
commit 818cdc63ce

View file

@ -73,6 +73,8 @@ module_param(qmi_timeout, ulong, 0600);
#define ICNSS_THRESHOLD_LOW 3450000
#define ICNSS_THRESHOLD_GUARD 20000
#define ICNSS_MAX_PROBE_CNT 2
#define icnss_ipc_log_string(_x...) do { \
if (icnss_ipc_log_context) \
ipc_log_string(icnss_ipc_log_context, _x); \
@ -2105,7 +2107,8 @@ static int icnss_driver_event_server_exit(void *data)
static int icnss_call_driver_probe(struct icnss_priv *priv)
{
int ret;
int ret = 0;
int probe_cnt = 0;
if (!priv->ops || !priv->ops->probe)
return 0;
@ -2117,10 +2120,15 @@ static int icnss_call_driver_probe(struct icnss_priv *priv)
icnss_hw_power_on(priv);
ret = priv->ops->probe(&priv->pdev->dev);
while (probe_cnt < ICNSS_MAX_PROBE_CNT) {
ret = priv->ops->probe(&priv->pdev->dev);
probe_cnt++;
if (ret != -EPROBE_DEFER)
break;
}
if (ret < 0) {
icnss_pr_err("Driver probe failed: %d, state: 0x%lx\n",
ret, priv->state);
icnss_pr_err("Driver probe failed: %d, state: 0x%lx, probe_cnt: %d\n",
ret, priv->state, probe_cnt);
goto out;
}
@ -2228,6 +2236,7 @@ out:
static int icnss_driver_event_register_driver(void *data)
{
int ret = 0;
int probe_cnt = 0;
if (penv->ops)
return -EEXIST;
@ -2247,11 +2256,15 @@ static int icnss_driver_event_register_driver(void *data)
if (ret)
goto out;
ret = penv->ops->probe(&penv->pdev->dev);
while (probe_cnt < ICNSS_MAX_PROBE_CNT) {
ret = penv->ops->probe(&penv->pdev->dev);
probe_cnt++;
if (ret != -EPROBE_DEFER)
break;
}
if (ret) {
icnss_pr_err("Driver probe failed: %d, state: 0x%lx\n",
ret, penv->state);
icnss_pr_err("Driver probe failed: %d, state: 0x%lx, probe_cnt: %d\n",
ret, penv->state, probe_cnt);
goto power_off;
}