Commit 2fa5e380 authored by Jiri Kosina's avatar Jiri Kosina Committed by Greg Kroah-Hartman
Browse files

Staging: rtl8192e: remove all code dependent on LINUX_VERSION_CODE



Remove all code which is dead for in-kernel driver due to being
ifdefed by LINUX_VERSION_CODE.

While at it, also remove surrounding code which is commented out,
or '#if 1' nops.

Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3ff16c25
Loading
Loading
Loading
Loading
+0 −18
Original line number Original line Diff line number Diff line
@@ -218,22 +218,4 @@ int ToLegalChannel(


	return default_chn;
	return default_chn;
}
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
//EXPORT_SYMBOL(Dot11d_Init);
//EXPORT_SYMBOL(Dot11d_Reset);
//EXPORT_SYMBOL(Dot11d_UpdateCountryIe);
//EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm);
//EXPORT_SYMBOL(DOT11D_ScanComplete);
//EXPORT_SYMBOL(IsLegalChannel);
//EXPORT_SYMBOL(ToLegalChannel);
#else
EXPORT_SYMBOL_NOVERS(Dot11d_Init);
EXPORT_SYMBOL_NOVERS(Dot11d_Reset);
EXPORT_SYMBOL_NOVERS(Dot11d_UpdateCountryIe);
EXPORT_SYMBOL_NOVERS(DOT11D_GetMaxTxPwrInDbm);
EXPORT_SYMBOL_NOVERS(DOT11D_ScanComplete);
EXPORT_SYMBOL_NOVERS(IsLegalChannel);
EXPORT_SYMBOL_NOVERS(ToLegalChannel);
#endif

#endif
#endif
+1 −96
Original line number Original line Diff line number Diff line
@@ -27,12 +27,7 @@
#include <linux/kernel.h>   /* ARRAY_SIZE */
#include <linux/kernel.h>   /* ARRAY_SIZE */
#include <linux/version.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/module.h>
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
#include <linux/jiffies.h>
#include <linux/jiffies.h>
#else
#include <linux/jffs.h>
#include <linux/tqueue.h>
#endif
#include <linux/timer.h>
#include <linux/timer.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/semaphore.h>
#include <linux/semaphore.h>
@@ -44,12 +39,6 @@
#include "rtl819x_BA.h"
#include "rtl819x_BA.h"
#include "rtl819x_TS.h"
#include "rtl819x_TS.h"


#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
#ifndef bool
typedef enum{false = 0, true} bool;
#endif
#endif

