|
@@ -71,6 +71,11 @@ int wil_suspend(struct wil6210_priv *wil, bool is_runtime)
|
|
|
|
|
|
wil_dbg_pm(wil, "suspend: %s\n", is_runtime ? "runtime" : "system");
|
|
wil_dbg_pm(wil, "suspend: %s\n", is_runtime ? "runtime" : "system");
|
|
|
|
|
|
|
|
+ if (test_bit(wil_status_suspended, wil->status)) {
|
|
|
|
+ wil_dbg_pm(wil, "trying to suspend while suspended\n");
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
/* if netif up, hardware is alive, shut it down */
|
|
/* if netif up, hardware is alive, shut it down */
|
|
if (ndev->flags & IFF_UP) {
|
|
if (ndev->flags & IFF_UP) {
|
|
rc = wil_down(wil);
|
|
rc = wil_down(wil);
|
|
@@ -86,10 +91,14 @@ int wil_suspend(struct wil6210_priv *wil, bool is_runtime)
|
|
|
|
|
|
if (wil->platform_ops.suspend) {
|
|
if (wil->platform_ops.suspend) {
|
|
rc = wil->platform_ops.suspend(wil->platform_handle);
|
|
rc = wil->platform_ops.suspend(wil->platform_handle);
|
|
- if (rc)
|
|
|
|
|
|
+ if (rc) {
|
|
wil_enable_irq(wil);
|
|
wil_enable_irq(wil);
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ set_bit(wil_status_suspended, wil->status);
|
|
|
|
+
|
|
out:
|
|
out:
|
|
wil_dbg_pm(wil, "suspend: %s => %d\n",
|
|
wil_dbg_pm(wil, "suspend: %s => %d\n",
|
|
is_runtime ? "runtime" : "system", rc);
|
|
is_runtime ? "runtime" : "system", rc);
|
|
@@ -117,10 +126,13 @@ int wil_resume(struct wil6210_priv *wil, bool is_runtime)
|
|
|
|
|
|
/* if netif up, bring hardware up
|
|
/* if netif up, bring hardware up
|
|
* During open(), IFF_UP set after actual device method
|
|
* During open(), IFF_UP set after actual device method
|
|
- * invocation. This prevent recursive call to wil_up()
|
|
|
|
|
|
+ * invocation. This prevent recursive call to wil_up().
|
|
|
|
+ * wil_status_suspended will be cleared in wil_reset
|
|
*/
|
|
*/
|
|
if (ndev->flags & IFF_UP)
|
|
if (ndev->flags & IFF_UP)
|
|
rc = wil_up(wil);
|
|
rc = wil_up(wil);
|
|
|
|
+ else
|
|
|
|
+ clear_bit(wil_status_suspended, wil->status);
|
|
|
|
|
|
out:
|
|
out:
|
|
wil_dbg_pm(wil, "resume: %s => %d\n",
|
|
wil_dbg_pm(wil, "resume: %s => %d\n",
|