OSDN Git Service

Remove support for kernels older than 2.6.32
authorJes Sorensen <Jes.Sorensen@redhat.com>
Wed, 4 Dec 2013 12:33:13 +0000 (13:33 +0100)
committerLarry Finger <Larry.Finger@lwfinger.net>
Wed, 4 Dec 2013 13:57:36 +0000 (07:57 -0600)
Current enterprise distros use at least 2.6.32 (RHEL6 is based on
2.6.32, SLES11 is based on 3.0), and desktop distros are much more
uptodate.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
15 files changed:
core/rtw_pwrctrl.c
core/rtw_xmit.c
hal/rtl8723au_xmit.c
hal/usb_ops_linux.c
include/osdep_service.h
include/rtw_event.h
include/rtw_io.h
include/usb_ops.h
include/usb_ops_linux.h
os_dep/ioctl_cfg80211.c
os_dep/ioctl_linux.c
os_dep/mlme_linux.c
os_dep/os_intfs.c
os_dep/osdep_service.c
os_dep/usb_intf.c

index 4808915..0633bcc 100644 (file)
@@ -792,11 +792,11 @@ _func_enter_;
                        #ifdef CONFIG_AUTOSUSPEND
                        if(Adapter->registrypriv.usbss_enable)
                        {
-                               #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
                                usb_disable_autosuspend(adapter_to_dvobj(Adapter)->pusbdev);
-                               #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,34))
+#else
                                adapter_to_dvobj(Adapter)->pusbdev->autosuspend_disabled = Adapter->bDisableAutosuspend;/* autosuspend disabled by the user */
-                               #endif
+#endif
                        }
                        else
                        #endif
@@ -1627,10 +1627,8 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller)
                                {
                                        DBG_8723A( "can't get autopm: \n");
                                }
-                       #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
-                               usb_autopm_disable(adapter_to_dvobj(padapter)->pusbintf);
                        #else
-                               usb_autoresume_device(adapter_to_dvobj(padapter)->pusbdev, 1);
+                               usb_autopm_disable(adapter_to_dvobj(padapter)->pusbintf);
                        #endif
                        pwrpriv->autopm_cnt++;
                        }
index a63380d..6fd8fbd 100644 (file)
@@ -2781,11 +2781,7 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb)
                                if (skb_is_nonlinear(skb))
                                        DEBUG_ERR("%s(): skb_is_nonlinear!!\n", __FUNCTION__);
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18))
-                               res = skb_linearize(skb, GFP_ATOMIC);
-#else  /*  (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)) */
                                res = skb_linearize(skb);
-#endif /*  (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)) */
                                if (res < 0) {
                                                DEBUG_ERR("TX DROP: skb_linearize fail!\n");
                                                /* goto free_and_stop; */
index 843c376..f56db2e 100644 (file)
@@ -1121,11 +1121,7 @@ s32 rtl8192cu_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
        if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT)
                goto _exit;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) // http://www.mail-archive.com/netdev@vger.kernel.org/msg17214.html
-       pxmit_skb = dev_alloc_skb(len + TXDESC_SIZE);
-#else
        pxmit_skb = netdev_alloc_skb(pnetdev, len + TXDESC_SIZE);
-#endif
 
        if(!pxmit_skb)
                goto _exit;
index b582ea7..d6a74f0 100644 (file)
@@ -749,11 +749,7 @@ static int recvbuf2recvframe(_adapter *padapter, struct recv_buf *precvbuf)
                        alloc_sz += 14;
                }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) // http://www.mail-archive.com/netdev@vger.kernel.org/msg17214.html
-               pkt_copy = dev_alloc_skb(alloc_sz);
-#else
                pkt_copy = netdev_alloc_skb(padapter->pnetdev, alloc_sz);
-#endif
                if(pkt_copy)
                {
                        pkt_copy->dev = padapter->pnetdev;
@@ -1153,11 +1149,7 @@ static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxsta
                                        alloc_sz += 14;
                                }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) // http://www.mail-archive.com/netdev@vger.kernel.org/msg17214.html
-                               pkt_copy = dev_alloc_skb(alloc_sz);
-#else
                                pkt_copy = netdev_alloc_skb(secondary_padapter->pnetdev, alloc_sz);