#ifndef IW_MODE_MONITOR
#ifndef IW_MODE_MONITOR
#define IW_MODE_MONITOR 6
#define IW_MODE_MONITOR 6
#endif
#endif
@@ -428,46 +417,9 @@ typedef struct ieee_param {
#define IW_QUAL_NOISE_UPDATED  0x4
#define IW_QUAL_NOISE_UPDATED  0x4
#endif
#endif


#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data)
{
	task->routine = func;
	task->data 	= data;
	//task->next = NULL;
	INIT_LIST_HEAD(&task->list);
	task->sync = 0;
}
#endif

// linux under 2.6.9 release may not support it, so modify it for common use
// 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)
#define MSECS(t)	(HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
static inline unsigned long msleep_interruptible_rsl(unsigned int msecs)
{
         unsigned long timeout = MSECS(msecs) + 1;

         while (timeout) {
                 set_current_state(TASK_INTERRUPTIBLE);
                 timeout = schedule_timeout(timeout);
         }
         return timeout;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
static inline void msleep(unsigned int msecs)
{
         unsigned long timeout = MSECS(msecs) + 1;

         while (timeout) {
                 set_current_state(TASK_UNINTERRUPTIBLE);
                 timeout = schedule_timeout(timeout);
         }
}
#endif
#else
#define MSECS(t) msecs_to_jiffies(t)
#define MSECS(t) msecs_to_jiffies(t)
#define msleep_interruptible_rsl  msleep_interruptible
#define msleep_interruptible_rsl  msleep_interruptible
#endif


#define IEEE80211_DATA_LEN		2304
#define IEEE80211_DATA_LEN		2304
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -1747,21 +1699,6 @@ enum ieee80211_state {
#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
                                  IEEE80211_52GHZ_MIN_CHANNEL + 1)
                                  IEEE80211_52GHZ_MIN_CHANNEL + 1)


#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

typedef struct tx_pending_t{
typedef struct tx_pending_t{
	int frag;
	int frag;
	struct ieee80211_txb *txb;
	struct ieee80211_txb *txb;
@@ -1838,11 +1775,7 @@ typedef struct _RT_POWER_SAVE_CONTROL
	bool				bIPSModeBackup;
	bool				bIPSModeBackup;
	bool				bSwRfProcessing;
	bool				bSwRfProcessing;
	RT_RF_POWER_STATE	eInactivePowerState;
	RT_RF_POWER_STATE	eInactivePowerState;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
	struct work_struct 	InactivePsWorkItem;
	struct work_struct 	InactivePsWorkItem;
#else
	struct tq_struct	InactivePsWorkItem;
#endif
	struct timer_list	InactivePsTimer;
	struct timer_list	InactivePsTimer;


	// Return point for join action
	// Return point for join action
@@ -2329,36 +2262,16 @@ struct ieee80211_device {


	/* used if IEEE_SOFTMAC_BEACONS is set */
	/* used if IEEE_SOFTMAC_BEACONS is set */
	struct timer_list beacon_timer;
	struct timer_list beacon_timer;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
        struct work_struct associate_complete_wq;
        struct work_struct associate_complete_wq;
        struct work_struct associate_procedure_wq;
        struct work_struct associate_procedure_wq;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
        struct delayed_work softmac_scan_wq;
        struct delayed_work softmac_scan_wq;
        struct delayed_work associate_retry_wq;
        struct delayed_work associate_retry_wq;
	 struct delayed_work start_ibss_wq;
	 struct delayed_work start_ibss_wq;
	 struct delayed_work hw_wakeup_wq;
	 struct delayed_work hw_wakeup_wq;
	struct delayed_work hw_sleep_wq;
	struct delayed_work hw_sleep_wq;
#else

        struct work_struct softmac_scan_wq;
        struct work_struct associate_retry_wq;
	struct work_struct start_ibss_wq;
	struct work_struct hw_wakeup_wq;
	struct work_struct hw_sleep_wq;
#endif
        struct work_struct wx_sync_scan_wq;
        struct work_struct wx_sync_scan_wq;
        struct workqueue_struct *wq;
        struct workqueue_struct *wq;
#else
	/* used for periodly scan */
	struct timer_list scan_timer;

	struct tq_struct associate_complete_wq;
	struct tq_struct associate_retry_wq;
	struct tq_struct start_ibss_wq;
	struct tq_struct associate_procedure_wq;
	struct tq_struct softmac_scan_wq;
	struct tq_struct wx_sync_scan_wq;

#endif
        // Qos related. Added by Annie, 2005-11-01.
        // Qos related. Added by Annie, 2005-11-01.
        //STA_QOS  StaQos;
        //STA_QOS  StaQos;


@@ -2557,11 +2470,7 @@ struct ieee80211_device {


static inline void *ieee80211_priv(struct net_device *dev)
static inline void *ieee80211_priv(struct net_device *dev)
{
{
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
	return ((struct ieee80211_device *)netdev_priv(dev))->priv;
	return ((struct ieee80211_device *)netdev_priv(dev))->priv;
#else
	return ((struct ieee80211_device *)dev->priv)->priv;
#endif
}
}


extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
@@ -2814,11 +2723,7 @@ extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_reques
			     union iwreq_data *wrqu, char *b);
			     union iwreq_data *wrqu, char *b);


//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
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 int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+0 −20
Original line number Original line Diff line number Diff line
@@ -243,23 +243,3 @@ void ieee80211_crypto_deinit(void)
	kfree(hcrypt);
	kfree(hcrypt);
}
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
//EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
//EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
//EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);

//EXPORT_SYMBOL(ieee80211_register_crypto_ops);
//EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
//EXPORT_SYMBOL(ieee80211_get_crypto_ops);
#else
EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_entries);
EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_handler);
EXPORT_SYMBOL_NOVERS(ieee80211_crypt_delayed_deinit);

