forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/net/wireless/ath/wil6210/wil_crash_dump.c
....@@ -1,18 +1,7 @@
1
+// SPDX-License-Identifier: ISC
12 /*
23 * Copyright (c) 2015,2017 Qualcomm Atheros, Inc.
3
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software for any
6
- * purpose with or without fee is hereby granted, provided that the above
7
- * copyright notice and this permission notice appear in all copies.
8
- *
9
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
165 */
176
187 #include "wil6210.h"
....@@ -73,13 +62,14 @@
7362 return -EINVAL;
7463 }
7564
76
- set_bit(wil_status_collecting_dumps, wil->status);
65
+ down_write(&wil->mem_lock);
66
+
7767 if (test_bit(wil_status_suspending, wil->status) ||
78
- test_bit(wil_status_suspended, wil->status) ||
79
- test_bit(wil_status_resetting, wil->status)) {
80
- wil_err(wil, "cannot collect fw dump during suspend/reset\n");
81
- clear_bit(wil_status_collecting_dumps, wil->status);
82
- return -EINVAL;
68
+ test_bit(wil_status_suspended, wil->status)) {
69
+ wil_err(wil,
70
+ "suspend/resume in progress. cannot copy crash dump\n");
71
+ up_write(&wil->mem_lock);
72
+ return -EBUSY;
8373 }
8474
8575 /* copy to crash dump area */
....@@ -101,7 +91,7 @@
10191 (const void __iomem * __force)data, len);
10292 }
10393
104
- clear_bit(wil_status_collecting_dumps, wil->status);
94
+ up_write(&wil->mem_lock);
10595
10696 return 0;
10797 }