-#endif
                                if(pkt_copy)
                                {
                                        pkt_copy->dev = secondary_padapter->pnetdev;
@@ -1296,12 +1288,8 @@ static int recvbuf2recvframe(_adapter *padapter, _pkt *pskb)
                        alloc_sz += 14;
                }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) // http://www.mail-archive.com/netdev@vger.kernel.org/msg17214.html
-               pkt_copy = dev_alloc_skb(alloc_sz);
-#else
                pkt_copy = netdev_alloc_skb(padapter->pnetdev, alloc_sz);
-#endif
-               if(pkt_copy)
+               if (pkt_copy)
                {
                        pkt_copy->dev = padapter->pnetdev;
                        precvframe->u.hdr.pkt = pkt_copy;
@@ -1573,12 +1561,8 @@ _func_enter_;
        //re-assign for linux based on skb
        if((precvbuf->reuse == _FALSE) || (precvbuf->pskb == NULL)) {
                //precvbuf->pskb = alloc_skb(MAX_RECVBUF_SZ, GFP_ATOMIC);//don't use this after v2.6.25
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) // http://www.mail-archive.com/netdev@vger.kernel.org/msg17214.html
-               precvbuf->pskb = dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
-#else
                precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
-#endif
-               if(precvbuf->pskb == NULL) {
+               if (precvbuf->pskb == NULL) {
                        RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("init_recvbuf(): alloc_skb fail!\n"));
                        return _FAIL;
                }
index 3809d06..6b4a01f 100644 (file)
 #include <asm/byteorder.h>
 #include <asm/atomic.h>
 #include <asm/io.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
-       #include <asm/semaphore.h>
-#else
-       #include <linux/semaphore.h>
-#endif
+#include <linux/semaphore.h>
 #include <linux/sem.h>
 #include <linux/sched.h>
 #include <linux/etherdevice.h>
 #endif
 
 #include <linux/usb.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
-#include <linux/usb_ch9.h>
-#else
 #include <linux/usb/ch9.h>
-#endif
 
 typedef struct urb *  PURB;
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22))
 #ifdef CONFIG_USB_SUSPEND
 #define CONFIG_AUTOSUSPEND     1
 #endif
-#endif
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
 typedef struct mutex           _mutex;
@@ -122,32 +112,6 @@ typedef void timer_hdl_return;
 typedef void* timer_hdl_context;
 typedef struct work_struct _workitem;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
-#endif
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
-// Porting from linux kernel, for compatible with old kernel.
-static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
-{
-       return skb->tail;
-}
-
-static inline void skb_reset_tail_pointer(struct sk_buff *skb)
-{
-       skb->tail = skb->data;
-}
-
-static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
-{
-       skb->tail = skb->data + offset;
-}
-
-static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
-{
-       return skb->end;
-}
-#endif
 
 __inline static struct list_head *get_next(struct list_head    *list)
 {
@@ -213,11 +177,7 @@ __inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
 
 __inline static void _init_workitem(_workitem *pwork, void *pfunc, void *cntx)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
        INIT_WORK(pwork, pfunc);
-#else
-       INIT_WORK(pwork, pfunc,pwork);
-#endif
 }
 
 __inline static void _set_workitem(_workitem *pwork)
@@ -227,11 +187,7 @@ __inline static void _set_workitem(_workitem *pwork)
 
 __inline static void _cancel_workitem_sync(_workitem *pwork)
 {
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22))
        cancel_work_sync(pwork);
-#else
-       flush_scheduled_work();
-#endif
 }
 //
 // Global Mutex: can only be used at PASSIVE level.
@@ -549,11 +505,7 @@ extern void rtw_free_netdev(struct net_device * netdev);
 #define FUNC_ADPT_FMT "%s(%s)"
 #define FUNC_ADPT_ARG(adapter) __func__, adapter->pnetdev->name
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
 #define rtw_signal_process(pid, sig) kill_pid(find_vpid((pid)),(sig), 1)
-#else //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
-#define rtw_signal_process(pid, sig) kill_proc((pid), (sig), 1)
-#endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
 
 extern u64 rtw_modular64(u64 x, u64 y);
 extern u64 rtw_division64(u64 x, u64 y);