EXPORT_SYMBOL_NOVERS(ieee80211_register_crypto_ops);
EXPORT_SYMBOL_NOVERS(ieee80211_unregister_crypto_ops);
EXPORT_SYMBOL_NOVERS(ieee80211_get_crypto_ops);
#endif

//module_init(ieee80211_crypto_init);
//module_exit(ieee80211_crypto_deinit);
+0 −8
Original line number Original line Diff line number Diff line
@@ -82,12 +82,4 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
void ieee80211_crypt_deinit_handler(unsigned long);
void ieee80211_crypt_deinit_handler(unsigned long);
void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
				    struct ieee80211_crypt_data **crypt);
				    struct ieee80211_crypt_data **crypt);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
#define crypto_alloc_tfm crypto_alloc_tfm_rsl
#define crypto_free_tfm crypto_free_tfm_rsl
#endif

#endif
#endif
+0 −48
Original line number Original line Diff line number Diff line
@@ -24,18 +24,9 @@


#include "ieee80211.h"
#include "ieee80211.h"


#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "rtl_crypto.h"
#else
#include <linux/crypto.h>
#include <linux/crypto.h>
#endif


#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
    #include <asm/scatterlist.h>
#else
    #include <linux/scatterlist.h>
    #include <linux/scatterlist.h>
#endif
//#include <asm/scatterlist.h>


MODULE_AUTHOR("Jouni Malinen");
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -75,21 +66,7 @@ struct ieee80211_ccmp_data {
void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
			     const u8 pt[16], u8 ct[16])
			     const u8 pt[16], u8 ct[16])
{
{
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
	struct scatterlist src, dst;

	src.page = virt_to_page(pt);
	src.offset = offset_in_page(pt);
	src.length = AES_BLOCK_LEN;

	dst.page = virt_to_page(ct);
	dst.offset = offset_in_page(ct);
	dst.length = AES_BLOCK_LEN;

	crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
#else
	crypto_cipher_encrypt_one((void*)tfm, ct, pt);
	crypto_cipher_encrypt_one((void*)tfm, ct, pt);
#endif
}
}


static void * ieee80211_ccmp_init(int key_idx)
static void * ieee80211_ccmp_init(int key_idx)
@@ -101,14 +78,6 @@ static void * ieee80211_ccmp_init(int key_idx)
		goto fail;
		goto fail;
	priv->key_idx = key_idx;
	priv->key_idx = key_idx;


#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
	priv->tfm = crypto_alloc_tfm("aes", 0);
	if (priv->tfm == NULL) {
		printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
		       "crypto API aes\n");
		goto fail;
	}
       #else
       priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
       priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
	if (IS_ERR(priv->tfm)) {
	if (IS_ERR(priv->tfm)) {
		printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
		printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
@@ -116,17 +85,12 @@ static void * ieee80211_ccmp_init(int key_idx)
		priv->tfm = NULL;
		priv->tfm = NULL;
		goto fail;
		goto fail;
	}
	}
	#endif
	return priv;
	return priv;


fail:
fail:
	if (priv) {
	if (priv) {
		if (priv->tfm)
		if (priv->tfm)
			#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
			crypto_free_tfm(priv->tfm);
                    #else
			crypto_free_cipher((void*)priv->tfm);
			crypto_free_cipher((void*)priv->tfm);
		      #endif
		kfree(priv);
		kfree(priv);
	}
	}


@@ -138,11 +102,7 @@ static void ieee80211_ccmp_deinit(void *priv)
{
{
	struct ieee80211_ccmp_data *_priv = priv;
	struct ieee80211_ccmp_data *_priv = priv;
	if (_priv && _priv->tfm)
	if (_priv && _priv->tfm)
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
		crypto_free_tfm(_priv->tfm);
#else
		crypto_free_cipher((void*)_priv->tfm);
		crypto_free_cipher((void*)_priv->tfm);
#endif
	kfree(priv);
	kfree(priv);
}
}


@@ -528,11 +488,3 @@ void ieee80211_crypto_ccmp_exit(void)
	ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
	ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
}
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
//EXPORT_SYMBOL(ieee80211_ccmp_null);
#else
EXPORT_SYMBOL_NOVERS(ieee80211_ccmp_null);
#endif

//module_init(ieee80211_crypto_ccmp_init);
//module_exit(ieee80211_crypto_ccmp_exit);
Loading