aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-26 16:04:22 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-19 11:00:39 -0700
commit8179af308bde85838eafa3db304da7370223ab82 (patch)
treea9244f682464b8fac591d86e8407b620effa1454
parentce6ee223f0438355f4b11ace5df2a787e3fb6820 (diff)
Staging: rt2870: remove kernel version compatibility wrappers
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/rt2870/2870_main_dev.c139
-rw-r--r--drivers/staging/rt2870/common/rtusb_bulk.c12
-rw-r--r--drivers/staging/rt2870/rt2870.h24
-rw-r--r--drivers/staging/rt2870/rt_ate.h4
-rw-r--r--drivers/staging/rt2870/rt_linux.c23
-rw-r--r--drivers/staging/rt2870/rt_linux.h18
-rw-r--r--drivers/staging/rt2870/rt_main_dev.c112
-rw-r--r--drivers/staging/rt2870/sta_ioctl.c10
8 files changed, 8 insertions, 334 deletions
diff --git a/drivers/staging/rt2870/2870_main_dev.c b/drivers/staging/rt2870/2870_main_dev.c
index 9d59e3167fe..aa8f1e185bd 100644
--- a/drivers/staging/rt2870/2870_main_dev.c
+++ b/drivers/staging/rt2870/2870_main_dev.c
@@ -77,26 +77,6 @@ MODULE_DEVICE_TABLE(usb, rtusb_usb_id);
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-
-/**************************************************************************/
-/**************************************************************************/
-//tested for kernel 2.4 series
-/**************************************************************************/
-/**************************************************************************/
-static void *rtusb_probe(struct usb_device *dev, UINT interface,
- const struct usb_device_id *id_table);
-static void rtusb_disconnect(struct usb_device *dev, void *ptr);
-
-struct usb_driver rtusb_driver = {
- name:"rt2870",
- probe:rtusb_probe,
- disconnect:rtusb_disconnect,
- id_table:rtusb_usb_id,
- };
-
-#else
-
#ifdef CONFIG_PM
static int rt2870_suspend(struct usb_interface *intf, pm_message_t state);
static int rt2870_resume(struct usb_interface *intf);
@@ -112,9 +92,6 @@ static int rtusb_probe (struct usb_interface *intf,
static void rtusb_disconnect(struct usb_interface *intf);
struct usb_driver rtusb_driver = {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
- .owner = THIS_MODULE,
-#endif
.name="rt2870",
.probe=rtusb_probe,
.disconnect=rtusb_disconnect,
@@ -176,7 +153,6 @@ static int rt2870_resume(
return 0;
}
#endif // CONFIG_PM //
-#endif // LINUX_VERSION_CODE //
// Init driver module
@@ -800,14 +776,7 @@ static void _rtusb_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd)
MC_CardUsed[pAd->MC_RowID] = 0; // not clear MAC address
#endif // MULTIPLE_CARD_SUPPORT //
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */
- while(MOD_IN_USE > 0)
- {
- MOD_DEC_USE_COUNT;
- }
-#else
usb_put_dev(dev);
-#endif // LINUX_VERSION_CODE //
printk("rtusb_disconnect: pAd == NULL!\n");
return;
@@ -829,31 +798,17 @@ static void _rtusb_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd)
unregister_netdev (pAd->net_dev);
}
udelay(1);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */
-#else
flush_scheduled_work();
-#endif // LINUX_VERSION_CODE //
udelay(1);
// free net_device memory
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */
- kfree(net_dev);
-#else
free_netdev(net_dev);
-#endif // LINUX_VERSION_CODE //
// free adapter memory
RTMPFreeAdapter(pAd);
// release a use of the usb device structure
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */
- while(MOD_IN_USE > 0)
- {
- MOD_DEC_USE_COUNT;
- }
-#else
usb_put_dev(dev);
-#endif // LINUX_VERSION_CODE //
udelay(1);
DBGPRINT(RT_DEBUG_ERROR, (" RTUSB disconnect successfully\n"));
@@ -876,22 +831,6 @@ Return Value:
Note:
========================================================================
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */
-static void *rtusb_probe(struct usb_device *dev, UINT interface,
- const struct usb_device_id *id)
-{
- PRTMP_ADAPTER pAd;
- rt28xx_probe((void *)dev, (void *)id, interface, &pAd);
- return (void *)pAd;
-}
-
-//Disconnect function is called within exit routine
-static void rtusb_disconnect(struct usb_device *dev, void *ptr)
-{
- _rtusb_disconnect(dev, ((PRTMP_ADAPTER)ptr));
-}
-
-#else /* kernel 2.6 series */
static int rtusb_probe (struct usb_interface *intf,
const struct usb_device_id *id)
{
@@ -911,7 +850,6 @@ static void rtusb_disconnect(struct usb_interface *intf)
_rtusb_disconnect(dev, pAd);
}
-#endif // LINUX_VERSION_CODE //
/*
@@ -1030,12 +968,8 @@ Note:
BOOLEAN RT28XXChipsetCheck(
IN void *_dev_p)
{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */
- struct usb_device *dev_p = (struct usb_device *)_dev_p;
-#else
struct usb_interface *intf = (struct usb_interface *)_dev_p;
struct usb_device *dev_p = interface_to_usbdev(intf);
-#endif // LINUX_VERSION_CODE //
UINT32 i;
@@ -1082,19 +1016,11 @@ BOOLEAN RT28XXNetDevInit(
IN struct net_device *net_dev,
IN RTMP_ADAPTER *pAd)
{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */
- struct usb_device *dev_p = (struct usb_device *)_dev_p;
-#else
struct usb_interface *intf = (struct usb_interface *)_dev_p;
struct usb_device *dev_p = interface_to_usbdev(intf);
-#endif // LINUX_VERSION_CODE //
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */
- pAd->config = dev_p->config;
-#else
pAd->config = &dev_p->config->desc;
-#endif // LINUX_VERSION_CODE //
return TRUE;
}
@@ -1115,70 +1041,6 @@ Return Value:
Note:
========================================================================
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-BOOLEAN RT28XXProbePostConfig(
- IN void *_dev_p,
- IN RTMP_ADAPTER *pAd,
- IN INT32 interface)
-{
- struct usb_device *dev_p = (struct usb_device *)_dev_p;
- struct usb_interface *intf;
- struct usb_interface_descriptor *iface_desc;
- struct usb_endpoint_descriptor *endpoint;
- ULONG BulkOutIdx;
- UINT32 i;
-
-
- /* get the active interface descriptor */
- intf = &dev_p->actconfig->interface[interface];
- iface_desc = &intf->altsetting[0];
-
- /* get # of enpoints */
- pAd->NumberOfPipes = iface_desc->bNumEndpoints;
- DBGPRINT(RT_DEBUG_TRACE, ("NumEndpoints=%d\n", iface_desc->bNumEndpoints));
-
- /* Configure Pipes */
- endpoint = &iface_desc->endpoint[0];
- BulkOutIdx = 0;
-
- for(i=0; i<pAd->NumberOfPipes; i++)
- {
- if ((endpoint[i].bmAttributes == USB_ENDPOINT_XFER_BULK) &&
- ((endpoint[i].bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN))
- {
- pAd->BulkInEpAddr = endpoint[i].bEndpointAddress;
- pAd->BulkInMaxPacketSize = endpoint[i].wMaxPacketSize;
-
- DBGPRINT_RAW(RT_DEBUG_TRACE,
- ("BULK IN MaximumPacketSize = %d\n", pAd->BulkInMaxPacketSize));
- DBGPRINT_RAW(RT_DEBUG_TRACE,
- ("EP address = 0x%2x \n", endpoint[i].bEndpointAddress));
- }
- else if ((endpoint[i].bmAttributes == USB_ENDPOINT_XFER_BULK) &&
- ((endpoint[i].bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT))
- {
- // There are 6 bulk out EP. EP6 highest priority.
- // EP1-4 is EDCA. EP5 is HCCA.
- pAd->BulkOutEpAddr[BulkOutIdx++] = endpoint[i].bEndpointAddress;
- pAd->BulkOutMaxPacketSize = endpoint[i].wMaxPacketSize;
-
- DBGPRINT_RAW(RT_DEBUG_TRACE,
- ("BULK OUT MaximumPacketSize = %d\n", pAd->BulkOutMaxPacketSize));
- DBGPRINT_RAW(RT_DEBUG_TRACE,
- ("EP address = 0x%2x \n", endpoint[i].bEndpointAddress));
- }
- }
-
- if (!(pAd->BulkInEpAddr && pAd->BulkOutEpAddr[0]))
- {
- printk("Could not find both bulk-in and bulk-out endpoints\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-#else
BOOLEAN RT28XXProbePostConfig(
IN void *_dev_p,
IN RTMP_ADAPTER *pAd,
@@ -1241,7 +1103,6 @@ BOOLEAN RT28XXProbePostConfig(
return TRUE;
}
-#endif // LINUX_VERSION_CODE //
/*
diff --git a/drivers/staging/rt2870/common/rtusb_bulk.c b/drivers/staging/rt2870/common/rtusb_bulk.c
index c46d9166ccf..effd422f57b 100644
--- a/drivers/staging/rt2870/common/rtusb_bulk.c
+++ b/drivers/staging/rt2870/common/rtusb_bulk.c
@@ -52,11 +52,7 @@ void RTUSB_FILL_BULK_URB (struct urb *pUrb,
void *pContext)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
usb_fill_bulk_urb(pUrb, pUsb_Dev, bulkpipe, pTransferBuf, BufSize, (usb_complete_t)Complete, pContext);
-#else
- FILL_BULK_URB(pUrb, pUsb_Dev, bulkpipe, pTransferBuf, BufSize, Complete, pContext);
-#endif
}
@@ -95,14 +91,12 @@ VOID RTUSBInitTxDesc(
Func,
pTxContext);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
if (pTxContext->bAggregatible)
pUrb->transfer_dma = (pTxContext->data_dma + TX_BUFFER_NORMSIZE + 2);
else
pUrb->transfer_dma = pTxContext->data_dma;
pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
-#endif
}
@@ -135,10 +129,8 @@ VOID RTUSBInitHTTxDesc(
Func,
pTxContext);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
pUrb->transfer_dma = (pTxContext->data_dma + pTxContext->NextBulkOutPosition);
pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
-#endif
}
@@ -168,10 +160,8 @@ VOID RTUSBInitRxDesc(
(usb_complete_t)RTUSBBulkRxComplete,
(void *)pRxContext);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
pUrb->transfer_dma = pRxContext->data_dma + pAd->NextRxBulkInPosition;
pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
-#endif
}
@@ -956,11 +946,9 @@ VOID RTUSBBulkOutMLMEPacket(
// Init Tx context descriptor
RTUSBInitTxDesc(pAd, pMLMEContext, MGMTPIPEIDX, (usb_complete_t)RTUSBBulkOutMLMEPacketComplete);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
//For mgmt urb buffer, because we use sk_buff, so we need to notify the USB controller do dma mapping.
pUrb->transfer_dma = 0;
pUrb->transfer_flags &= (~URB_NO_TRANSFER_DMA_MAP);
-#endif
pUrb = pMLMEContext->pUrb;
if((ret = RTUSB_SUBMIT_URB(pUrb))!=0)
diff --git a/drivers/staging/rt2870/rt2870.h b/drivers/staging/rt2870/rt2870.h
index a69cf338e49..c05998b897c 100644
--- a/drivers/staging/rt2870/rt2870.h
+++ b/drivers/staging/rt2870/rt2870.h
@@ -33,7 +33,6 @@
/* rtmp_def.h */
//
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#define BULKAGGRE_ZISE 100
#define RT28XX_DRVDATA_SET(_a) usb_set_intfdata(_a, pAd);
#define RT28XX_PUT_DEVICE usb_put_dev
@@ -41,15 +40,6 @@
#define RTUSB_SUBMIT_URB(pUrb) usb_submit_urb(pUrb, GFP_ATOMIC)
#define RTUSB_URB_ALLOC_BUFFER(pUsb_Dev, BufSize, pDma_addr) usb_buffer_alloc(pUsb_Dev, BufSize, GFP_ATOMIC, pDma_addr)
#define RTUSB_URB_FREE_BUFFER(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) usb_buffer_free(pUsb_Dev, BufSize, pTransferBuf, Dma_addr)
-#else
-#define BULKAGGRE_ZISE 60
-#define RT28XX_DRVDATA_SET(_a)
-#define RT28XX_PUT_DEVICE(dev_p)
-#define RTUSB_ALLOC_URB(iso) usb_alloc_urb(iso)
-#define RTUSB_SUBMIT_URB(pUrb) usb_submit_urb(pUrb)
-#define RTUSB_URB_ALLOC_BUFFER(pUsb_Dev, BufSize, pDma_addr) kmalloc(BufSize, GFP_ATOMIC)
-#define RTUSB_URB_FREE_BUFFER(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) kfree(pTransferBuf)
-#endif
#define RXBULKAGGRE_ZISE 12
#define MAX_TXBULK_LIMIT (LOCAL_TXBUF_SIZE*(BULKAGGRE_ZISE-1))
@@ -551,23 +541,9 @@ typedef struct usb_ctrlrequest devctrlrequest;
#define UNLINK_TIMEOUT_MS 3
/* unlink urb */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
#define RTUSB_UNLINK_URB(pUrb) usb_kill_urb(pUrb)
-#else
-#define RTUSB_UNLINK_URB(pUrb) usb_unlink_urb(pUrb)
-#endif
// Prototypes of completion funuc.
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#define RTUSBBulkOutDataPacketComplete(purb, pt_regs) RTUSBBulkOutDataPacketComplete(purb)
-#define RTUSBBulkOutMLMEPacketComplete(pUrb, pt_regs) RTUSBBulkOutMLMEPacketComplete(pUrb)
-#define RTUSBBulkOutNullFrameComplete(pUrb, pt_regs) RTUSBBulkOutNullFrameComplete(pUrb)
-#define RTUSBBulkOutRTSFrameComplete(pUrb, pt_regs) RTUSBBulkOutRTSFrameComplete(pUrb)
-#define RTUSBBulkOutPsPollComplete(pUrb, pt_regs) RTUSBBulkOutPsPollComplete(pUrb)
-#define RTUSBBulkRxComplete(pUrb, pt_regs) RTUSBBulkRxComplete(pUrb)
-#endif
-
-
VOID RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs);
VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs);
VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs);
diff --git a/drivers/staging/rt2870/rt_ate.h b/drivers/staging/rt2870/rt_ate.h
index b618ce3599a..841d1518140 100644
--- a/drivers/staging/rt2870/rt_ate.h
+++ b/drivers/staging/rt2870/rt_ate.h
@@ -92,10 +92,6 @@ do{ int (*org_remote_display)(char *) = NULL; \
RTMP_IRQ_UNLOCK((pLock), IrqFlags);
// Prototypes of completion funuc.
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#define ATE_RTUSBBulkOutDataPacketComplete(purb, pt_regs) ATE_RTUSBBulkOutDataPacketComplete(purb)
-#endif
-
VOID ATE_RTUSBBulkOutDataPacketComplete(
IN purbb_t purb,
OUT struct pt_regs *pt_regs);
diff --git a/drivers/staging/rt2870/rt_linux.c b/drivers/staging/rt2870/rt_linux.c
index e38552c5ccb..a9c8d69e7f2 100644
--- a/drivers/staging/rt2870/rt_linux.c
+++ b/drivers/staging/rt2870/rt_linux.c
@@ -1046,35 +1046,14 @@ err_free_sk_buff:
void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify)
{
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
daemonize(pThreadName /*"%s",pAd->net_dev->name*/);
allow_signal(SIGTERM);
allow_signal(SIGKILL);
current->flags |= PF_NOFREEZE;
-#else
- unsigned long flags;
-
- daemonize();
- reparent_to_init();
- strcpy(current->comm, pThreadName);
-
- siginitsetinv(&current->blocked, sigmask(SIGTERM) | sigmask(SIGKILL));
- /* Allow interception of SIGKILL only
- * Don't allow other signals to interrupt the transmission */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
- spin_lock_irqsave(&current->sigmask_lock, flags);
- flush_signals(current);
- recalc_sigpending(current);
- spin_unlock_irqrestore(&current->sigmask_lock, flags);
-#endif
-#endif
-
- /* signal that we've started the thread */
+ /* signal that we've started the thread */
complete(pNotify);
-
}
void RTMP_IndicateMediaState(
diff --git a/drivers/staging/rt2870/rt_linux.h b/drivers/staging/rt2870/rt_linux.h
index 5a6ee6ad0e5..8870e4e8f2e 100644
--- a/drivers/staging/rt2870/rt_linux.h
+++ b/drivers/staging/rt2870/rt_linux.h
@@ -104,8 +104,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
#endif // CONFIG_STA_SUPPORT //
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-
#define RTMP_TIME_AFTER(a,b) \
(typecheck(unsigned long, (unsigned long)a) && \
typecheck(unsigned long, (unsigned long)b) && \
@@ -116,11 +114,7 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
typecheck(unsigned long, (unsigned long)b) && \
((long)(a) - (long)(b) >= 0))
#define RTMP_TIME_BEFORE(a,b) RTMP_TIME_AFTER_EQ(b,a)
-#else
-#define RTMP_TIME_AFTER(a,b) time_after(a, b)
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#define RT_MOD_INC_USE_COUNT() \
if (!try_module_get(THIS_MODULE)) \
{ \
@@ -129,10 +123,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
}
#define RT_MOD_DEC_USE_COUNT() module_put(THIS_MODULE);
-#else
-#define RT_MOD_INC_USE_COUNT() MOD_INC_USE_COUNT;
-#define RT_MOD_DEC_USE_COUNT() MOD_DEC_USE_COUNT;
-#endif
#define OS_HZ HZ
@@ -164,19 +154,11 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
#define NDIS_PACKET_TYPE_ALL_MULTICAST 3
#endif // CONFIG_STA_SUPPORT //
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
typedef struct pid * THREAD_PID;
#define GET_PID(_v) find_get_pid(_v)
#define GET_PID_NUMBER(_v) pid_nr(_v)
#define CHECK_PID_LEGALITY(_pid) if (pid_nr(_pid) >= 0)
#define KILL_THREAD_PID(_A, _B, _C) kill_pid(_A, _B, _C)
-#else
-typedef pid_t THREAD_PID;
-#define GET_PID(_v) _v
-#define GET_PID_NUMBER(_v) _v
-#define CHECK_PID_LEGALITY(_pid) if (_pid >= 0)
-#define KILL_THREAD_PID(_A, _B, _C) kill_proc(_A, _B, _C)
-#endif
struct os_lock {
spinlock_t lock;
diff --git a/drivers/staging/rt2870/rt_main_dev.c b/drivers/staging/rt2870/rt_main_dev.c
index 48ad41136d0..1abd46d53df 100644
--- a/drivers/staging/rt2870/rt_main_dev.c
+++ b/drivers/staging/rt2870/rt_main_dev.c
@@ -54,11 +54,7 @@ static UINT8 MC_CardMac[MAX_NUM_OF_MULTIPLE_CARD][6];
char *mac = ""; // default 00:00:00:00:00:00
char *hostname = "";
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12)
-MODULE_PARM (mac, "s");
-#else
module_param (mac, charp, 0);
-#endif
MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr");
@@ -80,13 +76,6 @@ INT __devinit rt28xx_probe(IN void *_dev_p, IN void *_dev_id_p,
static int rt28xx_init(IN struct net_device *net_dev);
INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev);
-#if LINUX_VERSION_CODE <= 0x20402 // Red Hat 7.1
-struct net_device *alloc_netdev(
- int sizeof_priv,
- const char *mask,
- void (*setup)(struct net_device *));
-#endif // LINUX_VERSION_CODE //
-
static void CfgInitHook(PRTMP_ADAPTER pAd);
//static BOOLEAN RT28XXAvailRANameAssign(IN CHAR *name_p);
@@ -350,11 +339,7 @@ int rt28xx_close(IN PNET_DEV dev)
}
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
msleep(UNLINK_TIMEOUT_MS); //Time in millisecond
-#else
- RTMPusecDelay(UNLINK_TIMEOUT_MS*1000); //Time in microsecond
-#endif
i++;
}
pAd->wait = NULL;
@@ -917,25 +902,11 @@ static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER p
#endif // MULTIPLE_CARD_SUPPORT //
sprintf(slot_name, "ra%d", i);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
- device = dev_get_by_name(dev_net(dev), slot_name);
-#else
- device = dev_get_by_name(dev->nd_net, slot_name);
-#endif
-#else
- device = dev_get_by_name(slot_name);
-#endif
- if (device != NULL) dev_put(device);
-#else
- for (device = dev_base; device != NULL; device = device->next)
- {
- if (strncmp(device->name, slot_name, 4) == 0)
- break;
- }
-#endif
- if(device == NULL)
+ device = dev_get_by_name(dev_net(dev), slot_name);
+ if (device != NULL)
+ dev_put(device);
+
+ if (device == NULL)
break;
}
@@ -1353,14 +1324,10 @@ INT __devinit rt28xx_probe(
INT status;
PVOID handle;
#ifdef RT2870
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */
- struct usb_device *dev_p = (struct usb_device *)_dev_p;
-#else
struct usb_interface *intf = (struct usb_interface *)_dev_p;
struct usb_device *dev_p = interface_to_usbdev(intf);
dev_p = usb_get_dev(dev_p);
-#endif // LINUX_VERSION_CODE //
#endif // RT2870 //
@@ -1372,22 +1339,11 @@ INT __devinit rt28xx_probe(
// if (RT28XXChipsetCheck(_dev_p) == FALSE)
// goto err_out;
-#if LINUX_VERSION_CODE <= 0x20402 // Red Hat 7.1
- net_dev = alloc_netdev(sizeof(PRTMP_ADAPTER), "eth%d", ether_setup);
-#else
net_dev = alloc_etherdev(sizeof(PRTMP_ADAPTER));
-#endif
if (net_dev == NULL)
{
printk("alloc_netdev failed\n");
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
- module_put(THIS_MODULE);
-#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
-#else
- MOD_DEC_USE_COUNT;
-#endif
goto err_out;
}
@@ -1395,19 +1351,13 @@ INT __devinit rt28xx_probe(
// if (rt_ieee80211_if_setup(net_dev) != NDIS_STATUS_SUCCESS)
// goto err_out;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
- SET_MODULE_OWNER(net_dev);
-#endif
-
netif_stop_queue(net_dev);
#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT
/* for supporting Network Manager */
/* Set the sysfs physical device reference for the network logical device
* if set prior to registration will cause a symlink during initialization.
*/
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
SET_NETDEV_DEV(net_dev, &(dev_p->dev));
-#endif
#endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
// Allocate RTMP_ADAPTER miniport adapter structure
@@ -1431,13 +1381,8 @@ INT __devinit rt28xx_probe(
// RT28XXAvailRANameAssign(net_dev->name);
// Post config
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- if (RT28XXProbePostConfig(_dev_p, pAd, argc) == FALSE)
- goto err_out_unmap;
-#else
if (RT28XXProbePostConfig(_dev_p, pAd, 0) == FALSE)
goto err_out_unmap;
-#endif // LINUX_VERSION_CODE //
#ifdef CONFIG_STA_SUPPORT
pAd->OpMode = OPMODE_STA;
@@ -1482,20 +1427,12 @@ err_out_unmap:
RT28XX_UNMAP();
err_out_free_netdev:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
- free_netdev(net_dev);
-#else
- kfree(net_dev);
-#endif
+ free_netdev(net_dev);
err_out:
RT28XX_PUT_DEVICE(dev_p);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- return (LONG)NULL;
-#else
- return -ENODEV; /* probe fail */
-#endif // LINUX_VERSION_CODE //
+ return -ENODEV; /* probe fail */
} /* End of rt28xx_probe */
@@ -1624,41 +1561,6 @@ INT rt28xx_send_packets(
-#if LINUX_VERSION_CODE <= 0x20402 // Red Hat 7.1
-//static struct net_device *alloc_netdev(int sizeof_priv, const char *mask, void (*setup)(struct net_device *)) //sample
-struct net_device *alloc_netdev(
- int sizeof_priv,
- const char *mask,
- void (*setup)(struct net_device *))
-{
- struct net_device *dev;
- INT alloc_size;
-
-
- /* ensure 32-byte alignment of the private area */
- alloc_size = sizeof (*dev) + sizeof_priv + 31;
-
- dev = (struct net_device *) kmalloc(alloc_size, GFP_KERNEL);
- if (dev == NULL)
- {
- DBGPRINT(RT_DEBUG_ERROR,
- ("alloc_netdev: Unable to allocate device memory.\n"));
- return NULL;
- }
-
- memset(dev, 0, alloc_size);
-
- if (sizeof_priv)
- dev->priv = (void *) (((long)(dev + 1) + 31) & ~31);
-
- setup(dev);
- strcpy(dev->name, mask);
-
- return dev;
-}
-#endif // LINUX_VERSION_CODE //
-
-
void CfgInitHook(PRTMP_ADAPTER pAd)
{
pAd->bBroadComHT = TRUE;
diff --git a/drivers/staging/rt2870/sta_ioctl.c b/drivers/staging/rt2870/sta_ioctl.c
index 04cf5e5732c..be63e9b48cf 100644
--- a/drivers/staging/rt2870/sta_ioctl.c
+++ b/drivers/staging/rt2870/sta_ioctl.c
@@ -49,15 +49,9 @@ extern ULONG RTDebugLevel;
#define GROUP_KEY_NO 4
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
#define IWE_STREAM_ADD_EVENT(_A, _B, _C, _D, _E) iwe_stream_add_event(_A, _B, _C, _D, _E)
#define IWE_STREAM_ADD_POINT(_A, _B, _C, _D, _E) iwe_stream_add_point(_A, _B, _C, _D, _E)
#define IWE_STREAM_ADD_VALUE(_A, _B, _C, _D, _E, _F) iwe_stream_add_value(_A, _B, _C, _D, _E, _F)
-#else
-#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)
-#define IWE_STREAM_ADD_VALUE(_A, _B, _C, _D, _E, _F) iwe_stream_add_value(_B, _C, _D, _E, _F)
-#endif
extern UCHAR CipherWpa2Template[];
extern UCHAR CipherWpaPskTkip[];
@@ -679,11 +673,9 @@ int rt_ioctl_siwmode(struct net_device *dev,
case IW_MODE_INFRA:
Set_NetworkType_Proc(pAdapter, "Infra");
break;
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20))
case IW_MODE_MONITOR:
Set_NetworkType_Proc(pAdapter, "Monitor");
break;
-#endif
default:
DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_siwmode::SIOCSIWMODE (unknown %d)\n", *mode));
return -EINVAL;
@@ -724,12 +716,10 @@ int rt_ioctl_giwmode(struct net_device *dev,
*mode = IW_MODE_ADHOC;
else if (INFRA_ON(pAdapter))
*mode = IW_MODE_INFRA;
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20))
else if (MONITOR_ON(pAdapter))
{
*mode = IW_MODE_MONITOR;
}
-#endif
else
*mode = IW_MODE_AUTO;