[PATCH 01/21] staging:rtl8192u: Refactor enum VERSION_819xU - Style

From: John Whitmore
Date: Sun Aug 26 2018 - 17:15:03 EST


Rename enumerated type VERSION_819xU to version_819xu to clear
checkpatch issue with CamelCase naming. Additionally the constants
defined by the type are renamed for the same reason.

Remove the 'typedef' directive to clear the checkpatch issue with
defining new types.

The enumerated type has been moved to the file where the type is
actually used, r8192U.h

Additionally the memeber variable, which uses the type
(card_8192_version), has been changed to use the type to enable
compiler typechecking.

These are coding style changes which should not impact runtime code
execution.

Signed-off-by: John Whitmore <johnfwhitmore@xxxxxxxxx>
---
drivers/staging/rtl8192u/r8190_rtl8256.c | 6 +++---
drivers/staging/rtl8192u/r8192U.h | 8 +++++++-
drivers/staging/rtl8192u/r8192U_core.c | 8 ++++----
drivers/staging/rtl8192u/r8192U_hw.h | 5 -----
drivers/staging/rtl8192u/r819xU_phy.c | 4 ++--
5 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c
index 9b7f822e9762..e60da2358343 100644
--- a/drivers/staging/rtl8192u/r8190_rtl8256.c
+++ b/drivers/staging/rtl8192u/r8190_rtl8256.c
@@ -37,9 +37,9 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, enum ht_channel_width Bandwi

switch (Bandwidth) {
case HT_CHANNEL_WIDTH_20:
- if (priv->card_8192_version == VERSION_819xU_A
+ if (priv->card_8192_version == VERSION_819XU_A
|| priv->card_8192_version
- == VERSION_819xU_B) { /* 8256 D-cut, E-cut, xiong: consider it later! */
+ == VERSION_819XU_B) { /* 8256 D-cut, E-cut, xiong: consider it later! */
rtl8192_phy_SetRFReg(dev,
(enum rf90_radio_path_e)eRFPath,
0x0b, bMask12Bits, 0x100); /* phy para:1ba */
@@ -57,7 +57,7 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, enum ht_channel_width Bandwi
}
break;
case HT_CHANNEL_WIDTH_20_40:
- if (priv->card_8192_version == VERSION_819xU_A || priv->card_8192_version == VERSION_819xU_B) { /* 8256 D-cut, E-cut, xiong: consider it later! */
+ if (priv->card_8192_version == VERSION_819XU_A || priv->card_8192_version == VERSION_819XU_B) { /* 8256 D-cut, E-cut, xiong: consider it later! */
rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path_e)eRFPath, 0x0b, bMask12Bits, 0x300); /* phy para:3ba */
rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path_e)eRFPath, 0x2c, bMask12Bits, 0x3df);
rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path_e)eRFPath, 0x0e, bMask12Bits, 0x0a1);
diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h
index 94a148994069..ce287e2f79e1 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -798,6 +798,12 @@ typedef enum _tag_TxCmd_Config_Index {
TXCMD_XXXX_CTRL,
} DCMD_TXCMD_OP;

+enum version_819xu {
+ VERSION_819XU_A, // A-cut
+ VERSION_819XU_B, // B-cut
+ VERSION_819XU_C,// C-cut
+};
+
typedef struct r8192_priv {
struct usb_device *udev;
/* For maintain info from eeprom */
@@ -815,7 +821,7 @@ typedef struct r8192_priv {
/* O: rtl8192, 1: rtl8185 V B/C, 2: rtl8185 V D */
short card_8192;
/* If TCR reports card V B/C, this discriminates */
- u8 card_8192_version;
+ enum version_819xu card_8192_version;
short enable_gpio0;
enum card_type {
PCI, MINIPCI, CARDBUS, USB
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index e218b5c20642..3b89f2669754 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -2395,7 +2395,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev)
} else {
priv->eeprom_vid = 0;
priv->eeprom_pid = 0;
- priv->card_8192_version = VERSION_819xU_B;
+ priv->card_8192_version = VERSION_819XU_B;
priv->eeprom_ChannelPlan = 0;
priv->eeprom_CustomerID = 0;
}
@@ -2422,7 +2422,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev)
priv->rf_type = RTL819X_DEFAULT_RF_TYPE; /* default 1T2R */
priv->rf_chip = RF_8256;

- if (priv->card_8192_version == (u8)VERSION_819xU_A) {
+ if (priv->card_8192_version == VERSION_819XU_A) {
/* read Tx power gain offset of legacy OFDM to HT rate */
if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_TxPowerDiff >> 1));
@@ -2567,7 +2567,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev)
* 92U does not enable TX power tracking.
*/
priv->ThermalMeter[0] = priv->EEPROMThermalMeter;
- } /* end if VersionID == VERSION_819xU_A */
+ } /* end if VersionID == VERSION_819XU_A */

/* for dlink led */
switch (priv->eeprom_CustomerID) {
@@ -2872,7 +2872,7 @@ static bool rtl8192_adapter_start(struct net_device *dev)

rtl8192_phy_configmac(dev);

- if (priv->card_8192_version == (u8)VERSION_819xU_A) {
+ if (priv->card_8192_version == VERSION_819XU_A) {
rtl8192_phy_getTxPower(dev);
rtl8192_phy_setTxPower(dev, priv->chan);
}
diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h
index 00a123d44207..15e56003d97c 100644
--- a/drivers/staging/rtl8192u/r8192U_hw.h
+++ b/drivers/staging/rtl8192u/r8192U_hw.h
@@ -20,11 +20,6 @@
#ifndef R8192_HW
#define R8192_HW

-typedef enum _VERSION_819xU {
- VERSION_819xU_A, // A-cut
- VERSION_819xU_B, // B-cut
- VERSION_819xU_C,// C-cut
-} VERSION_819xU, *PVERSION_819xU;
//added for different RF type
typedef enum _RT_RF_TYPE_DEF {
RF_1T2R = 0,
diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c
index 7ee10d49894b..8e6ed20848d8 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -814,7 +814,7 @@ static void rtl8192_BB_Config_ParaFile(struct net_device *dev)

/* ----Enable XSTAL ---- */
write_nic_byte_E(dev, 0x5e, 0x00);
- if (priv->card_8192_version == (u8)VERSION_819xU_A) {
+ if (priv->card_8192_version == VERSION_819XU_A) {
/* Antenna gain offset from B/C/D to A */
reg_u32 = priv->AntennaTxPwDiff[1]<<4 |
priv->AntennaTxPwDiff[0];
@@ -1367,7 +1367,7 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel,

switch (CurrentCmd->cmd_id) {
case CMD_ID_SET_TX_PWR_LEVEL:
- if (priv->card_8192_version == (u8)VERSION_819xU_A)
+ if (priv->card_8192_version == VERSION_819XU_A)
/* consider it later! */
rtl8192_SetTxPowerLevel(dev, channel);
break;
--
2.18.0