Skip to contentSkip to conversation

rtlwifi: use s8 instead of char

PATCH Superseded Arnd Bergmann 3 participants 5 messages Jun 15, 2016 – Jun 16, 2016

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtlwifi: use s8 instead of char

Compiling the rtlwifi drivers for ARM with gcc -Wextra warns about lots of incorrect code that results from 'char' being unsigned here, e.g.

realtek/rtlwifi/rc.c:113:18: error: comparison is always true due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8188ee/dm.c:1070:22: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8192ce/trx.c:54:16: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8192cu/mac.c:601:16: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8192de/trx.c:53:16: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8192ee/phy.c:1268:12: error: comparison is always true due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8192se/rf.c:150:20: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8723be/dm.c:877:29: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8723be/phy.c:386:16: error: comparison is always true due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8821ae/dm.c:1514:38: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8821ae/phy.c:1558:11: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8821ae/phy.c:386:24: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8821ae/trx.c:55:12: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/stats.c:31:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]

This patch changes all uses of 'char' in this driver that refer to 8-bit integers to use 's8' instead, which is signed on all architectures.

---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h   |  6 +-
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c       |  2 +-
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h       |  4 +-
 drivers/net/wireless/realtek/rtlwifi/rc.c          |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8188ee/dm.c    |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8188ee/trx.c   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8188ee/trx.h   |  4 +-
 .../wireless/realtek/rtlwifi/rtl8192c/dm_common.h  |  2 +-
 .../wireless/realtek/rtlwifi/rtl8192c/phy_common.c |  4 +-
 .../wireless/realtek/rtlwifi/rtl8192c/phy_common.h |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ce/phy.h   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ce/trx.c   |  6 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ce/trx.h   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8192cu/mac.c   |  6 +-
 .../net/wireless/realtek/rtlwifi/rtl8192cu/mac.h   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8192de/phy.c   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192de/phy.h   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192de/trx.c   |  6 +-
 .../net/wireless/realtek/rtlwifi/rtl8192de/trx.h   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ee/phy.c   | 10 ++--
 .../net/wireless/realtek/rtlwifi/rtl8192ee/phy.h   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ee/trx.c   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ee/trx.h   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8192se/rf.c    |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8723ae/trx.h   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/dm.c    |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/phy.c   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/trx.c   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/trx.h   |  8 +--
 .../net/wireless/realtek/rtlwifi/rtl8821ae/dm.c    |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8821ae/phy.c   | 48 +++++++--------
 .../net/wireless/realtek/rtlwifi/rtl8821ae/phy.h   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8821ae/trx.c   | 12 ++--
 .../net/wireless/realtek/rtlwifi/rtl8821ae/trx.h   | 10 ++--
 drivers/net/wireless/realtek/rtlwifi/stats.c       |  6 +-
 drivers/net/wireless/realtek/rtlwifi/stats.h       |  4 +-
 drivers/net/wireless/realtek/rtlwifi/wifi.h        | 68 +++++++++++-----------
 37 files changed, 132 insertions(+), 132 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +3 -3
