diff options
author | Daniel Golle <daniel@makrotopia.org> | 2020-03-30 23:35:04 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2020-04-01 19:47:59 +0100 |
commit | a24a9bbc8c131c300fd8d4f9307aa236ed61a34b (patch) | |
tree | e430c39c85f8c8b776b6022466e6ab9d577804c0 /package/kernel/mac80211/patches/rt2x00 | |
parent | 51edc4eb89bb299d5da2a20e1cc7349b808c6747 (diff) | |
download | upstream-a24a9bbc8c131c300fd8d4f9307aa236ed61a34b.tar.gz upstream-a24a9bbc8c131c300fd8d4f9307aa236ed61a34b.tar.bz2 upstream-a24a9bbc8c131c300fd8d4f9307aa236ed61a34b.zip |
mac80211: rt2x00: prune more unnecessary exports
The calibration patches for MT7620 unnecessarily export symbols and
populate never accessed function pointers. Remove all that and make
functions static as the only place where each of those functions is
called is within rt2800lib.c.
Also make code more readable by fixing indentation, removing
unnecessary parantheses and simplifying some instructions using
shorthands here and there.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/kernel/mac80211/patches/rt2x00')
5 files changed, 27 insertions, 137 deletions
diff --git a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch index 3bb91ec7c5..4addb8e545 100644 --- a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch @@ -1,10 +1,10 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8422,6 +8422,58 @@ static void rt2800_init_rfcsr_5592(struc +@@ -8422,6 +8422,56 @@ static void rt2800_init_rfcsr_5592(struc rt2800_led_open_drain_enable(rt2x00dev); } -+void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev) ++static void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev) +{ + u8 rfb5r1_org, rfb7r1_org, rfvalue; + u32 mac0518, mac051c, mac0528, mac052c; @@ -52,14 +52,12 @@ + rt2800_register_write(rt2x00dev, RF_BYPASS2, mac052c); + + rt2x00_info(rt2x00dev, "RF Tx self calibration end\n"); -+ +} -+EXPORT_SYMBOL_GPL(rt2800_rf_self_txdc_cal); + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9029,6 +9081,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9029,6 +9079,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); @@ -67,23 +65,3 @@ rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); } ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -242,6 +242,7 @@ void rt2800_link_tuner(struct rt2x00_dev - const u32 count); - void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev); -+void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev); - - int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); - void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -562,6 +562,7 @@ struct rt2x00lib_ops { - struct link_qual *qual, const u32 count); - void (*gain_calibration) (struct rt2x00_dev *rt2x00dev); - void (*vco_calibration) (struct rt2x00_dev *rt2x00dev); -+ void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch index d7d07f8bb6..8041580411 100644 --- a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch @@ -1,10 +1,10 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8474,6 +8474,160 @@ void rt2800_rf_self_txdc_cal(struct rt2x +@@ -8472,6 +8472,155 @@ static void rt2800_rf_self_txdc_cal(stru + rt2x00_info(rt2x00dev, "RF Tx self calibration end\n"); } - EXPORT_SYMBOL_GPL(rt2800_rf_self_txdc_cal); -+int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2) ++static int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2) +{ + int calcode; + calcode = ((d2 - d1) * 1000) / 43; @@ -14,9 +14,8 @@ + + return calcode; +} -+EXPORT_SYMBOL_GPL(rt2800_calcrcalibrationcode); + -+void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev) ++static void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev) +{ + u32 savemacsysctrl; + u8 saverfb0r1, saverfb0r34, saverfb0r35; @@ -29,6 +28,8 @@ + char d1 = 0, d2 = 0; + u8 rfvalue; + u32 MAC_RF_BYPASS0, MAC_RF_CONTROL0, MAC_PWR_PIN_CFG; ++ u32 maccfg, macstatus; ++ int i; + + saverfb0r1 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); + saverfb0r34 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 34); @@ -48,10 +49,6 @@ + MAC_RF_CONTROL0 = rt2800_register_read(rt2x00dev, RF_CONTROL0); + MAC_PWR_PIN_CFG = rt2800_register_read(rt2x00dev, PWR_PIN_CFG); + -+ { -+ u32 maccfg, macstatus; -+ int i; -+ + maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); + maccfg &= (~0x04); + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); @@ -62,7 +59,7 @@ + udelay(50); + else + break; -+ } ++ } + + if (i == 10000) + rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n"); @@ -81,7 +78,6 @@ + + if (i == 10000) + rt2x00_warn(rt2x00dev, "Wait MAC Rx Status to MAX !!!\n"); -+ } + + rfvalue = (MAC_RF_BYPASS0 | 0x3004); + rt2800_register_write(rt2x00dev, RF_BYPASS0, rfvalue); @@ -156,12 +152,11 @@ + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); + rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); +} -+EXPORT_SYMBOL_GPL(rt2800_r_calibration); + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9081,6 +9235,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9079,6 +9228,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); @@ -169,25 +164,3 @@ rt2800_rf_self_txdc_cal(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -243,6 +243,8 @@ void rt2800_link_tuner(struct rt2x00_dev - void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev); -+int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2); -+void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); - - int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); - void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -563,6 +563,8 @@ struct rt2x00lib_ops { - void (*gain_calibration) (struct rt2x00_dev *rt2x00dev); - void (*vco_calibration) (struct rt2x00_dev *rt2x00dev); - void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev); -+ int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2); -+ void (*r_calibration) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch index b6180efa8b..89a4ccb961 100644 --- a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch @@ -1,10 +1,10 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8628,6 +8628,71 @@ void rt2800_r_calibration(struct rt2x00_ +@@ -8621,6 +8621,70 @@ static void rt2800_r_calibration(struct + rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); } - EXPORT_SYMBOL_GPL(rt2800_r_calibration); -+void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev) ++static void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev) +{ + u8 bbpreg = 0; + u32 macvalue = 0, macvalue1 = 0; @@ -67,12 +67,11 @@ + + rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); +} -+EXPORT_SYMBOL_GPL(rt2800_rxdcoc_calibration); + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9237,6 +9302,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9230,6 +9294,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); @@ -80,23 +79,3 @@ rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); } ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -245,6 +245,7 @@ void rt2800_vco_calibration(struct rt2x0 - void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev); - int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2); - void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); -+void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev); - - int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); - void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -565,6 +565,7 @@ struct rt2x00lib_ops { - void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev); - int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2); - void (*r_calibration) (struct rt2x00_dev *rt2x00dev); -+ void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch index 63cca526c2..9a03efdef8 100644 --- a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch @@ -1,8 +1,8 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8693,6 +8693,385 @@ void rt2800_rxdcoc_calibration(struct rt +@@ -8685,6 +8685,384 @@ static void rt2800_rxdcoc_calibration(st + rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); } - EXPORT_SYMBOL_GPL(rt2800_rxdcoc_calibration); +static u32 rt2800_do_sqrt_accumulation(u32 si) { + u32 root, root_pre, bit; @@ -19,7 +19,7 @@ + return root; +} + -+void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev) { ++static void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev) { + u8 rfb0r1, rfb0r2, rfb0r42; + u8 rfb4r0, rfb4r19; + u8 rfb5r3, rfb5r4, rfb5r17, rfb5r18, rfb5r19, rfb5r20; @@ -82,11 +82,11 @@ + + rt2800_register_write(rt2x00dev, RF_CONTROL1, 0x00000202); + rt2800_register_write(rt2x00dev, RF_BYPASS1, 0x00000303); -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) + rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0101); -+ } else { ++ else + rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0000); -+ } ++ + rt2800_register_write(rt2x00dev, RF_BYPASS3, 0xf1f1); + + rfb0r1 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); @@ -340,10 +340,10 @@ + + rt2800_bbp_write(rt2x00dev, 244, 0x00); + bbpval = rt2800_bbp_read(rt2x00dev, 21); -+ bbpval = (bbpval | 0x1); ++ bbpval |= 0x1; + rt2800_bbp_write(rt2x00dev, 21, bbpval); + usleep_range(10, 200); -+ bbpval = (bbpval & 0xfe); ++ bbpval &= 0xfe; + rt2800_bbp_write(rt2x00dev, 21, bbpval); + + rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfb0r1); @@ -381,12 +381,11 @@ + rt2800_register_write(rt2x00dev, RF_BYPASS3, orig_RF_BYPASS3); + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); +} -+EXPORT_SYMBOL_GPL(rt2800_rxiq_calibration); + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9305,6 +9684,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9297,6 +9675,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); @@ -394,23 +393,3 @@ } static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -246,6 +246,7 @@ void rt2800_rf_self_txdc_cal(struct rt2x - int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2); - void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev); -+void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev); - - int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); - void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -566,6 +566,7 @@ struct rt2x00lib_ops { - int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2); - void (*r_calibration) (struct rt2x00_dev *rt2x00dev); - void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev); -+ void (*rxiq_calibration) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch index 1a18f13f8e..fc5e4ca5d7 100644 --- a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch @@ -1,8 +1,8 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9072,6 +9072,944 @@ restore_value: +@@ -9063,6 +9063,943 @@ restore_value: + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); } - EXPORT_SYMBOL_GPL(rt2800_rxiq_calibration); +static void rt2800_rf_configstore(struct rt2x00_dev *rt2x00dev, rf_reg_pair rf_reg_record[][13], u8 chain) +{ @@ -940,12 +940,11 @@ + + return; +} -+EXPORT_SYMBOL_GPL(rt2800_loft_iq_calibration); + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9684,6 +10622,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9675,6 +10612,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); @@ -972,21 +971,3 @@ /* RT2800 driver data structure */ struct rt2800_drv_data { -@@ -247,6 +257,7 @@ int rt2800_calcrcalibrationcode(struct r - void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev); -+void rt2800_loft_iq_calibration(struct rt2x00_dev *rt2x00dev); - - int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); - void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -567,6 +567,7 @@ struct rt2x00lib_ops { - void (*r_calibration) (struct rt2x00_dev *rt2x00dev); - void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev); - void (*rxiq_calibration) (struct rt2x00_dev *rt2x00dev); -+ void (*loft_iq_calibration) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. |