Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 237c0adb authored by Yuanyuan Liu's avatar Yuanyuan Liu
Browse files

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: default avatarYuanyuan Liu <yuanliu@codeaurora.org>
parent 9c9a0530
Loading
Loading
Loading
Loading
+21 −8
Original line number Diff line number Diff line
@@ -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);		\
@@ -2103,7 +2105,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;
@@ -2115,10 +2118,15 @@ static int icnss_call_driver_probe(struct icnss_priv *priv)

	icnss_hw_power_on(priv);

	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;
	}

@@ -2226,6 +2234,7 @@ static int icnss_driver_event_fw_ready_ind(void *data)
static int icnss_driver_event_register_driver(void *data)
{
	int ret = 0;
	int probe_cnt = 0;

	if (penv->ops)
		return -EEXIST;
@@ -2245,11 +2254,15 @@ static int icnss_driver_event_register_driver(void *data)
	if (ret)
		goto out;

	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;
	}