Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> wrote: > These contain functions related to the dynamic mechanism, which runs > every two seconds to adjust to changes in the environment. > > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> > --- > .../wireless/realtek/rtlwifi/rtl8192du/dm.c | 123 ++++++++++++++++++ > .../wireless/realtek/rtlwifi/rtl8192du/dm.h | 10 ++ > 2 files changed, 133 insertions(+) > create mode 100644 drivers/net/wireless/realtek/rtlwifi/rtl8192du/dm.c > create mode 100644 drivers/net/wireless/realtek/rtlwifi/rtl8192du/dm.h > > diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192du/dm.c > b/drivers/net/wireless/realtek/rtlwifi/rtl8192du/dm.c > new file mode 100644 > index 000000000000..add909f7726f > --- /dev/null > +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192du/dm.c [...] > +void rtl92du_dm_watchdog(struct ieee80211_hw *hw) > +{ > + struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); > + bool fw_current_inpsmode = false; > + bool fwps_awake = true; > + > + /* 1. RF is OFF. (No need to do DM.) > + * 2. Fw is under power saving mode for FwLPS. > + * (Prevent from SW/FW I/O racing.) > + * 3. IPS workitem is scheduled. (Prevent from IPS sequence > + * to be swapped with DM. > + * 4. RFChangeInProgress is TRUE. > + * (Prevent from broken by IPS/HW/SW Rf off.) > + */ > + > + if (ppsc->rfpwr_state == ERFON && !fw_current_inpsmode && > + fwps_awake && !ppsc->rfchange_inprogress) { nit: use early return if (RF_OFF || FW_LPS || IPS_SECHEDULED || RF_CHANGING) return; > + rtl92d_dm_pwdb_monitor(hw); > + rtl92d_dm_false_alarm_counter_statistics(hw); > + rtl92d_dm_find_minimum_rssi(hw); > + rtl92d_dm_dig(hw); > + rtl92d_dm_check_txpower_tracking_thermal_meter(hw); > + rtl92d_dm_check_edca_turbo(hw); > + rtl92d_dm_1r_cca(hw); > + } > +}