Skip to contentSkip to conversation

Remove typedefs and rename struct

PATCH Superseded Cristina Opriceana 2 participants 4 messages Mar 16, 2015 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Remove typedefs and rename struct

This patchset removes unnecessary type definitions for structs detected by coccinelle and renames the structures in order to keep the notations consistent.

Cristina Opriceana (2):
Staging: rtl8192u: Do not add new typedefs
Staging: rtl8192u: Rename struct in order to avoid CamelCase

 drivers/staging/rtl8192u/r8192U_dm.c |  4 ++--
 drivers/staging/rtl8192u/r8192U_dm.h | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 Staging: rtl8192u: Do not add new typedefs

This patch removes the dig_t and DRxPathSel type definitions in order to avoid the following warning: "WARNING: Do not add new typedefs". Done with coccinelle and this script:

@r@ type t; identifier id; @@

typedef struct id
{...}
t;

@script:python get_name@

t << r.t;
tdres;
@@
coccinelle.tdres = t;

@r_match@ type r.t; identifier r.id;
identifier get_name.tdres; @@

-typedef
struct
-id
+tdres
{...}
-t
;

@r_replace@ type r.t; identifier get_name.tdres; @@

-t
+struct tdres

---
 drivers/staging/rtl8192u/r8192U_dm.c |  4 ++--
 drivers/staging/rtl8192u/r8192U_dm.h | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/staging/rtl8192u/r8192U_dm.c +2 -2
index b57b658..510092d 100644
@@ -36,11 +36,11 @@ static u32 edca_setting_UL[HT_IOT_PEER_MAX] = {
 
 /*------------------------Define global variable-----------------------------*/
 /* Debug variable ? */
-dig_t	dm_digtable;
+struct dig_t dm_digtable;
 /* Store current software write register content for MAC PHY. */
 u8		dm_shadow[16][256] = { {0} };
 /* For Dynamic Rx Path Selection by Signal Strength */
-DRxPathSel	DM_RxPathSelTable;
+struct DRxPathSel DM_RxPathSelTable;
 /*------------------------Define global variable-----------------------------*/
 
 
drivers/staging/rtl8192u/r8192U_dm.h +6 -6
index 3008f91..b02ece0 100644
@@ -67,7 +67,7 @@
 
 /*------------------------------Define structure----------------------------*/
 /* 2007/10/04 MH Define upper and lower threshold of DIG enable or disable. */
-typedef struct _dynamic_initial_gain_threshold_ {
+struct dig_t {
 	u8		dig_enable_flag;
 	u8		dig_algorithm;
 	u8		dbg_mode;
@@ -98,7 +98,7 @@ typedef struct _dynamic_initial_gain_threshold_ {
 	bool		initialgain_lowerbound_state;
 
 	long		rssi_val;
-} dig_t;
+};
 
 typedef enum tag_dynamic_init_gain_state_definition {
 	DM_STA_DIG_OFF = 0,
@@ -163,7 +163,7 @@ typedef enum tag_dig_cck_cs_ratio_state_definition {
 	DIG_CS_RATIO_HIGHER = 1,
 	DIG_CS_MAX
 } dm_dig_cs_ratio_e;
-typedef struct _Dynamic_Rx_Path_Selection_ {
+struct DRxPathSel {
 	u8		Enable;
 	u8		DbgMode;
 	u8		cck_method;
@@ -177,7 +177,7 @@ typedef struct _Dynamic_Rx_Path_Selection_ {
 	u8		rf_rssi[4];
 	u8		rf_enable_rssi_th[4];
 	long		cck_pwdb_sta[4];
-} DRxPathSel;
+};
 
 typedef enum tag_CCK_Rx_Path_Method_Definition {
 	CCK_Rx_Version_1 = 0,
@@ -200,9 +200,9 @@ typedef struct tag_Tx_Config_Cmd_Format {
 
 
 /*------------------------Export global variable----------------------------*/
-extern dig_t dm_digtable;
+extern struct dig_t dm_digtable;
 extern u8 dm_shadow[16][256];
-extern DRxPathSel DM_RxPathSelTable;
+extern struct DRxPathSel DM_RxPathSelTable;
 /*------------------------Export global variable----------------------------*/
 
 
Signature · 1 line
1.9.1
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: rtl8192u: Do not add new typedefs

Quoted 10 lines · Cristina Opriceana

This patch removes the dig_t and DRxPathSel type definitions in order to avoid the following warning: "WARNING: Do not add new typedefs". Done with coccinelle and this script:

@r@ type t; identifier id; @@

typedef struct id
{...}
t;

Quoted 6 lines

@script:python get_name@

t << r.t;
tdres;
@@
coccinelle.tdres = t;

It would be nicer to augment this step to remove any trailing _t.

julia

Quoted 103 lines

@r_match@ type r.t; identifier r.id;
identifier get_name.tdres; @@

-typedef
struct

(quoted diff) +1 -1
-id
+tdres

{...}
-t
;

@r_replace@ type r.t; identifier get_name.tdres; @@

(quoted diff) +1 -1
-t
+struct tdres
---
 drivers/staging/rtl8192u/r8192U_dm.c |  4 ++--
 drivers/staging/rtl8192u/r8192U_dm.h | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/staging/rtl8192u/r8192U_dm.c +2 -2
index b57b658..510092d 100644
@@ -36,11 +36,11 @@ static u32 edca_setting_UL[HT_IOT_PEER_MAX] = {
 
 /*------------------------Define global variable-----------------------------*/
 /* Debug variable ? */
-dig_t	dm_digtable;
+struct dig_t dm_digtable;
 /* Store current software write register content for MAC PHY. */
 u8		dm_shadow[16][256] = { {0} };
 /* For Dynamic Rx Path Selection by Signal Strength */
-DRxPathSel	DM_RxPathSelTable;
+struct DRxPathSel DM_RxPathSelTable;
 /*------------------------Define global variable-----------------------------*/
 
 
drivers/staging/rtl8192u/r8192U_dm.h +6 -7
index 3008f91..b02ece0 100644
@@ -67,7 +67,7 @@
 
 /*------------------------------Define structure----------------------------*/
 /* 2007/10/04 MH Define upper and lower threshold of DIG enable or disable. */
-typedef struct _dynamic_initial_gain_threshold_ {
+struct dig_t {
 	u8		dig_enable_flag;
 	u8		dig_algorithm;
 	u8		dbg_mode;
@@ -98,7 +98,7 @@ typedef struct _dynamic_initial_gain_threshold_ {
 	bool		initialgain_lowerbound_state;
 
 	long		rssi_val;
-} dig_t;
+};
 
 typedef enum tag_dynamic_init_gain_state_definition {
 	DM_STA_DIG_OFF = 0,
@@ -163,7 +163,7 @@ typedef enum tag_dig_cck_cs_ratio_state_definition {
 	DIG_CS_RATIO_HIGHER = 1,
 	DIG_CS_MAX
 } dm_dig_cs_ratio_e;
-typedef struct _Dynamic_Rx_Path_Selection_ {
+struct DRxPathSel {
 	u8		Enable;
 	u8		DbgMode;
 	u8		cck_method;
@@ -177,7 +177,7 @@ typedef struct _Dynamic_Rx_Path_Selection_ {
 	u8		rf_rssi[4];
 	u8		rf_enable_rssi_th[4];
 	long		cck_pwdb_sta[4];
-} DRxPathSel;
+};
 
 typedef enum tag_CCK_Rx_Path_Method_Definition {
 	CCK_Rx_Version_1 = 0,
@@ -200,9 +200,9 @@ typedef struct tag_Tx_Config_Cmd_Format {
 
 
 /*------------------------Export global variable----------------------------*/
-extern dig_t dm_digtable;
+extern struct dig_t dm_digtable;
 extern u8 dm_shadow[16][256];
-extern DRxPathSel DM_RxPathSelTable;
+extern struct DRxPathSel DM_RxPathSelTable;
 /*------------------------Export global variable----------------------------*/
 
 
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/8b18c84b5d3f5634071109cbaf158ffb04f08970.1426518637.git.cristina.opriceana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw

PATCH 2/2 Staging: rtl8192u: Rename struct to avoid CamelCase

In reply to Cristina Opriceana

This patch renames struct DRxPathSel to dynamic_rx_path_sel in order to keep the notations consistent and to remove the warning:
"CHECK: Avoid CamelCase". Done with coccinelle:

@@ @@
struct
-DRxPathSel
+dynamic_rx_path_sel
{...}

@@ @@
struct
-DRxPathSel
+dynamic_rx_path_sel

---
 drivers/staging/rtl8192u/r8192U_dm.c | 2 +-
 drivers/staging/rtl8192u/r8192U_dm.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192u/r8192U_dm.c +1 -1
index 510092d..a874138 100644
@@ -40,7 +40,7 @@ struct dig_t dm_digtable;
 /* Store current software write register content for MAC PHY. */
 u8		dm_shadow[16][256] = { {0} };
 /* For Dynamic Rx Path Selection by Signal Strength */
-struct DRxPathSel DM_RxPathSelTable;
+struct dynamic_rx_path_sel DM_RxPathSelTable;
 /*------------------------Define global variable-----------------------------*/
 
 
drivers/staging/rtl8192u/r8192U_dm.h +2 -2
index b02ece0..f164629 100644
@@ -163,7 +163,7 @@ typedef enum tag_dig_cck_cs_ratio_state_definition {
 	DIG_CS_RATIO_HIGHER = 1,
 	DIG_CS_MAX
 } dm_dig_cs_ratio_e;
-struct DRxPathSel {
+struct dynamic_rx_path_sel {
 	u8		Enable;
 	u8		DbgMode;
 	u8		cck_method;
@@ -202,7 +202,7 @@ typedef struct tag_Tx_Config_Cmd_Format {
 /*------------------------Export global variable----------------------------*/
 extern struct dig_t dm_digtable;
 extern u8 dm_shadow[16][256];
-extern struct DRxPathSel DM_RxPathSelTable;
+extern struct dynamic_rx_path_sel DM_RxPathSelTable;
 /*------------------------Export global variable----------------------------*/
 
 
Signature · 1 line
1.9.1