index a5a25cd..98a59ce 100644 (file)
 
 #ifndef CONFIG_RTL8711FW
 #include <wlan_bssdef.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
-#include <asm/semaphore.h>
-#else
 #include <linux/semaphore.h>
-#endif
 #include <linux/sem.h>
 #else
 #include <wlan_bssdef.h>
index 6bc6ab7..bc0a718 100644 (file)
 #include <osdep_intf.h>
 
 #include <asm/byteorder.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
-#include <asm/semaphore.h>
-#else
 #include <linux/semaphore.h>
-#endif
 #include <linux/list.h>
 //#include <linux/smp_lock.h>
 #include <linux/spinlock.h>
 #include <asm/atomic.h>
 
 #include <linux/usb.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
-#include <linux/usb_ch9.h>
-#else
 #include <linux/usb/ch9.h>
-#endif
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
 #define rtw_usb_buffer_alloc(dev, size, dma) usb_alloc_coherent((dev), (size), (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL), (dma))
index 3c60fb7..ad2bb5f 100644 (file)
@@ -38,19 +38,10 @@ enum{
 #define MAX_VENDOR_REQ_CMD_SIZE        254             //8188cu SIE Support
 #define MAX_USB_IO_CTL_SIZE            (MAX_VENDOR_REQ_CMD_SIZE +ALIGNMENT_UNIT)
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
 #define rtw_usb_control_msg(dev, pipe, request, requesttype, value, index, data, size, timeout_ms) \
        usb_control_msg((dev), (pipe), (request), (requesttype), (value), (index), (data), (size), (timeout_ms))
 #define rtw_usb_bulk_msg(usb_dev, pipe, data, len, actual_length, timeout_ms) \
        usb_bulk_msg((usb_dev), (pipe), (data), (len), (actual_length), (timeout_ms))
-#else
-#define rtw_usb_control_msg(dev, pipe, request, requesttype, value, index, data, size,timeout_ms) \
-       usb_control_msg((dev), (pipe), (request), (requesttype), (value), (index), (data), (size), \
-               ((timeout_ms) == 0) ||((timeout_ms)*HZ/1000>0)?((timeout_ms)*HZ/1000):1)
-#define rtw_usb_bulk_msg(usb_dev, pipe, data, len, actual_length, timeout_ms) \
-       usb_bulk_msg((usb_dev), (pipe), (data), (len), (actual_length), \
-               ((timeout_ms) == 0) ||((timeout_ms)*HZ/1000>0)?((timeout_ms)*HZ/1000):1)
-#endif
 #include <usb_ops_linux.h>
 
 #ifdef CONFIG_RTL8192C
index d3a5507..96feae0 100644 (file)
 
 #define RTW_USB_BULKOUT_TIMEOUT        5000//ms
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) || (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
 #define _usbctrl_vendorreq_async_callback(urb, regs)   _usbctrl_vendorreq_async_callback(urb)
 #define usb_bulkout_zero_complete(purb, regs)  usb_bulkout_zero_complete(purb)
 #define usb_write_mem_complete(purb, regs)     usb_write_mem_complete(purb)
 #define usb_write_port_complete(purb, regs)    usb_write_port_complete(purb)
 #define usb_read_port_complete(purb, regs)     usb_read_port_complete(purb)
 #define usb_read_interrupt_complete(purb, regs)        usb_read_interrupt_complete(purb)
-#endif
 
 #ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ
 int usb_async_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val);
