Skip to contentSkip to conversation

Staging: wilc1000: Remove struct typedef

PATCH In review Bhumika Goyal 2 participants 4 messages Sep 13, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: wilc1000: Remove struct typedef

Remove typedef from structure tstrRSSI as using typedef for structures is not preferred.
Found using coccinelle:

@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t":
coccinelle.T2 = T[:-2];
print T
else:
coccinelle.T2=T;

@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

@r3@
type r1.T;
identifier c1.T2;
@@
- T
+ struct T2

---
 drivers/staging/wilc1000/coreconfigurator.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/coreconfigurator.h +3 -3
index 076e06a..cff1698 100644
@@ -70,11 +70,11 @@ enum connect_status {
 	CONNECT_STS_FORCE_16_BIT = 0xFFFF
 };
 
-typedef struct {
+struct tstrRSSI {
 	u8 u8Full;
 	u8 u8Index;
 	s8 as8RSSI[NUM_RSSI];
-} tstrRSSI;
+};
 
 struct network_info {
 	s8 rssi;
@@ -93,7 +93,7 @@ struct network_info {
 	u8 *ies;
 	u16 ies_len;
 	void *join_params;
-	tstrRSSI str_rssi;
+	struct tstrRSSI str_rssi;
 	u64 tsf_hi;
 };
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 31 lines · Bhumika Goyal

Remove typedef from structure tstrRSSI as using typedef for structures is not preferred.
Found using coccinelle:

@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t":
coccinelle.T2 = T[:-2];
print T
else:
coccinelle.T2=T;

@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

Quoted 7 lines

@r3@
type r1.T;
identifier c1.T2;
@@
- T
+ struct T2

I would like to add a note here: The above script also removes '_t' from typedefs if any occurrence found.
Also, for running the script I used --all-includes for getting information from header files as structure definition and its object declaration might be in different files.
So this option removes typedefs from both places.

Quoted 35 lines
---
 drivers/staging/wilc1000/coreconfigurator.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/coreconfigurator.h +3 -4
index 076e06a..cff1698 100644
@@ -70,11 +70,11 @@ enum connect_status {
        CONNECT_STS_FORCE_16_BIT = 0xFFFF
 };
 
-typedef struct {
+struct tstrRSSI {
        u8 u8Full;
        u8 u8Index;
        s8 as8RSSI[NUM_RSSI];
-} tstrRSSI;
+};
 
 struct network_info {
        s8 rssi;
@@ -93,7 +93,7 @@ struct network_info {
        u8 *ies;
        u16 ies_len;
        void *join_params;
-       tstrRSSI str_rssi;
+       struct tstrRSSI str_rssi;
        u64 tsf_hi;
 };
 
--

1.9.1

#2 lore raw
Quoted 32 lines · Bhumika Goyal
Quoted 31 lines · Bhumika Goyal

Remove typedef from structure tstrRSSI as using typedef for structures is not preferred.
Found using coccinelle:

@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t":
coccinelle.T2 = T[:-2];
print T
else:
coccinelle.T2=T;

@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

Quoted 14 lines
Quoted 7 lines

@r3@
type r1.T;
identifier c1.T2;
@@
- T
+ struct T2

I would like to add a note here: The above script also removes '_t' from typedefs if any occurrence found.
Also, for running the script I used --all-includes for getting information from header files as structure definition and its object declaration might be in different files.
So this option removes typedefs from both places.

Good job. I assume you did a grep to be double sure that the name tstrRSSI doesn't occur anywhere else? And a compile of course.

julia

Quoted 43 lines
Quoted 33 lines
---
 drivers/staging/wilc1000/coreconfigurator.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/coreconfigurator.h +3 -4
index 076e06a..cff1698 100644
@@ -70,11 +70,11 @@ enum connect_status {
        CONNECT_STS_FORCE_16_BIT = 0xFFFF
 };
 
-typedef struct {
+struct tstrRSSI {
        u8 u8Full;
        u8 u8Index;
        s8 as8RSSI[NUM_RSSI];
-} tstrRSSI;
+};
 
 struct network_info {
        s8 rssi;
@@ -93,7 +93,7 @@ struct network_info {
        u8 *ies;
        u16 ies_len;
        void *join_params;
-       tstrRSSI str_rssi;
+       struct tstrRSSI str_rssi;
        u64 tsf_hi;
 };
 
--
Quoted 2 lines

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/CAOH%2B1jExFn-UUq3xudSiwdm%3DRm4PP5oa19w675Dx8dMB3%2BVCoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 51 lines · Julia Lawall
Quoted 32 lines · Bhumika Goyal
Quoted 31 lines · Bhumika Goyal

Remove typedef from structure tstrRSSI as using typedef for structures is not preferred.
Found using coccinelle:

@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t":
coccinelle.T2 = T[:-2];
print T
else:
coccinelle.T2=T;

@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

Quoted 14 lines
Quoted 7 lines

@r3@
type r1.T;
identifier c1.T2;
@@
- T
+ struct T2

I would like to add a note here: The above script also removes '_t' from typedefs if any occurrence found.
Also, for running the script I used --all-includes for getting information from header files as structure definition and its object declaration might be in different files.
So this option removes typedefs from both places.

Quoted 3 lines

Good job. I assume you did a grep to be double sure that the name tstrRSSI doesn't occur anywhere else? And a compile of course.

Yes, I do it always to double check the things :D

Thanks,
Bhumika

Quoted 45 lines

julia

Quoted 43 lines
Quoted 33 lines
---
 drivers/staging/wilc1000/coreconfigurator.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/coreconfigurator.h +3 -4
index 076e06a..cff1698 100644
@@ -70,11 +70,11 @@ enum connect_status {
        CONNECT_STS_FORCE_16_BIT = 0xFFFF
 };
 
-typedef struct {
+struct tstrRSSI {
        u8 u8Full;
        u8 u8Index;
        s8 as8RSSI[NUM_RSSI];
-} tstrRSSI;
+};
 
 struct network_info {
        s8 rssi;
@@ -93,7 +93,7 @@ struct network_info {
        u8 *ies;
        u16 ies_len;
        void *join_params;
-       tstrRSSI str_rssi;
+       struct tstrRSSI str_rssi;
        u64 tsf_hi;
 };
 
--
Quoted 2 lines

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/CAOH%2B1jExFn-UUq3xudSiwdm%3DRm4PP5oa19w675Dx8dMB3%2BVCoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.