[PATCH 0/8] staging: rtl8192e: Remove typedef statements

Larry Finger Larry.Finger at lwfinger.net
Mon Jul 18 17:01:24 UTC 2011


On 07/17/2011 11:50 AM, Joe Perches wrote:
> On Sat, 2011-07-16 at 22:10 -0500, Larry Finger wrote:
>> This set of patches removes all typedefs from the driver for RTL8192E.
>
> As these lines touch declarations and uses of these
> typedefs, I think it'd be better to rename them
> at the same time.
>
> for instance these patches converted:
>
> typedef struct _CHANNEL_LIST ->  struct CHANNEL_LIST
>
> I think the conversion should be to:
>
> typedef struct _CHANNEL_LIST ->  struct channel_list
>
> A script that can perform these conversions:
> https://lkml.org/lkml/2009/8/14/19
>
> Nicolas Palix also used coccinelle and python
> to convert typedefs:
> http://www.gossamer-threads.com/lists/linux/kernel/1116060

Is there a full description of how to use youur scripts? I tried both the one at 
lkml.org and the one at gossamer-threads. Using a command

scripts/remove-typedef _BSS_QOS bss_qos drivers/staging/rtl8192e

What results is stuff like

@@ -352,7 +352,7 @@ typedef struct _STA_QOS{
  #define GET_QBSS_LOAD_AVAILABLE_CAPACITY(__pStart) 
ReadEF2Byte((u8*)(__pStart) + 3)
  #define SET_QBSS_LOAD_AVAILABLE_CAPACITY(__pStart, __Value) 
WriteEF2Byte((u8*)(__pStart) + 3, __Value)

-typedef struct _BSS_QOS{
+typedef struct struct bss_qos{

         QOS_MODE                        bdQoSMode;
         u8                                      bdWMMIEBuf[MAX_WMMELE_LENGTH];

With the command

scripts/remove-typedef BSS_QOS bss_qos drivers/staging/rtl8192e

it gets worse.

@@ -93,7 +93,7 @@ typedef union _TSPEC_BODY{
         } f;
  }TSPEC_BODY, *PTSPEC_BODY;

-typedef struct _WMM_TSPEC{
+struct bss_qos {
         u8              ID;
         u8              Length;
         u8              OUI[3];
@@ -365,7 +365,7 @@ typedef struct _BSS_QOS{

         u8                                      QBssLoad[QBSS_LOAD_SIZE];
         bool                                    bQBssLoadValid;
-}BSS_QOS, *PBSS_QOS;
+};

The wrong struct is renamed.

Obviously, I'm doing something wrong.

Larry



More information about the devel mailing list