index 870c9cd5cdf3..ec32c4bae920 100644
@@ -1329,9 +1329,9 @@ struct rtl8xxxu_fileops {
 	void (*report_connect) (struct rtl8xxxu_priv *priv,
 				u8 macid, bool connect);
 	int writeN_block_size;
-	char tx_desc_size;
-	char rx_desc_size;
-	char has_s0s1;
+	s8 tx_desc_size;
+	s8 rx_desc_size;
+	s8 has_s0s1;
 	u32 adda_1t_init;
 	u32 adda_1t_path_on;
 	u32 adda_2t_path_on_a;
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +1 -1
index b660c214dc71..91cc1397b150 100644
@@ -901,7 +901,7 @@ void exhalbtc_stack_update_profile_info(void)
 {
 }
 
-void exhalbtc_update_min_bt_rssi(char bt_rssi)
+void exhalbtc_update_min_bt_rssi(s8 bt_rssi)
 {
 	struct btc_coexist *btcoexist = &gl_bt_coexist;
 
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +2 -2
index 3cbe34c535ec..3d308ebbe048 100644
@@ -433,7 +433,7 @@ struct btc_stack_info {
 	u8 num_of_hid;
 	bool pan_exist;
 	bool unknown_acl_exist;
-	char min_bt_rssi;
+	s8 min_bt_rssi;
 };
 
 struct btc_statistics {
@@ -537,7 +537,7 @@ void exhalbtc_dbg_control(struct btc_coexist *btcoexist, u8 code, u8 len,
 void exhalbtc_stack_update_profile_info(void);
 void exhalbtc_set_hci_version(u16 hci_version);
 void exhalbtc_set_bt_patch_version(u16 bt_hci_version, u16 bt_patch_version);
-void exhalbtc_update_min_bt_rssi(char bt_rssi);
+void exhalbtc_update_min_bt_rssi(s8 bt_rssi);
 void exhalbtc_set_bt_exist(bool bt_exist);
 void exhalbtc_set_chip_type(u8 chip_type);
 void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num);
drivers/net/wireless/realtek/rtlwifi/rc.c +1 -1
index 1aca77719521..ce8621a0f7aa 100644
@@ -94,7 +94,7 @@ static void _rtl_rc_rate_set_series(struct rtl_priv *rtlpriv,
 				    struct ieee80211_sta *sta,
 				    struct ieee80211_tx_rate *rate,
 				    struct ieee80211_tx_rate_control *txrc,
-				    u8 tries, char rix, int rtsctsenable,
+				    u8 tries, s8 rix, int rtsctsenable,
 				    bool not_data)
 {
 	struct rtl_mac *mac = rtl_mac(rtlpriv);
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c +2 -2
index db9a7829d568..6e7b673ae898 100644
@@ -886,7 +886,7 @@ static void dm_txpower_track_cb_therm(struct ieee80211_hw *hw)
 	u8 thermalvalue_avg_count = 0;
 	u32 thermalvalue_avg = 0;
 	long  ele_d, temp_cck;
-	char ofdm_index[2], cck_index = 0,
+	s8 ofdm_index[2], cck_index = 0,
 		ofdm_index_old[2] = {0, 0}, cck_index_old = 0;
 	int i = 0;
 	/*bool is2t = false;*/
@@ -898,7 +898,7 @@ static void dm_txpower_track_cb_therm(struct ieee80211_hw *hw)
 	/*0.1 the following TWO tables decide the
 	 *final index of OFDM/CCK swing table
 	 */
-	char delta_swing_table_idx[2][15]  = {
+	s8 delta_swing_table_idx[2][15]  = {
 		{0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11},
 		{0, 0, -1, -2, -3, -4, -4, -4, -4, -5, -7, -8, -9, -9, -10}
 	};
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c +1 -1
index 11701064b0e1..1016ad433813 100644
@@ -59,7 +59,7 @@ static void _rtl88ee_query_rxphystatus(struct ieee80211_hw *hw,
 	struct phy_status_rpt *phystrpt =
 		(struct phy_status_rpt *)p_drvinfo;
 	struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw));
-	char rx_pwr_all = 0, rx_pwr[4];
+	s8 rx_pwr_all = 0, rx_pwr[4];
 	u8 rf_rx_num = 0, evm, pwdb_all;
 	u8 i, max_spatial_stream;
 	u32 rssi, total_rssi = 0;
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h +2 -2
index 5a24d194ac76..9a1c2087adee 100644
@@ -593,8 +593,8 @@ struct rx_fwinfo_88e {
 	u8 pwdb_all;
 	u8 cfosho[4];
 	u8 cfotail[4];
-	char rxevm[2];
-	char rxsnr[4];
+	s8 rxevm[2];
+	s8 rxsnr[4];
 	u8 pdsnr[2];
 	u8 csi_current[2];
 	u8 csi_target[2];
drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.h +1 -1
index 4422e31fedd9..6a72d0c8afa0 100644
@@ -135,7 +135,7 @@ void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw);
 void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw);
 void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw);
 void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal);
-void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
+void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
 void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw);
 void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery);
 void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw);
drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c +2 -2
index 77e61b19bf36..24162e055c25 100644
@@ -1353,7 +1353,7 @@ static void _rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw,
 }
 
 static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw,
-				     char delta, bool is2t)
+				     s8 delta, bool is2t)
 {
 }
 
@@ -1518,7 +1518,7 @@ void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw)
 }
 EXPORT_SYMBOL(rtl92c_phy_lc_calibrate);
 
-void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta)
+void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_phy *rtlphy = &(rtlpriv->phy);
drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h +1 -1
index 64bc49f4dbc6..202412577bf0 100644
@@ -210,7 +210,7 @@ u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw);
 void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
 void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw,
 					 u16 beaconinterval);
-void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
+void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
 void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw);
 void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
 bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.h +1 -1
index e5e1353a94c3..dadc02b5de0b 100644
@@ -102,7 +102,7 @@ void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw);
 u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw);
 void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
 void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval);
-void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
+void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
 void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw);
 void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
 void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c +3 -3
index 84ddd4d07a1d..93d3fba4f603 100644
@@ -49,7 +49,7 @@ static u8 _rtl92ce_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
 	return skb->priority;
 }
 
-static u8 _rtl92c_query_rxpwrpercentage(char antpower)
+static u8 _rtl92c_query_rxpwrpercentage(s8 antpower)
 {
 	if ((antpower <= -100) || (antpower >= 20))
 		return 0;
@@ -59,9 +59,9 @@ static u8 _rtl92c_query_rxpwrpercentage(char antpower)
 		return 100 + antpower;
 }
 
-static u8 _rtl92c_evm_db_to_percentage(char value)
+static u8 _rtl92c_evm_db_to_percentage(s8 value)
 {
-	char ret_val;
+	s8 ret_val;
 	ret_val = value;
 
 	if (ret_val >= 0)
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h +2 -2
index 4bec4b07e3e0..607304586c03 100644
@@ -537,8 +537,8 @@ struct rx_fwinfo_92c {
 	u8 pwdb_all;
 	u8 cfosho[4];
 	u8 cfotail[4];
-	char rxevm[2];
-	char rxsnr[4];
+	s8 rxevm[2];
+	s8 rxsnr[4];
 	u8 pdsnr[2];
 	u8 csi_current[2];
 	u8 csi_target[2];
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c +3 -3
index 035713311a4a..68ca734853c1 100644
@@ -596,7 +596,7 @@ void rtl92c_set_min_space(struct ieee80211_hw *hw, bool is2T)
 
 /*==============================================================*/
 
-static u8 _rtl92c_query_rxpwrpercentage(char antpower)
+static u8 _rtl92c_query_rxpwrpercentage(s8 antpower)
 {
 	if ((antpower <= -100) || (antpower >= 20))
 		return 0;
@@ -606,9 +606,9 @@ static u8 _rtl92c_query_rxpwrpercentage(char antpower)
 		return 100 + antpower;
 }
 
-static u8 _rtl92c_evm_db_to_percentage(char value)
+static u8 _rtl92c_evm_db_to_percentage(s8 value)
 {
-	char ret_val;
+	s8 ret_val;
 
 	ret_val = value;
 	if (ret_val >= 0)
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.h +2 -2
index 553a4bfac668..20a49ec8459b 100644
@@ -79,8 +79,8 @@ struct rx_fwinfo_92c {
 	u8 pwdb_all;
 	u8 cfosho[4];
 	u8 cfotail[4];
-	char rxevm[2];
-	char rxsnr[4];
+	s8 rxevm[2];
+	s8 rxsnr[4];
 	u8 pdsnr[2];
 	u8 csi_current[2];
 	u8 csi_target[2];
drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +1 -1
index 7810fe87dca7..d334d2a5ea63 100644
@@ -2695,7 +2695,7 @@ void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw)
 	RTPRINT(rtlpriv, FINIT, INIT_IQK,  "LCK:Finish!!!\n");
 }
 
-void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, char delta)
+void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta)
 {
 	return;
 }
drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h +1 -1
index 48d5c6835b6a..8115bf4ac683 100644
@@ -160,7 +160,7 @@ void rtl92d_phy_config_maccoexist_rfpage(struct ieee80211_hw *hw);
 bool rtl92d_phy_check_poweroff(struct ieee80211_hw *hw);
 void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw);
 void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw);
-void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
+void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
 void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw);
 void rtl92d_phy_reset_iqk_result(struct ieee80211_hw *hw);
 void rtl92d_release_cckandrw_pagea_ctl(struct ieee80211_hw *hw,
drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c +3 -3
index 1feaa629dd4f..274b0e42ef41 100644
@@ -48,7 +48,7 @@ static u8 _rtl92de_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
 	return skb->priority;
 }
 
-static u8 _rtl92d_query_rxpwrpercentage(char antpower)
+static u8 _rtl92d_query_rxpwrpercentage(s8 antpower)
 {
 	if ((antpower <= -100) || (antpower >= 20))
 		return 0;
@@ -58,9 +58,9 @@ static u8 _rtl92d_query_rxpwrpercentage(char antpower)
 		return 100 + antpower;
 }
 
-static u8 _rtl92d_evm_db_to_percentage(char value)
+static u8 _rtl92d_evm_db_to_percentage(s8 value)
 {
-	char ret_val = value;
+	s8 ret_val = value;
 
 	if (ret_val >= 0)
 		ret_val = 0;
drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h +2 -2
index fb5cf0634e8d..194d99f8bacf 100644
@@ -554,8 +554,8 @@ struct rx_fwinfo_92d {
 	u8 pwdb_all;
 	u8 cfosho[4];
 	u8 cfotail[4];
-	char rxevm[2];
-	char rxsnr[4];
+	s8 rxevm[2];
+	s8 rxsnr[4];
 	u8 pdsnr[2];
 	u8 csi_current[2];
 	u8 csi_target[2];
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c +5 -5
index 018340aedf09..4e077de97541 100644
@@ -547,7 +547,7 @@ static void _rtl92ee_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw)
 static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start,
 						       u8 end, u8 base)
 {
-	char i = 0;
+	s8 i = 0;
 	u8 tmp = 0;
 	u32 temp_data = 0;
 
@@ -1189,7 +1189,7 @@ static u8 _rtl92ee_get_txpower_by_rate(struct ieee80211_hw *hw,
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_phy *rtlphy = &rtlpriv->phy;
 	u8 shift = 0, sec, tx_num;
-	char diff = 0;
+	s8 diff = 0;
 
 	sec = _rtl92ee_phy_get_ratesection_intxpower_byrate(rf, rate);
 	tx_num = RF_TX_NUM_NONIMPLEMENT;
@@ -1265,14 +1265,14 @@ static u8 _rtl92ee_get_txpower_index(struct ieee80211_hw *hw,
 			 "Illegal channel!!\n");
 	}
 
-	if (IS_CCK_RATE(rate))
+	if (IS_CCK_RATE((s8)rate))
 		tx_power = rtlefuse->txpwrlevel_cck[rfpath][index];
 	else if (DESC92C_RATE6M <= rate)
 		tx_power = rtlefuse->txpwrlevel_ht40_1s[rfpath][index];
 
 	/* OFDM-1T*/
 	if (DESC92C_RATE6M <= rate && rate <= DESC92C_RATE54M &&
-	    !IS_CCK_RATE(rate))
+	    !IS_CCK_RATE((s8)rate))
 		tx_power += rtlefuse->txpwr_legacyhtdiff[rfpath][TX_1S];
 
 	/* BW20-1S, BW20-2S */
@@ -2978,7 +2978,7 @@ void rtl92ee_phy_lc_calibrate(struct ieee80211_hw *hw)
 	rtlphy->lck_inprogress = false;
 }
 
-void rtl92ee_phy_ap_calibrate(struct ieee80211_hw *hw, char delta)
+void rtl92ee_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta)
 {
 }
 
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h +1 -1
index c6e97c8df54c..49bd0e554c65 100644
@@ -141,7 +141,7 @@ void rtl92ee_phy_set_bw_mode(struct ieee80211_hw *hw,
 void rtl92ee_phy_sw_chnl_callback(struct ieee80211_hw *hw);
 u8 rtl92ee_phy_sw_chnl(struct ieee80211_hw *hw);
 void rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
-void rtl92ee_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
+void rtl92ee_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
 void rtl92ee_phy_lc_calibrate(struct ieee80211_hw *hw);
 void rtl92ee_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
 bool rtl92ee_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c +1 -1
index 35e6bf7e233d..582b1fa7f3c5 100644
@@ -56,7 +56,7 @@ static void _rtl92ee_query_rxphystatus(struct ieee80211_hw *hw,
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct phy_status_rpt *p_phystrpt = (struct phy_status_rpt *)p_drvinfo;
-	char rx_pwr_all = 0, rx_pwr[4];
+	s8 rx_pwr_all = 0, rx_pwr[4];
 	u8 rf_rx_num = 0, evm, pwdb_all;
 	u8 i, max_spatial_stream;
 	u32 rssi, total_rssi = 0;
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h +2 -2
index a4c38345233e..8053d1b12ec4 100644
@@ -650,8 +650,8 @@ struct rx_fwinfo {
 	u8 pwdb_all;
 	u8 cfosho[4];
 	u8 cfotail[4];
-	char rxevm[2];
-	char rxsnr[4];
+	s8 rxevm[2];
+	s8 rxsnr[4];
 	u8 pdsnr[2];
 	u8 csi_current[2];
 	u8 csi_target[2];
drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c +1 -1
index 9475aa2a8fa0..34e88a3f6abe 100644
@@ -137,7 +137,7 @@ static void _rtl92s_set_antennadiff(struct ieee80211_hw *hw,
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
 	struct rtl_phy *rtlphy = &(rtlpriv->phy);
-	char ant_pwr_diff = 0;
+	s8 ant_pwr_diff = 0;
 	u32	u4reg_val = 0;
 
 	if (rtlphy->rf_type == RF_2T2R) {
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h +2 -2
index 32970bf18856..43d4c791d563 100644
@@ -522,8 +522,8 @@ struct rx_fwinfo_8723e {
 	u8 pwdb_all;
 	u8 cfosho[4];
 	u8 cfotail[4];
-	char rxevm[2];
-	char rxsnr[4];
+	s8 rxevm[2];
+	s8 rxsnr[4];
 	u8 pdsnr[2];
 	u8 csi_current[2];
 	u8 csi_target[2];
drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c +2 -2
index 3a81cdba8ca3..6f07cd60c7ad 100644
@@ -758,11 +758,11 @@ static void rtl8723be_dm_txpower_tracking_callback_thermalmeter(
 	u8 ofdm_min_index = 6;
 	u8 index_for_channel = 0;
 
-	char delta_swing_table_idx_tup_a[TXSCALE_TABLE_SIZE] = {
+	s8 delta_swing_table_idx_tup_a[TXSCALE_TABLE_SIZE] = {
 		0, 0, 1, 2, 2, 2, 3, 3, 3, 4,  5,
 		5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10,
 		10, 11, 11, 12, 12, 13, 14, 15};
-	char delta_swing_table_idx_tdown_a[TXSCALE_TABLE_SIZE] = {
+	s8 delta_swing_table_idx_tdown_a[TXSCALE_TABLE_SIZE] = {
 		0, 0, 1, 2, 2, 2, 3, 3, 3, 4,  5,
 		5, 6, 6, 6, 6, 7, 7, 7, 8, 8,  9,
 		9, 10, 10, 11, 12, 13, 14, 15};
drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c +2 -2
index 445f681d08c0..c79cb9717d51 100644
@@ -379,7 +379,7 @@ static void _rtl8723be_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw)
 static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start,
 						u8 end, u8 base_val)
 {
-	char i = 0;
+	s8 i = 0;
 	u8 temp_value = 0;
 	u32 temp_data = 0;
 
@@ -953,7 +953,7 @@ static u8 _rtl8723be_get_txpower_by_rate(struct ieee80211_hw *hw,
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_phy *rtlphy = &rtlpriv->phy;
 	u8 shift = 0, rate_section, tx_num;
-	char tx_pwr_diff = 0;
+	s8 tx_pwr_diff = 0;
 
 	rate_section = _rtl8723be_phy_get_ratesection_intxpower_byrate(rfpath,
 								       rate);
drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c +1 -1
index 60345975f9fd..e881ef8ab27b 100644
@@ -56,7 +56,7 @@ static void _rtl8723be_query_rxphystatus(struct ieee80211_hw *hw,
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct phy_status_rpt *p_phystrpt = (struct phy_status_rpt *)p_drvinfo;
-	char rx_pwr_all = 0, rx_pwr[4];
+	s8 rx_pwr_all = 0, rx_pwr[4];
 	u8 rf_rx_num = 0, evm, pwdb_all, pwdb_all_bt = 0;
 	u8 i, max_spatial_stream;
 	u32 rssi, total_rssi = 0;
drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h +4 -4
index 40c36607b8b9..8a9fe41ac15b 100644
@@ -385,9 +385,9 @@ struct phy_status_rpt {
 	u8 cck_rpt_b_ofdm_cfosho_b;
 	u8 rsvd_1;/* ch_corr_msb; */
 	u8 noise_power_db_msb;
-	char path_cfotail[2];
+	s8 path_cfotail[2];
 	u8 pcts_mask[2];
-	char stream_rxevm[2];
+	s8 stream_rxevm[2];
 	u8 path_rxsnr[2];
 	u8 noise_power_db_lsb;
 	u8 rsvd_2[3];
@@ -422,8 +422,8 @@ struct rx_fwinfo_8723be {
 	u8 pwdb_all;
 	u8 cfosho[4];
 	u8 cfotail[4];
-	char rxevm[2];
-	char rxsnr[2];
+	s8 rxevm[2];
+	s8 rxsnr[2];
 	u8 pcts_msk_rpt[2];
 	u8 pdsnr[2];
 	u8 csi_current[2];
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c +2 -2
index 17a681788611..69de8353d0fe 100644
@@ -1355,7 +1355,7 @@ void rtl8812ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw,
 	u32 final_swing_idx[2];
 	u8 pwr_tracking_limit = 26; /*+1.0dB*/
 	u8 tx_rate = 0xFF;
-	char final_ofdm_swing_index = 0;
+	s8 final_ofdm_swing_index = 0;
 
 	if (rtldm->tx_rate != 0xFF)
 		tx_rate =
@@ -2045,7 +2045,7 @@ void rtl8821ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw,
 	u32 final_swing_idx[1];
 	u8 pwr_tracking_limit = 26; /*+1.0dB*/
 	u8 tx_rate = 0xFF;
-	char final_ofdm_swing_index = 0;
+	s8 final_ofdm_swing_index = 0;
 
 	if (rtldm->tx_rate != 0xFF)
 		tx_rate = rtl8821ae_hw_rate_to_mrate(hw, rtldm->tx_rate);
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c +24 -24

149 lines not on this page · raw message

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h +1 -1
index c411f0a95cc4..1285e1adfe9d 100644
@@ -236,7 +236,7 @@ void rtl8821ae_phy_iq_calibrate(struct ieee80211_hw *hw,
 				bool b_recovery);
 void rtl8812ae_phy_iq_calibrate(struct ieee80211_hw *hw,
 				bool b_recovery);
-void rtl8821ae_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
+void rtl8821ae_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
 void rtl8821ae_phy_lc_calibrate(struct ieee80211_hw *hw);
 void rtl8821ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
 bool rtl8812ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c +6 -6
index 41efaa148d13..8c2a5e21308e 100644
@@ -48,7 +48,7 @@ static u8 _rtl8821ae_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
 	return skb->priority;
 }
 
-static u16 odm_cfo(char value)
+static u16 odm_cfo(s8 value)
 {
 	int ret_val;
 
@@ -64,9 +64,9 @@ static u16 odm_cfo(char value)
 	return ret_val;
 }
 
-static u8 _rtl8821ae_evm_dbm_jaguar(char value)
+static u8 _rtl8821ae_evm_dbm_jaguar(s8 value)
 {
-	char ret_val = value;
+	s8 ret_val = value;
 
 	/* -33dB~0dB to 33dB ~ 0dB*/
 	if (ret_val == -128)
@@ -88,7 +88,7 @@ static void query_rxphystatus(struct ieee80211_hw *hw,
 	struct phy_status_rpt *p_phystrpt = (struct phy_status_rpt *)p_drvinfo;
 	struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw));
 	struct rtl_phy *rtlphy = &rtlpriv->phy;
-	char rx_pwr_all = 0, rx_pwr[4];
+	s8 rx_pwr_all = 0, rx_pwr[4];
 	u8 rf_rx_num = 0, evm, evmdbm, pwdb_all;
 	u8 i, max_spatial_stream;
 	u32 rssi, total_rssi = 0;
@@ -170,7 +170,7 @@ static void query_rxphystatus(struct ieee80211_hw *hw,
 					pwdb_all = 100;
 			}
 		} else { /* 8821 */
-			char pout = -6;
+			s8 pout = -6;
 
 			switch (lan_idx) {
 			case 5:
@@ -275,7 +275,7 @@ static void query_rxphystatus(struct ieee80211_hw *hw,
 		if (bpacket_match_bssid) {
 			for (i = RF90_PATH_A; i <= RF90_PATH_B; i++)
 				rtl_priv(hw)->dm.cfo_tail[i] =
-					(char)p_phystrpt->cfotail[i];
+					(s8)p_phystrpt->cfotail[i];
 
 			rtl_priv(hw)->dm.packet_count++;
 		}
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h +5 -5
index ad565bebf1d5..b6f3c564b8d1 100644
@@ -390,11 +390,11 @@ struct phy_status_rpt {
 	u8 cfosho[4];	/* DW 1 byte 1 DW 2 byte 0 */
 
 	/* DWORD 2 */
-	char cfotail[4];	/* DW 2 byte 1 DW 3 byte 0 */
+	s8 cfotail[4];	/* DW 2 byte 1 DW 3 byte 0 */
 
 	/* DWORD 3 */
-	char rxevm[2];	/* DW 3 byte 1 DW 3 byte 2 */
-	char rxsnr[2];	/* DW 3 byte 3 DW 4 byte 0 */
+	s8 rxevm[2];	/* DW 3 byte 1 DW 3 byte 2 */
+	s8 rxsnr[2];	/* DW 3 byte 3 DW 4 byte 0 */
 
 	/* DWORD 4 */
 	u8 pcts_msk_rpt[2];
@@ -418,8 +418,8 @@ struct rx_fwinfo_8821ae {
 	u8 pwdb_all;
 	u8 cfosho[4];
 	u8 cfotail[4];
-	char rxevm[2];
-	char rxsnr[4];
+	s8 rxevm[2];
+	s8 rxsnr[4];
 	u8 pdsnr[2];
 	u8 csi_current[2];
 	u8 csi_target[2];
drivers/net/wireless/realtek/rtlwifi/stats.c +3 -3
index d8b30690b00d..61700fa05570 100644
@@ -26,7 +26,7 @@
 #include "stats.h"
 #include <linux/export.h>
 
-u8 rtl_query_rxpwrpercentage(char antpower)
+u8 rtl_query_rxpwrpercentage(s8 antpower)
 {
 	if ((antpower <= -100) || (antpower >= 20))
 		return 0;
@@ -37,9 +37,9 @@ u8 rtl_query_rxpwrpercentage(char antpower)
 }
 EXPORT_SYMBOL(rtl_query_rxpwrpercentage);
 
-u8 rtl_evm_db_to_percentage(char value)
+u8 rtl_evm_db_to_percentage(s8 value)
 {
-	char ret_val = clamp(-value, 0, 33) * 3;
+	s8 ret_val = clamp(-value, 0, 33) * 3;
 
 	if (ret_val == 99)
 		ret_val = 100;
drivers/net/wireless/realtek/rtlwifi/stats.h +2 -2
index 2b57dffef572..bd0108f93182 100644
@@ -33,8 +33,8 @@
 /* Rx smooth factor */
 #define	RX_SMOOTH_FACTOR			20
 
-u8 rtl_query_rxpwrpercentage(char antpower);
-u8 rtl_evm_db_to_percentage(char value);
+u8 rtl_query_rxpwrpercentage(s8 antpower);
+u8 rtl_evm_db_to_percentage(s8 value);
 long rtl_signal_scale_mapping(struct ieee80211_hw *hw, long currsig);
 void rtl_process_phyinfo(struct ieee80211_hw *hw, u8 *buffer,
 			 struct rtl_stats *pstatus);
drivers/net/wireless/realtek/rtlwifi/wifi.h +34 -34

129 lines not on this page · raw message

Signature · 1 line
2.9.0
#1 lore raw
Quoted 60 lines · Arnd Bergmann

Compiling the rtlwifi drivers for ARM with gcc -Wextra warns about lots of incorrect code that results from 'char' being unsigned here, e.g.

realtek/rtlwifi/rc.c:113:18: error: comparison is always true due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8188ee/dm.c:1070:22: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8192ce/trx.c:54:16: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8192cu/mac.c:601:16: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8192de/trx.c:53:16: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8192ee/phy.c:1268:12: error: comparison is always true due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8192se/rf.c:150:20: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8723be/dm.c:877:29: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8723be/phy.c:386:16: error: comparison is always true due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8821ae/dm.c:1514:38: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8821ae/phy.c:1558:11: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8821ae/phy.c:386:24: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/rtl8821ae/trx.c:55:12: error: comparison is always false due to limited range of data type [-Werror=type-limits] realtek/rtlwifi/stats.c:31:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]

This patch changes all uses of 'char' in this driver that refer to 8-bit integers to use 's8' instead, which is signed on all architectures.

---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h   |  6 +-
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c       |  2 +-
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h       |  4 +-
 drivers/net/wireless/realtek/rtlwifi/rc.c          |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8188ee/dm.c    |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8188ee/trx.c   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8188ee/trx.h   |  4 +-
 .../wireless/realtek/rtlwifi/rtl8192c/dm_common.h  |  2 +-
 .../wireless/realtek/rtlwifi/rtl8192c/phy_common.c |  4 +-
 .../wireless/realtek/rtlwifi/rtl8192c/phy_common.h |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ce/phy.h   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ce/trx.c   |  6 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ce/trx.h   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8192cu/mac.c   |  6 +-
 .../net/wireless/realtek/rtlwifi/rtl8192cu/mac.h   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8192de/phy.c   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192de/phy.h   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192de/trx.c   |  6 +-
 .../net/wireless/realtek/rtlwifi/rtl8192de/trx.h   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ee/phy.c   | 10 ++--
 .../net/wireless/realtek/rtlwifi/rtl8192ee/phy.h   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ee/trx.c   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ee/trx.h   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8192se/rf.c    |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8723ae/trx.h   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/dm.c    |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/phy.c   |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/trx.c   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/trx.h   |  8 +--
 .../net/wireless/realtek/rtlwifi/rtl8821ae/dm.c    |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8821ae/phy.c   | 48 +++++++--------
 .../net/wireless/realtek/rtlwifi/rtl8821ae/phy.h   |  2 +-
 .../net/wireless/realtek/rtlwifi/rtl8821ae/trx.c   | 12 ++--
 .../net/wireless/realtek/rtlwifi/rtl8821ae/trx.h   | 10 ++--
 drivers/net/wireless/realtek/rtlwifi/stats.c       |  6 +-
 drivers/net/wireless/realtek/rtlwifi/stats.h       |  4 +-
 drivers/net/wireless/realtek/rtlwifi/wifi.h        | 68
Quoted 1 line

+++++++++++----------

Arnd,

rtlwifi and rtl8xxxu are two distinct drivers managed by different people. I'd be really nice if you could split this into a per driver patch.

That said, the use of char in rtl8xxxu is all as a flag indicator, so I don't think the s/char/s8/ conversion is justified. I used char rather than ugly bool to reduce the size of the struct.

Cheers,
Jes

#2 lore raw
Quoted 10 lines · CEST Jes Sorensen

Arnd,

rtlwifi and rtl8xxxu are two distinct drivers managed by different people. I'd be really nice if you could split this into a per driver patch.

That said, the use of char in rtl8xxxu is all as a flag indicator, so I don't think the s/char/s8/ conversion is justified. I used char rather than ugly bool to reduce the size of the struct.

Makes sense, I'll resend without that change. If anything, the flag should become u8, not s8 anyway.

Arnd

#3 lore raw

From: Arnd Bergmann

Quoted 8 lines · CEST Jes Sorensen
Quoted 7 lines

Arnd,

rtlwifi and rtl8xxxu are two distinct drivers managed by different people. I'd be really nice if you could split this into a per driver patch.

Quoted 6 lines
Quoted 3 lines

That said, the use of char in rtl8xxxu is all as a flag indicator, so I don't think the s/char/s8/ conversion is justified. I used char rather than ugly bool to reduce the size of the struct.

Makes sense, I'll resend without that change. If anything, the flag should become u8, not s8 anyway.

Does bool:8 work ?

David

#4 lore raw
Quoted 9 lines · David Laight

From: Arnd Bergmann

Quoted 8 lines · CEST Jes Sorensen
Quoted 7 lines

Arnd,

rtlwifi and rtl8xxxu are two distinct drivers managed by different people. I'd be really nice if you could split this into a per driver patch.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

That said, the use of char in rtl8xxxu is all as a flag indicator, so I don't think the s/char/s8/ conversion is justified. I used char rather than ugly bool to reduce the size of the struct.

Makes sense, I'll resend without that change. If anything, the flag should become u8, not s8 anyway.

Does bool:8 work ?

Maybe, but bool is such an ugly datatype, so I'd rather use the other ones.

Jes