Commit d3214d42 authored by Alexei Avshalom Lazar's avatar Alexei Avshalom Lazar Committed by Kalle Valo

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.
Signed-off-by: default avatarAlexei Avshalom Lazar <ailizaro@codeaurora.org>
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 7be3c233
...@@ -1654,6 +1654,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw) ...@@ -1654,6 +1654,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
/* Disable device led before reset*/ /* Disable device led before reset*/
wmi_led_cfg(wil, false); wmi_led_cfg(wil, false);
down_write(&wil->mem_lock);
/* prevent NAPI from being scheduled and prevent wmi commands */ /* prevent NAPI from being scheduled and prevent wmi commands */
mutex_lock(&wil->wmi_mutex); mutex_lock(&wil->wmi_mutex);
if (test_bit(wil_status_suspending, wil->status)) if (test_bit(wil_status_suspending, wil->status))
...@@ -1702,6 +1704,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw) ...@@ -1702,6 +1704,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
if (wil->secured_boot) { if (wil->secured_boot) {
wil_err(wil, "secured boot is not supported\n"); wil_err(wil, "secured boot is not supported\n");
up_write(&wil->mem_lock);
return -ENOTSUPP; return -ENOTSUPP;
} }
...@@ -1737,6 +1740,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw) ...@@ -1737,6 +1740,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
clear_bit(wil_status_resetting, wil->status); clear_bit(wil_status_resetting, wil->status);
up_write(&wil->mem_lock);
if (load_fw) { if (load_fw) {
wil_unmask_irq(wil); wil_unmask_irq(wil);
...@@ -1786,6 +1791,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw) ...@@ -1786,6 +1791,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
return rc; return rc;
out: out:
up_write(&wil->mem_lock);
clear_bit(wil_status_resetting, wil->status); clear_bit(wil_status_resetting, wil->status);
return rc; return rc;
} }
...@@ -1811,9 +1817,7 @@ int __wil_up(struct wil6210_priv *wil) ...@@ -1811,9 +1817,7 @@ int __wil_up(struct wil6210_priv *wil)
WARN_ON(!mutex_is_locked(&wil->mutex)); WARN_ON(!mutex_is_locked(&wil->mutex));
down_write(&wil->mem_lock);
rc = wil_reset(wil, true); rc = wil_reset(wil, true);
up_write(&wil->mem_lock);
if (rc) if (rc)
return rc; return rc;
...@@ -1905,9 +1909,7 @@ int __wil_down(struct wil6210_priv *wil) ...@@ -1905,9 +1909,7 @@ int __wil_down(struct wil6210_priv *wil)
wil_abort_scan_all_vifs(wil, false); wil_abort_scan_all_vifs(wil, false);
mutex_unlock(&wil->vif_mutex); mutex_unlock(&wil->vif_mutex);
down_write(&wil->mem_lock);
rc = wil_reset(wil, false); rc = wil_reset(wil, false);
up_write(&wil->mem_lock);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment