Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging/rtl8192e: 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.

staging/rtl8192e/rtl8192e/r8192E_phy.c:1072:36: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtl8192e/r8192E_phy.c:1104:36: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtl8192e/rtl_core.c:1987:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtl8192e/rtl_dm.c:782:37: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtllib_softmac_wx.c:465: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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Arnd Bergmann and committed by
Greg Kroah-Hartman
5d5fd353 f352a9ee

+12 -12
+4 -4
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
··· 1487 1487 struct phy_ofdm_rx_status_rxsc_sgien_exintfflag *prxsc; 1488 1488 u8 *prxpkt; 1489 1489 u8 i, max_spatial_stream, tmp_rxsnr, tmp_rxevm, rxsc_sgien_exflg; 1490 - char rx_pwr[4], rx_pwr_all = 0; 1491 - char rx_snrX, rx_evmX; 1490 + s8 rx_pwr[4], rx_pwr_all = 0; 1491 + s8 rx_snrX, rx_evmX; 1492 1492 u8 evm, pwdb_all; 1493 1493 u32 RSSI, total_rssi = 0; 1494 1494 u8 is_cck_rate = 0; ··· 1613 1613 2) - 110; 1614 1614 1615 1615 tmp_rxsnr = pofdm_buf->rxsnr_X[i]; 1616 - rx_snrX = (char)(tmp_rxsnr); 1616 + rx_snrX = (s8)(tmp_rxsnr); 1617 1617 rx_snrX /= 2; 1618 1618 priv->stats.rxSNRdB[i] = (long)rx_snrX; 1619 1619 ··· 1643 1643 1644 1644 for (i = 0; i < max_spatial_stream; i++) { 1645 1645 tmp_rxevm = pofdm_buf->rxevm_X[i]; 1646 - rx_evmX = (char)(tmp_rxevm); 1646 + rx_evmX = (s8)(tmp_rxevm); 1647 1647 1648 1648 rx_evmX /= 2; 1649 1649
+1 -1
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
··· 630 630 { 631 631 struct r8192_priv *priv = rtllib_priv(dev); 632 632 u8 powerlevel = 0, powerlevelOFDM24G = 0; 633 - char ant_pwr_diff; 633 + s8 ant_pwr_diff; 634 634 u32 u4RegValue; 635 635 636 636 if (priv->epromtype == EEPROM_93C46) {
+3 -3
drivers/staging/rtl8192e/rtl8192e/rtl_core.c
··· 1982 1982 weighting) / 6; 1983 1983 } 1984 1984 1985 - u8 rtl92e_rx_db_to_percent(char antpower) 1985 + u8 rtl92e_rx_db_to_percent(s8 antpower) 1986 1986 { 1987 1987 if ((antpower <= -100) || (antpower >= 20)) 1988 1988 return 0; ··· 1993 1993 1994 1994 } /* QueryRxPwrPercentage */ 1995 1995 1996 - u8 rtl92e_evm_db_to_percent(char value) 1996 + u8 rtl92e_evm_db_to_percent(s8 value) 1997 1997 { 1998 - char ret_val; 1998 + s8 ret_val; 1999 1999 2000 2000 ret_val = value; 2001 2001
+4 -4
drivers/staging/rtl8192e/rtl8192e/rtl_core.h
··· 503 503 u32 Pwr_Track; 504 504 u8 CCKPresentAttentuation_20Mdefault; 505 505 u8 CCKPresentAttentuation_40Mdefault; 506 - char CCKPresentAttentuation_difference; 507 - char CCKPresentAttentuation; 506 + s8 CCKPresentAttentuation_difference; 507 + s8 CCKPresentAttentuation; 508 508 long undecorated_smoothed_pwdb; 509 509 510 510 u32 MCSTxPowerLevelOriginalOffset[6]; ··· 604 604 long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index); 605 605 void rtl92e_update_rx_statistics(struct r8192_priv *priv, 606 606 struct rtllib_rx_stats *pprevious_stats); 607 - u8 rtl92e_evm_db_to_percent(char value); 608 - u8 rtl92e_rx_db_to_percent(char antpower); 607 + u8 rtl92e_evm_db_to_percent(s8 value); 608 + u8 rtl92e_rx_db_to_percent(s8 antpower); 609 609 void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats, 610 610 struct rtllib_rx_stats *ptarget_stats); 611 611 bool rtl92e_enable_nic(struct net_device *dev);