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

Commit 28f9be0b authored by Alexei Avshalom Lazar's avatar Alexei Avshalom Lazar
Browse files

wil6210: minimize the time that mem_lock is held



mem_lock is taken for the entire wil_reset().
Optimize this by taking mem_lock just before device is
being reset and release the lock after FW download.

Change-Id: Icf3430e355acc2c33dc37c6a38a18c47de03a2cf
Signed-off-by: default avatarAlexei Avshalom Lazar <ailizaro@codeaurora.org>
parent 364e8d57
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -3663,9 +3663,7 @@ static int wil_nl_60g_handle_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
				     "NL_60G_GEN_FW_RESET, resetting...\n");

			mutex_lock(&wil->mutex);
			down_write(&wil->mem_lock);
			rc = wil_reset(wil, true);
			up_write(&wil->mem_lock);
			mutex_unlock(&wil->mutex);

			break;
+6 −4
Original line number Diff line number Diff line
@@ -1745,6 +1745,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
	/* Disable device led before reset*/
	wmi_led_cfg(wil, false);

	down_write(&wil->mem_lock);

	/* prevent NAPI from being scheduled and prevent wmi commands */
	mutex_lock(&wil->wmi_mutex);
	if (test_bit(wil_status_suspending, wil->status))
@@ -1800,6 +1802,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)

		if  (wil->secured_boot) {
			wil_err(wil, "secured boot is not supported\n");
			up_write(&wil->mem_lock);
			return -ENOTSUPP;
		}

@@ -1830,6 +1833,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)

	clear_bit(wil_status_resetting, wil->status);

	up_write(&wil->mem_lock);

	if (load_fw) {
		wil_unmask_irq(wil);

@@ -1897,6 +1902,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
	return rc;

out:
	up_write(&wil->mem_lock);
	clear_bit(wil_status_resetting, wil->status);
	return rc;
}
@@ -1922,9 +1928,7 @@ int __wil_up(struct wil6210_priv *wil)

	WARN_ON(!mutex_is_locked(&wil->mutex));

	down_write(&wil->mem_lock);
	rc = wil_reset(wil, true);
	up_write(&wil->mem_lock);
	if (rc)
		return rc;

@@ -2017,9 +2021,7 @@ int __wil_down(struct wil6210_priv *wil)
	wil_abort_scan_all_vifs(wil, false);
	mutex_unlock(&wil->vif_mutex);

	down_write(&wil->mem_lock);
	rc = wil_reset(wil, false);
	up_write(&wil->mem_lock);

	return rc;
}