index 4ce88ca..714efb1 100644 (file)
@@ -3373,7 +3373,6 @@ static int rtw_cfg80211_monitor_if_set_mac_address(struct net_device *ndev, void
        return ret;
 }
 
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
 static const struct net_device_ops rtw_cfg80211_monitor_if_ops = {
        .ndo_open = rtw_cfg80211_monitor_if_open,
        .ndo_stop = rtw_cfg80211_monitor_if_close,
@@ -3383,7 +3382,6 @@ static const struct net_device_ops rtw_cfg80211_monitor_if_ops = {
        #endif
        .ndo_set_mac_address = rtw_cfg80211_monitor_if_set_mac_address,
 };
-#endif
 
 static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct net_device **ndev)
 {
@@ -3418,14 +3416,7 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct ne
        mon_ndev->name[IFNAMSIZ - 1] = 0;
        mon_ndev->destructor = rtw_ndev_destructor;
 
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
        mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops;
-#else
-       mon_ndev->open = rtw_cfg80211_monitor_if_open;
-       mon_ndev->stop = rtw_cfg80211_monitor_if_close;
-       mon_ndev->hard_start_xmit = rtw_cfg80211_monitor_if_xmit_entry;
-       mon_ndev->set_mac_address = rtw_cfg80211_monitor_if_set_mac_address;
-#endif
 
        pnpi = netdev_priv(mon_ndev);
        pnpi->priv = padapter;
index a6a3e7a..39947b6 100644 (file)
@@ -55,12 +55,6 @@ extern s32 FillH2CCmd(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffe
 #endif
 
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
-#define  iwe_stream_add_event(a, b, c, d, e)  iwe_stream_add_event(b, c, d, e)
-#define  iwe_stream_add_point(a, b, c, d, e)  iwe_stream_add_point(b, c, d, e)
-#endif
-
-
 #define RTL_IOCTL_WPA_SUPPLICANT       SIOCIWFIRSTPRIV+30
 
 #define SCAN_ITEM_SIZE 768
@@ -10018,11 +10012,7 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev)
                piwstats->qual.qual = tmp_qual;
                piwstats->qual.noise = tmp_noise;
        }
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
        piwstats->qual.updated = IW_QUAL_ALL_UPDATED ;//|IW_QUAL_DBM;
-#else
-       piwstats->qual.updated = 0x0f;
-#endif
 
        #ifdef CONFIG_SIGNAL_DISPLAY_DBM
        piwstats->qual.updated = piwstats->qual.updated | IW_QUAL_DBM;
index e1b21a2..c7c633f 100644 (file)
@@ -400,7 +400,6 @@ static int mgnt_netdev_close(struct net_device *pnetdev)
        return 0;
 }
 
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
 static const struct net_device_ops rtl871x_mgnt_netdev_ops = {
        .ndo_open = mgnt_netdev_open,
        .ndo_stop = mgnt_netdev_close,
@@ -409,7 +408,6 @@ static const struct net_device_ops rtl871x_mgnt_netdev_ops = {
        //.ndo_get_stats = r871x_net_get_stats,
        //.ndo_do_ioctl = r871x_mp_ioctl,
 };
-#endif
 
 int hostapd_mode_init(_adapter *padapter)
 {
@@ -433,28 +431,10 @@ int hostapd_mode_init(_adapter *padapter)
 
        //pnetdev->init = NULL;
 
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
-
        DBG_8723A("register rtl871x_mgnt_netdev_ops to netdev_ops\n");
 
        pnetdev->netdev_ops = &rtl871x_mgnt_netdev_ops;
 
-#else
-
-       pnetdev->open = mgnt_netdev_open;
-
-       pnetdev->stop = mgnt_netdev_close;
-
-       pnetdev->hard_start_xmit = mgnt_xmit_entry;
-
-       //pnetdev->set_mac_address = r871x_net_set_mac_address;
-
-       //pnetdev->get_stats = r871x_net_get_stats;
-
-       //pnetdev->do_ioctl = r871x_mp_ioctl;
-
-#endif
-
        pnetdev->watchdog_timeo = HZ; /* 1 second timeout */
 
        //pnetdev->wireless_handlers = NULL;
index edc7dce..58277b8 100644 (file)
@@ -332,11 +332,7 @@ void rtw_proc_init_one(struct net_device *dev)
                        memcpy(rtw_proc_name, RTW_PROC_NAME, sizeof(RTW_PROC_NAME));
                }
 
-#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-               rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, proc_net);
-#else
                rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, init_net.proc_net);
