[PATCH v2 14/15] staging:rtl8192u: Refactor enum dm_dig_cs_ratio_e - Style

From: John Whitmore
Date: Sun Jul 29 2018 - 17:08:47 EST


The enumerated type dm_dig_cs_ratio_e is never actually used as a type,
but only as a collection of related constants. This is because the
variables, which use the defined constant values, are defined as being
of type u8 rather then tne enumerated type. This omission negates the
possibility of taking advantage of compiler type checking.

To enable the use of compiler type checking of the enumeration the two
variables, (curcs_ratio_state & precs_ratio_state), which use the type's
constants have their types changed from u8 to enum dig_cck_cs_ratio_state.

Additionally the types declaration has been moved above the dig
structure, where the type is used. The 'typedef' keyword has been
removed from the type to clear the checkpatch issue with defining new
types. And the constant DIG_CS_MAX has been removed since this is never
used in the code.

These changes are purely coding style changes and should not impact
on runtime code execution.

Signed-off-by: John Whitmore <johnfwhitmore@xxxxxxxxx>
---
drivers/staging/rtl8192u/r8192U_dm.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h
index f9d75ad9eaee..f0e259ddea5d 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -87,6 +87,11 @@ enum dig_pkt_detection_threshold {
DIG_PD_AT_HIGH_POWER = 2,
};

+enum dig_cck_cs_ratio_state {
+ DIG_CS_RATIO_LOWER = 0,
+ DIG_CS_RATIO_HIGHER = 1,
+};
+
/* 2007/10/04 MH Define upper and lower threshold of DIG enable or disable. */
struct dig {
u8 dig_enable_flag;
@@ -107,8 +112,8 @@ struct dig {

enum dig_pkt_detection_threshold curpd_thstate;
enum dig_pkt_detection_threshold prepd_thstate;
- u8 curcs_ratio_state;
- u8 precs_ratio_state;
+ enum dig_cck_cs_ratio_state curcs_ratio_state;
+ enum dig_cck_cs_ratio_state precs_ratio_state;

u32 pre_ig_value;
u32 cur_ig_value;
@@ -121,11 +126,6 @@ struct dig {
long rssi_val;
};

-typedef enum tag_dig_cck_cs_ratio_state_definition {
- DIG_CS_RATIO_LOWER = 0,
- DIG_CS_RATIO_HIGHER = 1,
- DIG_CS_MAX
-} dm_dig_cs_ratio_e;
struct dynamic_rx_path_sel {
u8 Enable;
u8 DbgMode;
--
2.18.0