hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_priv.h
....@@ -128,20 +128,20 @@
128128
129129 /* Wakelocks */
130130 #if defined(CONFIG_HAS_WAKELOCK)
131
- struct wakeup_source wl_wifi; /* Wifi wakelock */
132
- struct wakeup_source wl_rxwake; /* Wifi rx wakelock */
133
- struct wakeup_source wl_ctrlwake; /* Wifi ctrl wakelock */
134
- struct wakeup_source wl_wdwake; /* Wifi wd wakelock */
135
- struct wakeup_source wl_evtwake; /* Wifi event wakelock */
136
- struct wakeup_source wl_pmwake; /* Wifi pm handler wakelock */
137
- struct wakeup_source wl_txflwake; /* Wifi tx flow wakelock */
131
+ struct wakeup_source *wl_wifi; /* Wifi wakelock */
132
+ struct wakeup_source *wl_rxwake; /* Wifi rx wakelock */
133
+ struct wakeup_source *wl_ctrlwake; /* Wifi ctrl wakelock */
134
+ struct wakeup_source *wl_wdwake; /* Wifi wd wakelock */
135
+ struct wakeup_source *wl_evtwake; /* Wifi event wakelock */
136
+ struct wakeup_source *wl_pmwake; /* Wifi pm handler wakelock */
137
+ struct wakeup_source *wl_txflwake; /* Wifi tx flow wakelock */
138138 #ifdef BCMPCIE_OOB_HOST_WAKE
139
- struct wakeup_source wl_intrwake; /* Host wakeup wakelock */
139
+ struct wakeup_source *wl_intrwake; /* Host wakeup wakelock */
140140 #endif /* BCMPCIE_OOB_HOST_WAKE */
141141 #ifdef DHD_USE_SCAN_WAKELOCK
142
- struct wakeup_source wl_scanwake; /* Wifi scan wakelock */
142
+ struct wakeup_source *wl_scanwake; /* Wifi scan wakelock */
143143 #endif /* DHD_USE_SCAN_WAKELOCK */
144
- struct wakeup_source wl_nanwake; /* NAN wakelock */
144
+ struct wakeup_source *wl_nanwake; /* NAN wakelock */
145145 #endif /* CONFIG_HAS_WAKELOCK */
146146
147147 #if defined(OEM_ANDROID)
....@@ -501,16 +501,29 @@
501501 extern uint fis_enab;
502502 #endif /* DHD_SSSR_DUMP */
503503
504
+#if defined(ANDROID_VERSION) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
505
+#define WAKELOCK_BACKPORT
506
+#endif
507
+
504508 #ifdef CONFIG_HAS_WAKELOCK
505
-enum {
506
- WAKE_LOCK_SUSPEND, /* Prevent suspend */
507
- WAKE_LOCK_TYPE_COUNT
508
-};
509
-#define dhd_wake_lock_init(wakeup_source, type, name) wakeup_source_add(wakeup_source)
510
-#define dhd_wake_lock_destroy(wakeup_source) wakeup_source_remove(wakeup_source)
509
+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) || defined(WAKELOCK_BACKPORT))
510
+#define dhd_wake_lock_init(wakeup_source, dev, name) \
511
+do { \
512
+ wakeup_source = wakeup_source_register(dev, name); \
513
+} while (0);
514
+#else
515
+#define dhd_wake_lock_init(wakeup_source, dev, name) \
516
+do { \
517
+ wakeup_source = wakeup_source_register(name); \
518
+} while (0);
519
+#endif /* LINUX_VERSION >= 5.4.0 */
520
+#define dhd_wake_lock_destroy(wakeup_source) \
521
+do { \
522
+ wakeup_source_unregister(wakeup_source); \
523
+} while (0);
511524 #define dhd_wake_lock(wakeup_source) __pm_stay_awake(wakeup_source)
512525 #define dhd_wake_unlock(wakeup_source) __pm_relax(wakeup_source)
513
-#define dhd_wake_lock_active(wakeup_source) ((wakeup_source)->active)
526
+#define dhd_wake_lock_active(wakeup_source) ((wakeup_source)?((wakeup_source)->active):0)
514527 #define dhd_wake_lock_timeout(wakeup_source, timeout) \
515528 __pm_wakeup_event(wakeup_source, jiffies_to_msecs(timeout))
516529 #endif /* CONFIG_HAS_WAKELOCK */