-#endif
                if (rtw_proc == NULL) {
                        DBG_8723A(KERN_ERR "Unable to create rtw_proc directory\n");
                        return;
@@ -364,11 +360,8 @@ void rtw_proc_init_one(struct net_device *dev)
                        if(rtw_proc_cnt == 0)
                        {
                                if(rtw_proc){
-#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-                                       remove_proc_entry(rtw_proc_name, proc_net);
-#else
-                                       remove_proc_entry(rtw_proc_name, init_net.proc_net);
-#endif
+                                       remove_proc_entry(rtw_proc_name,
+                                                         init_net.proc_net);
                                        rtw_proc = NULL;
                                }
                        }
@@ -714,11 +707,7 @@ void rtw_proc_remove_one(struct net_device *dev)
                if(rtw_proc){
                        remove_proc_entry("ver_info", rtw_proc);
 
-#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-                       remove_proc_entry(rtw_proc_name, proc_net);
-#else
                        remove_proc_entry(rtw_proc_name, init_net.proc_net);
-#endif
                        rtw_proc = NULL;
                }
        }
@@ -972,7 +961,6 @@ u16 rtw_recv_select_queue(struct sk_buff *skb)
 
 #endif
 
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
 static const struct net_device_ops rtw_netdev_ops = {
        .ndo_open = netdev_open,
        .ndo_stop = netdev_close,
@@ -984,7 +972,6 @@ static const struct net_device_ops rtw_netdev_ops = {
        .ndo_get_stats = rtw_net_get_stats,
        .ndo_do_ioctl = rtw_ioctl,
 };
-#endif
 
 int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname)
 {
@@ -997,16 +984,8 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname)
 
        if(padapter->bDongle == 1)
        {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-               TargetNetdev = dev_get_by_name("wlan0");
-#else
-       #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
-               devnet = pnetdev->nd_net;
-       #else
                devnet = dev_net(pnetdev);
-       #endif
                TargetNetdev = dev_get_by_name(devnet, "wlan0");
-#endif
                if(TargetNetdev) {
                        DBG_8723A("Force onboard module driver disappear !!!\n");
                        TargetAdapter = rtw_netdev_priv(TargetNetdev);
@@ -1061,24 +1040,10 @@ struct net_device *rtw_init_netdev(_adapter *old_padapter)
        padapter = rtw_netdev_priv(pnetdev);
        padapter->pnetdev = pnetdev;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
-       SET_MODULE_OWNER(pnetdev);
-#endif
-
        //pnetdev->init = NULL;
 
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
        DBG_8723A("register rtw_netdev_ops to netdev_ops\n");
        pnetdev->netdev_ops = &rtw_netdev_ops;
-#else
-       pnetdev->open = netdev_open;
-       pnetdev->stop = netdev_close;
-       pnetdev->hard_start_xmit = rtw_xmit_entry;
-       pnetdev->set_mac_address = rtw_net_set_mac_address;
-       pnetdev->get_stats = rtw_net_get_stats;
-       pnetdev->do_ioctl = rtw_ioctl;
-#endif
-
 
 #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
        pnetdev->features |= NETIF_F_IP_CSUM;
@@ -1685,7 +1650,6 @@ static int netdev_if2_close(struct net_device *pnetdev)
        return 0;
 }
 
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
 static const struct net_device_ops rtw_netdev_if2_ops = {
        .ndo_open = netdev_if2_open,
         .ndo_stop = netdev_if2_close,
@@ -1697,7 +1661,6 @@ static const struct net_device_ops rtw_netdev_if2_ops = {
        .ndo_select_queue       = rtw_select_queue,
 #endif
 };
-#endif
 
 
        #include <usb_hal.h>
@@ -1714,13 +1677,8 @@ _adapter *rtw_drv_if2_init(_adapter *primary_padapter, void (*set_intf_ops)(stru
        if (!pnetdev)
                goto error_rtw_drv_if2_init;
 
-#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
        DBG_8723A("register rtw_netdev_if2_ops to netdev_ops\n");
        pnetdev->netdev_ops = &rtw_netdev_if2_ops;
-#else
-       pnetdev->open = netdev_if2_open;
-       pnetdev->stop = netdev_if2_close;
-#endif
 
 #ifdef CONFIG_NO_WIRELESS_HANDLERS
        pnetdev->wireless_handlers = NULL;
@@ -1918,19 +1876,11 @@ void netdev_br_init(struct net_device *netdev)
 #endif  // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
                {
                        struct net_device *br_netdev;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-                       br_netdev = dev_get_by_name(CONFIG_BR_EXT_BRNAME);
-#else  // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
                        struct net *devnet = NULL;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
-                       devnet = netdev->nd_net;
-#else  // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
                        devnet = dev_net(netdev);
-#endif // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
 
                        br_netdev = dev_get_by_name(devnet, CONFIG_BR_EXT_BRNAME);
-#endif // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
 
                        if (br_netdev) {
                                memcpy(adapter->br_mac, br_netdev->dev_addr, ETH_ALEN);
index cab1a14..4392dba 100644 (file)
@@ -661,11 +661,9 @@ int rtw_change_ifname(_adapter *padapter, const char *ifname)
                rereg_priv->old_pnetdev = NULL;
        }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
        if(!rtnl_is_locked())
                unregister_netdev(cur_pnetdev);
        else
-#endif
                unregister_netdevice(cur_pnetdev);
 
        rtw_proc_remove_one(cur_pnetdev);
@@ -684,11 +682,9 @@ int rtw_change_ifname(_adapter *padapter, const char *ifname)
 
        memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
        if(!rtnl_is_locked())
                ret = register_netdev(pnetdev);
        else
-#endif
                ret = register_netdevice(pnetdev);
 
        if ( ret != 0) {
index 7915480..fbe2e6b 100644 (file)
@@ -52,59 +52,6 @@ int rtw_resume_process(_adapter *padapter);
 static int rtw_drv_init(struct usb_interface *pusb_intf,const struct usb_device_id *pdid);
 static void rtw_dev_remove(struct usb_interface *pusb_intf);
 
-#if (LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,23))
-/* Some useful macros to use to create struct usb_device_id */
- #define USB_DEVICE_ID_MATCH_VENDOR                     0x0001
- #define USB_DEVICE_ID_MATCH_PRODUCT                    0x0002
- #define USB_DEVICE_ID_MATCH_DEV_LO                     0x0004
- #define USB_DEVICE_ID_MATCH_DEV_HI                     0x0008
- #define USB_DEVICE_ID_MATCH_DEV_CLASS                  0x0010
- #define USB_DEVICE_ID_MATCH_DEV_SUBCLASS               0x0020
- #define USB_DEVICE_ID_MATCH_DEV_PROTOCOL               0x0040
- #define USB_DEVICE_ID_MATCH_INT_CLASS                  0x0080
- #define USB_DEVICE_ID_MATCH_INT_SUBCLASS               0x0100
- #define USB_DEVICE_ID_MATCH_INT_PROTOCOL               0x0200
- #define USB_DEVICE_ID_MATCH_INT_NUMBER                         0x0400
-
-
-#define USB_DEVICE_ID_MATCH_INT_INFO \
-                                (USB_DEVICE_ID_MATCH_INT_CLASS | \
-                                USB_DEVICE_ID_MATCH_INT_SUBCLASS | \
-                                USB_DEVICE_ID_MATCH_INT_PROTOCOL)
-
-
-#define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \
-                .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
-                                | USB_DEVICE_ID_MATCH_DEVICE, \
-                .idVendor = (vend), \
-                .idProduct = (prod), \
-                .bInterfaceClass = (cl), \
-                .bInterfaceSubClass = (sc), \
-                .bInterfaceProtocol = (pr)
-
- /**
-  * USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces
-  * @vend: the 16 bit USB Vendor ID
-  * @cl: bInterfaceClass value
-  * @sc: bInterfaceSubClass value
-  * @pr: bInterfaceProtocol value
-  *
-  * This macro is used to create a struct usb_device_id that matches a
-  * specific vendor with a specific class of interfaces.
-  *
-  * This is especially useful when explicitly matching devices that have
-  * vendor specific bDeviceClass values, but standards-compliant interfaces.
-  */
-#define USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \
-                .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
-                                | USB_DEVICE_ID_MATCH_VENDOR, \
-                .idVendor = (vend), \
-                .bInterfaceClass = (cl), \
-                .bInterfaceSubClass = (sc), \
-                .bInterfaceProtocol = (pr)
-
-/* ----------------------------------------------------------------------- */
-#endif
 
 #define USB_VENDER_ID_REALTEK          0x0BDA
 
@@ -149,9 +96,7 @@ struct rtw_usb_drv rtl8192c_usb_drv = {
        .usbdrv.id_table = rtl8192c_usb_id_tbl,
        .usbdrv.suspend =  rtw_suspend,
        .usbdrv.resume = rtw_resume,
-       #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))
        .usbdrv.reset_resume   = rtw_resume,
-       #endif
        #ifdef CONFIG_AUTOSUSPEND
        .usbdrv.supports_autosuspend = 1,
        #endif
@@ -173,9 +118,7 @@ struct rtw_usb_drv rtl8192d_usb_drv = {
        .usbdrv.id_table = rtl8192d_usb_id_tbl,
        .usbdrv.suspend =  rtw_suspend,
        .usbdrv.resume = rtw_resume,
-       #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))
        .usbdrv.reset_resume   = rtw_resume,
-       #endif
        #ifdef CONFIG_AUTOSUSPEND
        .usbdrv.supports_autosuspend = 1,
        #endif
@@ -196,9 +139,7 @@ static struct rtw_usb_drv rtl8723a_usb_drv = {
        .usbdrv.id_table = rtl8723a_usb_id_tbl,
        .usbdrv.suspend =  rtw_suspend,
        .usbdrv.resume = rtw_resume,
-       #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))
        .usbdrv.reset_resume   = rtw_resume,
-       #endif
        #ifdef CONFIG_AUTOSUSPEND
        .usbdrv.supports_autosuspend = 1,
        #endif
@@ -220,9 +161,7 @@ struct rtw_usb_drv rtl8188e_usb_drv = {
        .usbdrv.id_table = rtl8188e_usb_id_tbl,
        .usbdrv.suspend =  rtw_suspend,
        .usbdrv.resume = rtw_resume,
-       #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))
        .usbdrv.reset_resume   = rtw_resume,
-       #endif
        #ifdef CONFIG_AUTOSUSPEND
        .usbdrv.supports_autosuspend = 1,
        #endif
@@ -883,13 +822,8 @@ int rtw_resume_process(_adapter *padapter)
        down(&pwrpriv->lock);
 #ifdef CONFIG_BT_COEXIST
 #ifdef CONFIG_AUTOSUSPEND
-       #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32))
        DBG_8723A("%s...pm_usage_cnt(%d)  pwrpriv->bAutoResume=%x.  ....\n",__func__,atomic_read(&(adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt)),pwrpriv->bAutoResume);
        pm_cnt=atomic_read(&(adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt));
-       #else
-       DBG_8723A("...pm_usage_cnt(%d).....\n", adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt);
-       pm_cnt = adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt;
-       #endif
 
        DBG_8723A("pwrpriv->bAutoResume (%x)\n",pwrpriv->bAutoResume );
        if( _TRUE == pwrpriv->bAutoResume ){
@@ -999,10 +933,8 @@ void autosuspend_enter(_adapter* padapter)
 
                #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
                        usb_autopm_put_interface(dvobj->pusbintf);
-               #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
-                       usb_autopm_enable(dvobj->pusbintf);
                #else
-                       usb_autosuspend_device(dvobj->pusbdev, 1);
+                       usb_autopm_enable(dvobj->pusbintf);
                #endif
 #else  //#ifndef       CONFIG_BT_COEXIST
                if(1==pwrpriv->autopm_cnt){
@@ -1014,10 +946,8 @@ void autosuspend_enter(_adapter* padapter)
 
                #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
                        usb_autopm_put_interface(dvobj->pusbintf);
-               #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
-                       usb_autopm_enable(dvobj->pusbintf);
                #else
-                       usb_autosuspend_device(dvobj->pusbdev, 1);
+                       usb_autopm_enable(dvobj->pusbintf);
                #endif
                        pwrpriv->autopm_cnt --;
                }
@@ -1026,12 +956,7 @@ void autosuspend_enter(_adapter* padapter)
 
 #endif //#ifndef       CONFIG_BT_COEXIST
        }
-       #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32))
        DBG_8723A("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt)));
-       #else
-       DBG_8723A("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt);
-       #endif
-
 }
 int autoresume_enter(_adapter* padapter)
 {
@@ -1055,17 +980,11 @@ int autoresume_enter(_adapter* padapter)
                                result = _FAIL;
                                goto error_exit;
                        }
-               #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
-                       usb_autopm_disable(dvobj->pusbintf);
                #else
-                       usb_autoresume_device(dvobj->pusbdev, 1);
+                       usb_autopm_disable(dvobj->pusbintf);
                #endif
 
-               #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32))
                DBG_8723A("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt)));
-               #else
-               DBG_8723A("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt);
-               #endif
 #else  //#ifndef       CONFIG_BT_COEXIST
                pwrpriv->bAutoResume=_TRUE;
                if(0==pwrpriv->autopm_cnt){
@@ -1076,16 +995,10 @@ int autoresume_enter(_adapter* padapter)
                                result = _FAIL;
                                goto error_exit;
                        }
-               #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
-                       usb_autopm_disable(dvobj->pusbintf);
                #else
-                       usb_autoresume_device(dvobj->pusbdev, 1);
+                       usb_autopm_disable(dvobj->pusbintf);
                #endif
-               #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32))
                        DBG_8723A("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt)));
-               #else
-                       DBG_8723A("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt);
-               #endif
                        pwrpriv->autopm_cnt++;
                }
                else
@@ -1184,7 +1097,6 @@ static _adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
        }
 
 #ifdef CONFIG_PM
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
        if(padapter->pwrctrlpriv.bSupportRemoteWakeup)
        {
                dvobj->pusbdev->do_remote_wakeup=1;
@@ -1194,42 +1106,37 @@ static _adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
                DBG_8723A("\n  padapter->pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n",device_may_wakeup(&pusb_intf->dev));
        }
 #endif
-#endif
 
 #ifdef CONFIG_AUTOSUSPEND
        if( padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE )
        {
                if(padapter->registrypriv.usbss_enable ){       /* autosuspend (2s delay) */
-                       #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,38))
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,38))
                        dvobj->pusbdev->dev.power.autosuspend_delay = 0 * HZ;//15 * HZ; idle-delay time
-                       #else
+#else
                        dvobj->pusbdev->autosuspend_delay = 0 * HZ;//15 * HZ; idle-delay time
-                       #endif
+#endif
 
-                       #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
                        usb_enable_autosuspend(dvobj->pusbdev);
-                       #elif  (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,34))
+#elif  (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,34))
                        padapter->bDisableAutosuspend = dvobj->pusbdev->autosuspend_disabled ;
                        dvobj->pusbdev->autosuspend_disabled = 0;//autosuspend disabled by the user
-                       #endif
+#endif
 
                        //usb_autopm_get_interface(adapter_to_dvobj(padapter)->pusbintf );//init pm_usage_cnt ,let it start from 1
 
-                       #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32))
                        DBG_8723A("%s...pm_usage_cnt(%d).....\n",__FUNCTION__,atomic_read(&(dvobj->pusbintf ->pm_usage_cnt)));
-                       #else
-                       DBG_8723A("%s...pm_usage_cnt(%d).....\n",__FUNCTION__,dvobj->pusbintf ->pm_usage_cnt);
-                       #endif
                }
        }
 #endif
        //2012-07-11 Move here to prevent the 8723AS-VAU BT auto suspend influence
-       #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
                        if (usb_autopm_get_interface(pusb_intf) < 0)
                                {
                                        DBG_8723A( "can't get autopm: \n");
                                }
-       #endif
+#endif
 #ifdef CONFIG_BT_COEXIST
        padapter->pwrctrlpriv.autopm_cnt=1;
 #endif
@@ -1319,10 +1226,8 @@ static void rtw_usb_if1_deinit(_adapter *if1)
        if(1 == if1->pwrctrlpriv.autopm_cnt){
                #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
                        usb_autopm_put_interface(adapter_to_dvobj(if1)->pusbintf);
-               #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
-                       usb_autopm_enable(adapter_to_dvobj(if1)->pusbintf);
                #else
-                       usb_autosuspend_device(adapter_to_dvobj(if1)->pusbdev, 1);
+                       usb_autopm_enable(adapter_to_dvobj(if1)->pusbintf);
                #endif
                if1->pwrctrlpriv.autopm_cnt --;
        }
@@ -1591,9 +1496,7 @@ _func_exit_;
        return;
 
 }
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
 extern int console_suspend_enabled;
-#endif
 
 static int __init rtw_drv_entry(void)
 {