[PATCH 1/8 V2] staging: rtl8192e: Remove typedefs - Part I

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As part of the cleanup of the driver, typedef statements are removed.

Signed-off-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx>
---
 drivers/staging/rtl8192e/dot11d.c          |   25 +++++++++++------------
 drivers/staging/rtl8192e/dot11d.h          |   18 ++++++++--------
 drivers/staging/rtl8192e/r8192E_cmdpkt.c   |    2 +-
 drivers/staging/rtl8192e/r8192E_firmware.c |   12 +++++-----
 drivers/staging/rtl8192e/r8192E_firmware.h |   30 ++++++++++++++--------------
 drivers/staging/rtl8192e/rtl_core.c        |    4 +-
 drivers/staging/rtl8192e/rtl_core.h        |    6 ++--
 drivers/staging/rtl8192e/rtl_pci.h         |    8 +++---
 drivers/staging/rtl8192e/rtl_wx.c          |   14 ++++++------
 drivers/staging/rtl8192e/rtllib_softmac.c  |    4 +-
 10 files changed, 61 insertions(+), 62 deletions(-)

diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c
index 0a1522b..6809d8b 100644
--- a/drivers/staging/rtl8192e/dot11d.c
+++ b/drivers/staging/rtl8192e/dot11d.c
@@ -18,13 +18,12 @@
 ******************************************************************************/
 #include "dot11d.h"
 
-typedef struct _CHANNEL_LIST
-{
+struct channel_list {
 	u8      Channel[32];
 	u8      Len;
-}CHANNEL_LIST, *PCHANNEL_LIST;
+};
 
-static CHANNEL_LIST ChannelPlan[] = {
+static struct channel_list ChannelPlan[] = {
 	{{1,2,3,4,5,6,7,8,9,10,11,36,40,44,48,52,56,60,64,149,153,157,161,165},24},
 	{{1,2,3,4,5,6,7,8,9,10,11},11},
 	{{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21},
@@ -42,7 +41,7 @@ static CHANNEL_LIST ChannelPlan[] = {
 
 void Dot11d_Init(struct rtllib_device *ieee)
 {
-	PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee);
+	struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(ieee);
 	pDot11dInfo->bEnabled = false;
 
 	pDot11dInfo->State = DOT11D_STATE_NONE;
@@ -97,7 +96,7 @@ void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device* ieee)
 
 void Dot11d_Reset(struct rtllib_device *ieee)
 {
-	PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee);
+	struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(ieee);
 	u32 i;
 
 	memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1);
@@ -117,15 +116,15 @@ void Dot11d_Reset(struct rtllib_device *ieee)
 void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr,
 	                    u16 CoutryIeLen, u8* pCoutryIe)
 {
-	PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev);
+	struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev);
 	u8 i, j, NumTriples, MaxChnlNum;
-	PCHNL_TXPOWER_TRIPLE pTriple;
+	struct chnl_txpower_triple *pTriple;
 
 	memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1);
 	memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1);
 	MaxChnlNum = 0;
 	NumTriples = (CoutryIeLen - 3) / 3;
-	pTriple = (PCHNL_TXPOWER_TRIPLE)(pCoutryIe + 3);
+	pTriple = (struct chnl_txpower_triple *)(pCoutryIe + 3);
 	for (i = 0; i < NumTriples; i++)
 	{
 		if (MaxChnlNum >= pTriple->FirstChnl)
@@ -146,7 +145,7 @@ void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr,
 			MaxChnlNum = pTriple->FirstChnl + j;
 		}
 
-		pTriple = (PCHNL_TXPOWER_TRIPLE)((u8*)pTriple + 3);
+		pTriple = pTriple + 3;
 	}
 
 	UPDATE_CIE_SRC(dev, pTaddr);
@@ -158,7 +157,7 @@ void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr,
 
 u8 DOT11D_GetMaxTxPwrInDbm( struct rtllib_device *dev, u8 Channel)
 {
-	PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev);
+	struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev);
 	u8 MaxTxPwrInDbm = 255;
 
 	if (MAX_CHANNEL_NUMBER < Channel) {
@@ -173,7 +172,7 @@ u8 DOT11D_GetMaxTxPwrInDbm( struct rtllib_device *dev, u8 Channel)
 
 void DOT11D_ScanComplete( struct rtllib_device * dev)
 {
-	PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev);
+	struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev);
 
 	switch (pDot11dInfo->State) {
 	case DOT11D_STATE_LEARNED:
@@ -189,7 +188,7 @@ void DOT11D_ScanComplete( struct rtllib_device * dev)
 
 int ToLegalChannel( struct rtllib_device * dev, u8 channel)
 {
-	PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev);
+	struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev);
 	u8 default_chn = 0;
 	u32 i;
 
diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h
index 7708eec..8d6e26f 100644
--- a/drivers/staging/rtl8192e/dot11d.h
+++ b/drivers/staging/rtl8192e/dot11d.h
@@ -23,20 +23,20 @@
 
 
 
-typedef struct _CHNL_TXPOWER_TRIPLE {
+struct chnl_txpower_triple {
 	u8 FirstChnl;
 	u8  NumChnls;
 	u8  MaxTxPowerInDbm;
-} CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE;
+};
 
-typedef enum _DOT11D_STATE {
+enum dot11d_state {
 	DOT11D_STATE_NONE = 0,
 	DOT11D_STATE_LEARNED,
 	DOT11D_STATE_DONE,
-} DOT11D_STATE;
+};
 
 /**
- * struct _RT_DOT11D_INFO
+ * struct rt_dot11d_info
  * @CountryIeLen: value greater than 0 if @CountryIeBuf contains
  * 	          valid country information element.
  * @chanell_map: holds channel values
@@ -46,7 +46,7 @@ typedef enum _DOT11D_STATE {
  * @CountryIeSrcAddr - Source AP of the country IE
  */
 
-typedef struct _RT_DOT11D_INFO {
+struct rt_dot11d_info {
 
 	bool bEnabled;
 
@@ -58,8 +58,8 @@ typedef struct _RT_DOT11D_INFO {
 	u8  channel_map[MAX_CHANNEL_NUMBER+1];
 	u8  MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1];
 
-	DOT11D_STATE State;
-} RT_DOT11D_INFO, *PRT_DOT11D_INFO;
+	enum dot11d_state State;
+};
 
 static inline void cpMacAddr(unsigned char *des, unsigned char *src)
 {
@@ -67,7 +67,7 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src)
 }
 
 #define eqMacAddr(a,b)		( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 )
-#define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo))
+#define GET_DOT11D_INFO(__pIeeeDev) ((struct rt_dot11d_info *)((__pIeeeDev)->pDot11dInfo))
 
 #define IS_DOT11D_ENABLE(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->bEnabled
 #define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
diff --git a/drivers/staging/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/r8192E_cmdpkt.c
index de65f40..1aa6973 100644
--- a/drivers/staging/rtl8192e/r8192E_cmdpkt.c
+++ b/drivers/staging/rtl8192e/r8192E_cmdpkt.c
@@ -45,7 +45,7 @@
 	struct r8192_priv	*priv = rtllib_priv(dev);
 	u16				frag_threshold;
 	u16				frag_length = 0, frag_offset = 0;
-	rt_firmware		*pfirmware = priv->pFirmware;
+	struct rt_firmware *pfirmware = priv->pFirmware;
 	struct sk_buff		*skb;
 	unsigned char		*seg_ptr;
 	cb_desc			*tcb_desc;
diff --git a/drivers/staging/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/r8192E_firmware.c
index f7d1917..ce0c2a6 100644
--- a/drivers/staging/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/r8192E_firmware.c
@@ -26,7 +26,7 @@
 extern void firmware_init_param(struct net_device *dev)
 {
 	struct r8192_priv	*priv = rtllib_priv(dev);
-	rt_firmware		*pfirmware = priv->pFirmware;
+	struct rt_firmware *pfirmware = priv->pFirmware;
 
 	pfirmware->cmdpacket_frag_thresold = GET_COMMAND_PACKET_FRAG_THRESHOLD(MAX_TRANSMIT_BUFFER_SIZE);
 }
@@ -39,7 +39,7 @@ bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buff
 	u16		    frag_length, frag_offset = 0;
 	int		    i;
 
-	rt_firmware	    *pfirmware = priv->pFirmware;
+	struct rt_firmware *pfirmware = priv->pFirmware;
 	struct sk_buff	    *skb;
 	unsigned char	    *seg_ptr;
 	cb_desc		    *tcb_desc;
@@ -210,7 +210,7 @@ CPUCheckFirmwareReady_Fail:
 inline static bool firmware_check_ready(struct net_device *dev, u8 load_fw_status)
 {
 	struct r8192_priv	*priv = rtllib_priv(dev);
-	rt_firmware *pfirmware = priv->pFirmware;
+	struct rt_firmware *pfirmware = priv->pFirmware;
 	bool rt_status  = true;
 
 	switch (load_fw_status) {
@@ -266,10 +266,10 @@ bool init_firmware(struct net_device *dev)
 	u32	file_length = 0;
 	u8	*mapped_file = NULL;
 	u8	init_step = 0;
-	opt_rst_type_e	rst_opt = OPT_SYSTEM_RESET;
-	firmware_init_step_e	starting_state = FW_INIT_STEP0_BOOT;
+	enum opt_rst_type rst_opt = OPT_SYSTEM_RESET;
+	enum firmware_init_step	starting_state = FW_INIT_STEP0_BOOT;
 
-	rt_firmware		*pfirmware = priv->pFirmware;
+	struct rt_firmware *pfirmware = priv->pFirmware;
 
 	RT_TRACE(COMP_FIRMWARE, " PlatformInitFirmware()==>\n");
 
diff --git a/drivers/staging/rtl8192e/r8192E_firmware.h b/drivers/staging/rtl8192e/r8192E_firmware.h
index 8819f97..17824c5 100644
--- a/drivers/staging/rtl8192e/r8192E_firmware.h
+++ b/drivers/staging/rtl8192e/r8192E_firmware.h
@@ -23,49 +23,49 @@
 
 #define GET_COMMAND_PACKET_FRAG_THRESHOLD(v)	(4*(v/4) - 8 )
 
-typedef enum _firmware_init_step{
+enum firmware_init_step {
 	FW_INIT_STEP0_BOOT = 0,
 	FW_INIT_STEP1_MAIN = 1,
 	FW_INIT_STEP2_DATA = 2,
-}firmware_init_step_e;
+};
 
-typedef enum _opt_rst_type{
+enum opt_rst_type {
 	OPT_SYSTEM_RESET = 0,
 	OPT_FIRMWARE_RESET = 1,
-}opt_rst_type_e;
+};
 
-typedef enum _desc_packet_type_e{
+enum desc_packet_type {
 	DESC_PACKET_TYPE_INIT = 0,
 	DESC_PACKET_TYPE_NORMAL = 1,
-}desc_packet_type_e;
+};
 
-typedef enum _firmware_source{
+enum firmware_source {
 	FW_SOURCE_IMG_FILE = 0,
 	FW_SOURCE_HEADER_FILE = 1,
-}firmware_source_e, *pfirmware_source_e;
+};
 
-typedef enum _firmware_status{
+enum firmware_status {
 	FW_STATUS_0_INIT = 0,
 	FW_STATUS_1_MOVE_BOOT_CODE = 1,
 	FW_STATUS_2_MOVE_MAIN_CODE = 2,
 	FW_STATUS_3_TURNON_CPU = 3,
 	FW_STATUS_4_MOVE_DATA_CODE = 4,
 	FW_STATUS_5_READY = 5,
-}firmware_status_e;
+};
 
-typedef struct _rt_firmare_seg_container {
+struct rt_firmare_seg_container {
 	u16	seg_size;
 	u8	*seg_ptr;
-}fw_seg_container, *pfw_seg_container;
+};
 
-typedef struct _rt_firmware{
-	firmware_status_e firmware_status;
+struct rt_firmware {
+	enum firmware_status firmware_status;
 	u16		  cmdpacket_frag_thresold;
 #define RTL8190_MAX_FIRMWARE_CODE_SIZE	64000
 #define MAX_FW_INIT_STEP		3
 	u8		  firmware_buf[MAX_FW_INIT_STEP][RTL8190_MAX_FIRMWARE_CODE_SIZE];
 	u16		  firmware_buf_size[MAX_FW_INIT_STEP];
-} rt_firmware, *prt_firmware;
+};
 
 bool init_firmware(struct net_device *dev);
 extern void firmware_init_param(struct net_device *dev);
diff --git a/drivers/staging/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl_core.c
index f8a13d9..bc9378a 100644
--- a/drivers/staging/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl_core.c
@@ -1267,9 +1267,9 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
 	priv->card_type = PCI;
 
 	priv->AcmControl = 0;
-	priv->pFirmware = (rt_firmware*)vmalloc(sizeof(rt_firmware));
+	priv->pFirmware = vmalloc(sizeof(struct rt_firmware));
 	if (priv->pFirmware)
-	memset(priv->pFirmware, 0, sizeof(rt_firmware));
+	memset(priv->pFirmware, 0, sizeof(struct rt_firmware));
 
         skb_queue_head_init(&priv->rx_queue);
 	skb_queue_head_init(&priv->skb_queue);
diff --git a/drivers/staging/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl_core.h
index e014999..0eecb79 100644
--- a/drivers/staging/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl_core.h
@@ -580,7 +580,7 @@ typedef struct r8192_priv
 
 	CHANNEL_ACCESS_SETTING	ChannelAccessSetting;
 
-	mp_adapter				NdisAdapter;
+	struct mp_adapter NdisAdapter;
 
 	struct rtl819x_ops			*ops;
 	struct rtllib_device			*rtllib;
@@ -605,9 +605,9 @@ typedef struct r8192_priv
 
 	ACM_METHOD				AcmMethod;
 
-	prt_firmware				pFirmware;
+	struct rt_firmware *pFirmware;
 	rtl819x_loopback_e			LoopbackMode;
-	firmware_source_e			firmware_source;
+	enum firmware_source firmware_source;
 
 	struct timer_list			watch_dog_timer;
 	struct timer_list			fsync_timer;
diff --git a/drivers/staging/rtl8192e/rtl_pci.h b/drivers/staging/rtl8192e/rtl_pci.h
index 2266272..28de7c4 100644
--- a/drivers/staging/rtl8192e/rtl_pci.h
+++ b/drivers/staging/rtl8192e/rtl_pci.h
@@ -54,7 +54,7 @@ static inline void NdisRawReadPortUlong(u32 port, u32 *pval)
 	*pval = inl(port);
 }
 
-typedef struct _mp_adapter{
+struct mp_adapter {
 	u8		LinkCtrlReg;
 
 	u8		BusNumber;
@@ -69,12 +69,12 @@ typedef struct _mp_adapter{
 	u16		PciBridgeDeviceId;
 	u8		PciBridgePCIeHdrOffset;
 	u8		PciBridgeLinkCtrlReg;
-}mp_adapter,*pmp_adapter;
+};
 
-typedef struct _RT_PCI_CAPABILITIES_HEADER {
+struct rt_pci_capabilities_header {
     unsigned char   CapabilityID;
     unsigned char   Next;
-} RT_PCI_CAPABILITIES_HEADER, *PRT_PCI_CAPABILITIES_HEADER;
+};
 
 #define PCI_MAX_BRIDGE_NUMBER				255
 #define PCI_MAX_DEVICES						32
diff --git a/drivers/staging/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl_wx.c
index 44c49d5..c0ae0c4 100644
--- a/drivers/staging/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl_wx.c
@@ -186,17 +186,17 @@ static int r8192_wx_force_mic_error(struct net_device *dev,
 }
 
 #define MAX_ADHOC_PEER_NUM 64
-typedef struct
-{
+
+struct adhoc_peer_entry {
 	unsigned char MacAddr[ETH_ALEN];
 	unsigned char WirelessMode;
 	unsigned char bCurTxBW40MHz;
-} adhoc_peer_entry_t, *p_adhoc_peer_entry_t;
-typedef struct
-{
-	adhoc_peer_entry_t Entry[MAX_ADHOC_PEER_NUM];
+};
+
+struct adhoc_peers_info {
+	struct adhoc_peer_entry Entry[MAX_ADHOC_PEER_NUM];
 	unsigned char num;
-} adhoc_peers_info_t, *p_adhoc_peers_info_t;
+};
 
 int r8192_wx_get_adhoc_peers(struct net_device *dev,
 			       struct iw_request_info *info,
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index bc8d3f4..ccb449b 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -3140,10 +3140,10 @@ void rtllib_softmac_init(struct rtllib_device *ieee)
 	for (i = 0; i < 5; i++) {
 	  ieee->seq_ctrl[i] = 0;
 	}
-	ieee->pDot11dInfo = kmalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC);
+	ieee->pDot11dInfo = kmalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC);
 	if (!ieee->pDot11dInfo)
 		RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc memory for DOT11D\n");
-	memset(ieee->pDot11dInfo, 0, sizeof(RT_DOT11D_INFO));
+	memset(ieee->pDot11dInfo, 0, sizeof(struct rt_dot11d_info));
 	ieee->LinkDetectInfo.SlotIndex = 0;
 	ieee->LinkDetectInfo.SlotNum = 2;
 	ieee->LinkDetectInfo.NumRecvBcnInPeriod=0;
-- 
1.7.3.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux