Skip to contentSkip to conversation

Staging: rtl8187se: remove kernel version compatibility wrappers

PATCH New Bartlomiej Zolnierkiewicz 1 participant 1 message Jun 13, 2009 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 Staging: rtl8187se: remove kernel version compatibility wrappers

---
 drivers/staging/rtl8187se/ieee80211/ieee80211.h            |   67 ----
 drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c      |    4 
 drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c |   53 ---
 drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c |  206 +------------
 drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c  |  103 ------
 drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c         |    6 
 drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c    |   98 ------
 drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c |   11 
 drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c         |    8 
 drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c         |   60 ---
 drivers/staging/rtl8187se/r8180.h                          |    4 
 drivers/staging/rtl8187se/r8180_core.c                     |  120 -------
 drivers/staging/rtl8187se/r8180_dm.c                       |   20 -
 drivers/staging/rtl8187se/r8180_dm.h                       |   18 -
 14 files changed, 54 insertions(+), 724 deletions(-)
drivers/staging/rtl8187se/ieee80211/ieee80211.h +3 -64
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
===================================================================
@@ -29,10 +29,7 @@
 #include <linux/jiffies.h>
 #include <linux/timer.h>
 #include <linux/sched.h>
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13))
 #include <linux/wireless.h>
-#endif
 
 /*
 #ifndef bool
@@ -47,11 +44,7 @@
 #define false  0
 #endif
 */
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
-#ifndef bool
-typedef enum{false = 0, true} bool;
-#endif
-#endif
+
 //#ifdef JOHN_HWSEC
 #define KEY_TYPE_NA		0x0
 #define KEY_TYPE_WEP40 		0x1
@@ -112,7 +105,6 @@ typedef enum{false = 0, true} bool;
 
 #define	IEEE_CRYPT_ALG_NAME_LEN			16
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
 #define ieee80211_wx_get_scan ieee80211_wx_get_scan_rtl
 #define ieee80211_wx_set_encode ieee80211_wx_set_encode_rtl
 #define ieee80211_wx_get_encode ieee80211_wx_get_encode_rtl
@@ -122,7 +114,7 @@ typedef enum{false = 0, true} bool;
 #define free_ieee80211          free_ieee80211_rtl
 #define alloc_ieee80211        alloc_ieee80211_rtl
 ///////////////////////////////
-#endif
+
 //error in ubuntu2.6.22,so add these
 #define ieee80211_wake_queue ieee80211_wake_queue_rtl
 #define ieee80211_stop_queue ieee80211_stop_queue_rtl
@@ -205,23 +197,8 @@ typedef struct ieee_param {
 #define IW_QUAL_NOISE_UPDATED  0x4
 #endif
 
-// linux under 2.6.9 release may not support it, so modify it for common use
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
-#define MSECS(t)	(1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
-static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
-{
-         unsigned long timeout = MSECS(msecs) + 1;
-
-         while (timeout) {
-                 set_current_state(TASK_UNINTERRUPTIBLE);
-                 timeout = schedule_timeout(timeout);
-         }
-         return timeout;
-}
-#else
 #define MSECS(t) msecs_to_jiffies(t)
 #define msleep_interruptible_rtl  msleep_interruptible
-#endif
 
 #define IEEE80211_DATA_LEN		2304
 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -1097,22 +1074,6 @@ enum ieee80211_state {
 #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
 #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
 
-
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
-{
-        return ((addr[0] != 0xff) && (0x01 & addr[0]));
-}
-#endif
-
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
-{
-	return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) &&   \
-		(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
-}
-#endif
-
 #define CFG_IEEE80211_RESERVE_FCS (1<<0)
 #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
 
@@ -1313,7 +1274,6 @@ struct ieee80211_device {
 	unsigned long NumRxOkTotal;
 	unsigned long NumRxUnicast;//YJ,add,080828,for keep alive
 	bool bHwRadioOff;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
         struct delayed_work softmac_scan_wq;
         struct delayed_work associate_retry_wq;
 	struct delayed_work hw_wakeup_wq;
@@ -1329,24 +1289,7 @@ struct ieee80211_device {
 
 //Added for RF power on power off by lizhaoming 080512
 	struct delayed_work GPIOChangeRFWorkItem;
-#else
 
-	struct work_struct start_ibss_wq;
-        struct work_struct softmac_scan_wq;
-        struct work_struct associate_retry_wq;
-	struct work_struct hw_wakeup_wq;
-	struct work_struct hw_sleep_wq;
-	struct work_struct watch_dog_wq;
-	struct work_struct sw_antenna_wq;
-//by amy for rate adaptive 080312
-    struct work_struct rate_adapter_wq;
-//by amy for rate adaptive
-	struct work_struct hw_dig_wq;
-	struct work_struct tx_pw_wq;
-
-//Added for RF power on power off by lizhaoming 080512
-	struct work_struct GPIOChangeRFWorkItem;
-#endif
 	struct workqueue_struct *wq;
 
 	/* Callback functions */
@@ -1690,12 +1633,8 @@ extern int ieee80211_wx_set_freq(struct 
 
 extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+
 extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
-#else
- extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
-#endif
-//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
 
 extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
 			       struct iw_request_info *info,
drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c +0 -4
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
===================================================================
@@ -19,10 +19,6 @@
 #include <asm/string.h>
 #include <asm/errno.h>
 
-#if (LINUX_VERSION_CODE<KERNEL_VERSION(2,6,18))
-#include<linux/config.h>
-#endif
-
 #include "ieee80211.h"
 
 MODULE_AUTHOR("Jouni Malinen");
drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +4 -49

100 lines not on this page · raw message

drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c +21 -185

359 lines not on this page · raw message

drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c +10 -93

199 lines not on this page · raw message

drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c +1 -5
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
===================================================================
@@ -55,11 +55,7 @@ static inline void ieee80211_monitor_rx(
 	u16 fc = le16_to_cpu(hdr->frame_ctl);
 
 	skb->dev = ieee->dev;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
-        skb_reset_mac_header(skb);
-#else
-        skb->mac.raw = skb->data;
-#endif
+	skb_reset_mac_header(skb);
 	skb_pull(skb, ieee80211_get_hdrlen(fc));
 	skb->pkt_type = PACKET_OTHERHOST;
 	skb->protocol = __constant_htons(ETH_P_80211_RAW);
drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +9 -89

219 lines not on this page · raw message

drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c +0 -11
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
===================================================================
@@ -270,16 +270,9 @@ out:
 }
 
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
 void ieee80211_wx_sync_scan_wq(struct work_struct *work)
 {
 	struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
-#else
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
-{
-#endif
-//void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
-//{
 	short chan;
 
 	chan = ieee->current_network.channel;
@@ -379,11 +372,7 @@ int ieee80211_wx_set_essid(struct ieee80
 
 	if (wrqu->essid.flags && wrqu->essid.length) {
 //YJ,modified,080819
-#if LINUX_VERSION_CODE <  KERNEL_VERSION(2,6,20)
-		len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-#else
 		len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length) : IW_ESSID_MAX_SIZE;
-#endif
 		memset(ieee->current_network.ssid, 0, ieee->current_network.ssid_len); //YJ,add,080819
 		strncpy(ieee->current_network.ssid, extra, len);
 		ieee->current_network.ssid_len = len;
drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c +0 -8
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
===================================================================
@@ -308,11 +308,7 @@ ieee80211_classify(struct sk_buff *skb, 
 // based on part of ieee80211_xmit. Mainly allocate txb. ieee->lock is held
 struct ieee80211_txb *ieee80211_ext_alloc_txb(struct sk_buff *skb, struct net_device *dev, struct ieee80211_hdr_3addr *header, int hdr_len, u8 isQoS, u16 *pQOS_ctl, int isEncrypt, struct ieee80211_crypt_data* crypt)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 	struct ieee80211_device *ieee = netdev_priv(dev);
-#else
-	struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
-#endif
 	struct ieee80211_txb *txb = NULL;
 	struct ieee80211_hdr_3addr *frag_hdr;
 	int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size;
@@ -459,11 +455,7 @@ struct ieee80211_txb *ieee80211_ext_allo
 // Assume no encryption, no FCS computing
 struct ieee80211_txb *ieee80211_ext_reuse_txb(struct sk_buff *skb, struct net_device *dev, struct ieee80211_hdr_3addr *header, int hdr_len, u8 isQoS, u16 *pQOS_ctl, int isEncrypt, struct ieee80211_crypt_data* crypt)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 	struct ieee80211_device *ieee = netdev_priv(dev);
-#else
-	struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
-#endif
 	struct ieee80211_txb *txb = NULL;
 	struct ieee80211_hdr_3addr *frag_hdr;
 	int ether_type;
drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c +0 -60

158 lines not on this page · raw message

drivers/staging/rtl8187se/r8180.h +0 -4
Index: b/drivers/staging/rtl8187se/r8180.h
===================================================================
@@ -750,11 +750,7 @@ void rtl8185b_irq_enable(struct net_devi
 void fix_rx_fifo(struct net_device *dev);
 void fix_tx_fifo(struct net_device *dev);
 void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
-#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
 void rtl8180_rate_adapter(struct work_struct * work);
-#else
-void rtl8180_rate_adapter(struct net_device *dev);
-#endif
 //#endif
 bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, u32 ChangeSource);
 
drivers/staging/rtl8187se/r8180_core.c +5 -115

263 lines not on this page · raw message

drivers/staging/rtl8187se/r8180_dm.c +1 -19
Index: b/drivers/staging/rtl8187se/r8180_dm.c
===================================================================
@@ -126,7 +126,6 @@ DoTxHighPower(
 //		Because of some event happend, e.g. CCX TPC, High Power Mechanism,
 //		We update Tx power of current channel again.
 //
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 void rtl8180_tx_pw_wq (struct work_struct *work)
 {
 //      struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
@@ -135,11 +134,6 @@ void rtl8180_tx_pw_wq (struct work_struc
 	struct delayed_work *dwork = to_delayed_work(work);
         struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,tx_pw_wq);
         struct net_device *dev = ieee->dev;
-#else
-void rtl8180_tx_pw_wq(struct net_device *dev)
-{
-	// struct r8180_priv *priv = ieee80211_priv(dev);
-#endif
 
 //	printk("----> UpdateTxPowerWorkItemCallback()\n");
 
@@ -308,7 +302,6 @@ DynamicInitGain(
 	}
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 void rtl8180_hw_dig_wq (struct work_struct *work)
 {
 //      struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
@@ -317,11 +310,6 @@ void rtl8180_hw_dig_wq (struct work_stru
 	struct delayed_work *dwork = to_delayed_work(work);
         struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_dig_wq);
         struct net_device *dev = ieee->dev;
-#else
-void rtl8180_hw_dig_wq(struct net_device *dev)
-{
-
-#endif
 	struct r8180_priv *priv = ieee80211_priv(dev);
 
 	// Read CCK and OFDM False Alarm.
@@ -1245,19 +1233,13 @@ SetInitialGain:
 	priv->LastTxThroughput = TxThroughput;
 	priv->ieee80211->rate = priv->CurrentOperaRate * 5;
 }
-
 #endif
-#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
+
 void rtl8180_rate_adapter(struct work_struct * work)
 {
 	struct delayed_work *dwork = to_delayed_work(work);
         struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,rate_adapter_wq);
         struct net_device *dev = ieee->dev;
-#else
-void rtl8180_rate_adapter(struct net_device *dev)
-{
-
-#endif
         //struct r8180_priv *priv = ieee80211_priv(dev);
 //    DMESG("---->rtl8180_rate_adapter");
         StaRateAdaptive87SE(dev);
drivers/staging/rtl8187se/r8180_dm.h +0 -18
Index: b/drivers/staging/rtl8187se/r8180_dm.h
===================================================================
@@ -11,30 +11,12 @@ void SwAntennaDiversity(struct net_devic
 void SwAntennaDiversityTimerCallback(struct net_device *dev);
 bool CheckDig(struct net_device *dev);
 bool CheckHighPower(struct net_device *dev);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 void rtl8180_hw_dig_wq (struct work_struct *work);
-#else
-void rtl8180_hw_dig_wq(struct net_device *dev);
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 void rtl8180_tx_pw_wq (struct work_struct *work);
-#else
-void rtl8180_tx_pw_wq(struct net_device *dev);
-#endif
-#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
 void rtl8180_rate_adapter(struct work_struct * work);
-
-#else
-void rtl8180_rate_adapter(struct net_device *dev);
-
-#endif
 void TxPwrTracking87SE(struct net_device *dev);
 bool CheckTxPwrTracking(struct net_device *dev);
-#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
 void rtl8180_rate_adapter(struct work_struct * work);
-#else
-void rtl8180_rate_adapter(struct net_device *dev);
-#endif
 void timer_rate_adaptive(unsigned long data);