Commit 8179af30 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Greg Kroah-Hartman

Staging: rt2870: remove kernel version compatibility wrappers

Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ce6ee223
...@@ -77,26 +77,6 @@ MODULE_DEVICE_TABLE(usb, rtusb_usb_id); ...@@ -77,26 +77,6 @@ MODULE_DEVICE_TABLE(usb, rtusb_usb_id);
#endif #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 #ifdef CONFIG_PM
static int rt2870_suspend(struct usb_interface *intf, pm_message_t state); static int rt2870_suspend(struct usb_interface *intf, pm_message_t state);
static int rt2870_resume(struct usb_interface *intf); static int rt2870_resume(struct usb_interface *intf);
...@@ -112,9 +92,6 @@ static int rtusb_probe (struct usb_interface *intf, ...@@ -112,9 +92,6 @@ static int rtusb_probe (struct usb_interface *intf,
static void rtusb_disconnect(struct usb_interface *intf); static void rtusb_disconnect(struct usb_interface *intf);
struct usb_driver rtusb_driver = { struct usb_driver rtusb_driver = {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
#endif
.name="rt2870", .name="rt2870",
.probe=rtusb_probe, .probe=rtusb_probe,
.disconnect=rtusb_disconnect, .disconnect=rtusb_disconnect,
...@@ -176,7 +153,6 @@ static int rt2870_resume( ...@@ -176,7 +153,6 @@ static int rt2870_resume(
return 0; return 0;
} }
#endif // CONFIG_PM // #endif // CONFIG_PM //
#endif // LINUX_VERSION_CODE //
// Init driver module // Init driver module
...@@ -800,14 +776,7 @@ static void _rtusb_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) ...@@ -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 MC_CardUsed[pAd->MC_RowID] = 0; // not clear MAC address
#endif // MULTIPLE_CARD_SUPPORT // #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); usb_put_dev(dev);
#endif // LINUX_VERSION_CODE //
printk("rtusb_disconnect: pAd == NULL!\n"); printk("rtusb_disconnect: pAd == NULL!\n");
return; return;
...@@ -829,31 +798,17 @@ static void _rtusb_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) ...@@ -829,31 +798,17 @@ static void _rtusb_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd)
unregister_netdev (pAd->net_dev); unregister_netdev (pAd->net_dev);
} }
udelay(1); udelay(1);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */
#else
flush_scheduled_work(); flush_scheduled_work();
#endif // LINUX_VERSION_CODE //
udelay(1); udelay(1);
// free net_device memory // 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); free_netdev(net_dev);
#endif // LINUX_VERSION_CODE //
// free adapter memory // free adapter memory
RTMPFreeAdapter(pAd); RTMPFreeAdapter(pAd);
// release a use of the usb device structure // 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); usb_put_dev(dev);
#endif // LINUX_VERSION_CODE //
udelay(1); udelay(1);
DBGPRINT(RT_DEBUG_ERROR, (" RTUSB disconnect successfully\n")); DBGPRINT(RT_DEBUG_ERROR, (" RTUSB disconnect successfully\n"));
...@@ -876,22 +831,6 @@ Return Value: ...@@ -876,22 +831,6 @@ Return Value:
Note: 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, static int rtusb_probe (struct usb_interface *intf,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
...@@ -911,7 +850,6 @@ static void rtusb_disconnect(struct usb_interface *intf) ...@@ -911,7 +850,6 @@ static void rtusb_disconnect(struct usb_interface *intf)
_rtusb_disconnect(dev, pAd); _rtusb_disconnect(dev, pAd);
} }
#endif // LINUX_VERSION_CODE //
/* /*
...@@ -1030,12 +968,8 @@ Return Value: ...@@ -1030,12 +968,8 @@ Return Value:
BOOLEAN RT28XXChipsetCheck( BOOLEAN RT28XXChipsetCheck(
IN void *_dev_p) 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_interface *intf = (struct usb_interface *)_dev_p;
struct usb_device *dev_p = interface_to_usbdev(intf); struct usb_device *dev_p = interface_to_usbdev(intf);
#endif // LINUX_VERSION_CODE //
UINT32 i; UINT32 i;
...@@ -1082,19 +1016,11 @@ BOOLEAN RT28XXNetDevInit( ...@@ -1082,19 +1016,11 @@ BOOLEAN RT28XXNetDevInit(
IN struct net_device *net_dev, IN struct net_device *net_dev,
IN RTMP_ADAPTER *pAd) 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_interface *intf = (struct usb_interface *)_dev_p;
struct usb_device *dev_p = interface_to_usbdev(intf); 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; pAd->config = &dev_p->config->desc;
#endif // LINUX_VERSION_CODE //
return TRUE; return TRUE;
} }
...@@ -1115,70 +1041,6 @@ Return Value: ...@@ -1115,70 +1041,6 @@ Return Value:
Note: 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( BOOLEAN RT28XXProbePostConfig(
IN void *_dev_p, IN void *_dev_p,
IN RTMP_ADAPTER *pAd, IN RTMP_ADAPTER *pAd,
...@@ -1241,7 +1103,6 @@ BOOLEAN RT28XXProbePostConfig( ...@@ -1241,7 +1103,6 @@ BOOLEAN RT28XXProbePostConfig(
return TRUE; return TRUE;
} }
#endif // LINUX_VERSION_CODE //
/* /*
......
...@@ -52,11 +52,7 @@ void RTUSB_FILL_BULK_URB (struct urb *pUrb, ...@@ -52,11 +52,7 @@ void RTUSB_FILL_BULK_URB (struct urb *pUrb,
void *pContext) 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); 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( ...@@ -95,14 +91,12 @@ VOID RTUSBInitTxDesc(
Func, Func,
pTxContext); pTxContext);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
if (pTxContext->bAggregatible) if (pTxContext->bAggregatible)
pUrb->transfer_dma = (pTxContext->data_dma + TX_BUFFER_NORMSIZE + 2); pUrb->transfer_dma = (pTxContext->data_dma + TX_BUFFER_NORMSIZE + 2);
else else
pUrb->transfer_dma = pTxContext->data_dma; pUrb->transfer_dma = pTxContext->data_dma;
pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
#endif
} }
...@@ -135,10 +129,8 @@ VOID RTUSBInitHTTxDesc( ...@@ -135,10 +129,8 @@ VOID RTUSBInitHTTxDesc(
Func, Func,
pTxContext); pTxContext);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
pUrb->transfer_dma = (pTxContext->data_dma + pTxContext->NextBulkOutPosition); pUrb->transfer_dma = (pTxContext->data_dma + pTxContext->NextBulkOutPosition);
pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
#endif
} }
...@@ -168,10 +160,8 @@ VOID RTUSBInitRxDesc( ...@@ -168,10 +160,8 @@ VOID RTUSBInitRxDesc(
(usb_complete_t)RTUSBBulkRxComplete, (usb_complete_t)RTUSBBulkRxComplete,
(void *)pRxContext); (void *)pRxContext);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
pUrb->transfer_dma = pRxContext->data_dma + pAd->NextRxBulkInPosition; pUrb->transfer_dma = pRxContext->data_dma + pAd->NextRxBulkInPosition;
pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
#endif
} }
...@@ -956,11 +946,9 @@ VOID RTUSBBulkOutMLMEPacket( ...@@ -956,11 +946,9 @@ VOID RTUSBBulkOutMLMEPacket(
// Init Tx context descriptor // Init Tx context descriptor
RTUSBInitTxDesc(pAd, pMLMEContext, MGMTPIPEIDX, (usb_complete_t)RTUSBBulkOutMLMEPacketComplete); 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. //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_dma = 0;
pUrb->transfer_flags &= (~URB_NO_TRANSFER_DMA_MAP); pUrb->transfer_flags &= (~URB_NO_TRANSFER_DMA_MAP);
#endif
pUrb = pMLMEContext->pUrb; pUrb = pMLMEContext->pUrb;
if((ret = RTUSB_SUBMIT_URB(pUrb))!=0) if((ret = RTUSB_SUBMIT_URB(pUrb))!=0)
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
/* rtmp_def.h */ /* rtmp_def.h */
// //
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#define BULKAGGRE_ZISE 100 #define BULKAGGRE_ZISE 100
#define RT28XX_DRVDATA_SET(_a) usb_set_intfdata(_a, pAd); #define RT28XX_DRVDATA_SET(_a) usb_set_intfdata(_a, pAd);
#define RT28XX_PUT_DEVICE usb_put_dev #define RT28XX_PUT_DEVICE usb_put_dev
...@@ -41,15 +40,6 @@ ...@@ -41,15 +40,6 @@
#define RTUSB_SUBMIT_URB(pUrb) usb_submit_urb(pUrb, GFP_ATOMIC) #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_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) #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 RXBULKAGGRE_ZISE 12
#define MAX_TXBULK_LIMIT (LOCAL_TXBUF_SIZE*(BULKAGGRE_ZISE-1)) #define MAX_TXBULK_LIMIT (LOCAL_TXBUF_SIZE*(BULKAGGRE_ZISE-1))
...@@ -551,23 +541,9 @@ typedef struct usb_ctrlrequest devctrlrequest; ...@@ -551,23 +541,9 @@ typedef struct usb_ctrlrequest devctrlrequest;
#define UNLINK_TIMEOUT_MS 3 #define UNLINK_TIMEOUT_MS 3
/* unlink urb */ /* unlink urb */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
#define RTUSB_UNLINK_URB(pUrb) usb_kill_urb(pUrb) #define RTUSB_UNLINK_URB(pUrb) usb_kill_urb(pUrb)
#else
#define RTUSB_UNLINK_URB(pUrb) usb_unlink_urb(pUrb)
#endif
// Prototypes of completion funuc. // 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 RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs);
VOID RTUSBBulkOutMLMEPacketComplete(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); VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs);
......
...@@ -92,10 +92,6 @@ do{ int (*org_remote_display)(char *) = NULL; \ ...@@ -92,10 +92,6 @@ do{ int (*org_remote_display)(char *) = NULL; \
RTMP_IRQ_UNLOCK((pLock), IrqFlags); RTMP_IRQ_UNLOCK((pLock), IrqFlags);
// Prototypes of completion funuc. // 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( VOID ATE_RTUSBBulkOutDataPacketComplete(
IN purbb_t purb, IN purbb_t purb,
OUT struct pt_regs *pt_regs); OUT struct pt_regs *pt_regs);
......
...@@ -1046,35 +1046,14 @@ void send_monitor_packets( ...@@ -1046,35 +1046,14 @@ void send_monitor_packets(
void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify) 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*/); daemonize(pThreadName /*"%s",pAd->net_dev->name*/);
allow_signal(SIGTERM); allow_signal(SIGTERM);
allow_signal(SIGKILL); allow_signal(SIGKILL);
current->flags |= PF_NOFREEZE; 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 /* signal that we've started the thread */
* 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 */
complete(pNotify); complete(pNotify);
} }
void RTMP_IndicateMediaState( void RTMP_IndicateMediaState(
......
...@@ -104,8 +104,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_ ...@@ -104,8 +104,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
#endif // CONFIG_STA_SUPPORT // #endif // CONFIG_STA_SUPPORT //
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#define RTMP_TIME_AFTER(a,b) \ #define RTMP_TIME_AFTER(a,b) \
(typecheck(unsigned long, (unsigned long)a) && \ (typecheck(unsigned long, (unsigned long)a) && \
typecheck(unsigned long, (unsigned long)b) && \ typecheck(unsigned long, (unsigned long)b) && \
...@@ -116,11 +114,7 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_ ...@@ -116,11 +114,7 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
typecheck(unsigned long, (unsigned long)b) && \ typecheck(unsigned long, (unsigned long)b) && \
((long)(a) - (long)(b) >= 0)) ((long)(a) - (long)(b) >= 0))
#define RTMP_TIME_BEFORE(a,b) RTMP_TIME_AFTER_EQ(b,a) #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() \ #define RT_MOD_INC_USE_COUNT() \
if (!try_module_get(THIS_MODULE)) \ if (!try_module_get(THIS_MODULE)) \
{ \ { \
...@@ -129,10 +123,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_ ...@@ -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); #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 #define OS_HZ HZ
...@@ -164,19 +154,11 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_ ...@@ -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 #define NDIS_PACKET_TYPE_ALL_MULTICAST 3
#endif // CONFIG_STA_SUPPORT // #endif // CONFIG_STA_SUPPORT //
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
typedef struct pid * THREAD_PID; typedef struct pid * THREAD_PID;
#define GET_PID(_v) find_get_pid(_v) #define GET_PID(_v) find_get_pid(_v)
#define GET_PID_NUMBER(_v) pid_nr(_v) #define GET_PID_NUMBER(_v) pid_nr(_v)
#define CHECK_PID_LEGALITY(_pid) if (pid_nr(_pid) >= 0) #define CHECK_PID_LEGALITY(_pid) if (pid_nr(_pid) >= 0)
#define KILL_THREAD_PID(_A, _B, _C) kill_pid(_A, _B, _C) #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 { struct os_lock {
spinlock_t lock; spinlock_t lock;
......
...@@ -54,11 +54,7 @@ static UINT8 MC_CardMac[MAX_NUM_OF_MULTIPLE_CARD][6]; ...@@ -54,11 +54,7 @@ static UINT8 MC_CardMac[MAX_NUM_OF_MULTIPLE_CARD][6];
char *mac = ""; // default 00:00:00:00:00:00 char *mac = ""; // default 00:00:00:00:00:00
char *hostname = ""; char *hostname = "";
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12)
MODULE_PARM (mac, "s");
#else
module_param (mac, charp, 0); module_param (mac, charp, 0);
#endif
MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr"); 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, ...@@ -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); 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); 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 void CfgInitHook(PRTMP_ADAPTER pAd);
//static BOOLEAN RT28XXAvailRANameAssign(IN CHAR *name_p); //static BOOLEAN RT28XXAvailRANameAssign(IN CHAR *name_p);
...@@ -350,11 +339,7 @@ int rt28xx_close(IN PNET_DEV dev) ...@@ -350,11 +339,7 @@ int rt28xx_close(IN PNET_DEV dev)
} }
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
msleep(UNLINK_TIMEOUT_MS); //Time in millisecond msleep(UNLINK_TIMEOUT_MS); //Time in millisecond
#else
RTMPusecDelay(UNLINK_TIMEOUT_MS*1000); //Time in microsecond
#endif
i++; i++;
} }
pAd->wait = NULL; pAd->wait = NULL;
...@@ -917,25 +902,11 @@ static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER p ...@@ -917,25 +902,11 @@ static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER p
#endif // MULTIPLE_CARD_SUPPORT // #endif // MULTIPLE_CARD_SUPPORT //
sprintf(slot_name, "ra%d", i); sprintf(slot_name, "ra%d", i);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) device = dev_get_by_name(dev_net(dev), slot_name);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) if (device != NULL)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) dev_put(device);
device = dev_get_by_name(dev_net(dev), slot_name);
#else if (device == NULL)
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)
break; break;
} }
...@@ -1353,14 +1324,10 @@ INT __devinit rt28xx_probe( ...@@ -1353,14 +1324,10 @@ INT __devinit rt28xx_probe(
INT status; INT status;
PVOID handle; PVOID handle;
#ifdef RT2870 #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_interface *intf = (struct usb_interface *)_dev_p;
struct usb_device *dev_p = interface_to_usbdev(intf); struct usb_device *dev_p = interface_to_usbdev(intf);
dev_p = usb_get_dev(dev_p); dev_p = usb_get_dev(dev_p);
#endif // LINUX_VERSION_CODE //
#endif // RT2870 // #endif // RT2870 //
...@@ -1372,22 +1339,11 @@ INT __devinit rt28xx_probe( ...@@ -1372,22 +1339,11 @@ INT __devinit rt28xx_probe(
// if (RT28XXChipsetCheck(_dev_p) == FALSE) // if (RT28XXChipsetCheck(_dev_p) == FALSE)
// goto err_out; // 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)); net_dev = alloc_etherdev(sizeof(PRTMP_ADAPTER));
#endif
if (net_dev == NULL) if (net_dev == NULL)
{ {
printk("alloc_netdev failed\n"); 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; goto err_out;
} }
...@@ -1395,19 +1351,13 @@ INT __devinit rt28xx_probe( ...@@ -1395,19 +1351,13 @@ INT __devinit rt28xx_probe(
// if (rt_ieee80211_if_setup(net_dev) != NDIS_STATUS_SUCCESS) // if (rt_ieee80211_if_setup(net_dev) != NDIS_STATUS_SUCCESS)
// goto err_out; // goto err_out;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
SET_MODULE_OWNER(net_dev);
#endif
netif_stop_queue(net_dev); netif_stop_queue(net_dev);
#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT #ifdef NATIVE_WPA_SUPPLICANT_SUPPORT
/* for supporting Network Manager */ /* for supporting Network Manager */
/* Set the sysfs physical device reference for the network logical device /* Set the sysfs physical device reference for the network logical device
* if set prior to registration will cause a symlink during initialization. * 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)); SET_NETDEV_DEV(net_dev, &(dev_p->dev));
#endif
#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
// Allocate RTMP_ADAPTER miniport adapter structure // Allocate RTMP_ADAPTER miniport adapter structure
...@@ -1431,13 +1381,8 @@ INT __devinit rt28xx_probe( ...@@ -1431,13 +1381,8 @@ INT __devinit rt28xx_probe(
// RT28XXAvailRANameAssign(net_dev->name); // RT28XXAvailRANameAssign(net_dev->name);
// Post config // 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) if (RT28XXProbePostConfig(_dev_p, pAd, 0) == FALSE)
goto err_out_unmap; goto err_out_unmap;
#endif // LINUX_VERSION_CODE //
#ifdef CONFIG_STA_SUPPORT #ifdef CONFIG_STA_SUPPORT
pAd->OpMode = OPMODE_STA; pAd->OpMode = OPMODE_STA;
...@@ -1482,20 +1427,12 @@ INT __devinit rt28xx_probe( ...@@ -1482,20 +1427,12 @@ INT __devinit rt28xx_probe(
RT28XX_UNMAP(); RT28XX_UNMAP();
err_out_free_netdev: err_out_free_netdev:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) free_netdev(net_dev);
free_netdev(net_dev);
#else
kfree(net_dev);
#endif
err_out: err_out:
RT28XX_PUT_DEVICE(dev_p); RT28XX_PUT_DEVICE(dev_p);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) return -ENODEV; /* probe fail */
return (LONG)NULL;
#else
return -ENODEV; /* probe fail */
#endif // LINUX_VERSION_CODE //
} /* End of rt28xx_probe */ } /* End of rt28xx_probe */
...@@ -1624,41 +1561,6 @@ INT rt28xx_send_packets( ...@@ -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) void CfgInitHook(PRTMP_ADAPTER pAd)
{ {
pAd->bBroadComHT = TRUE; pAd->bBroadComHT = TRUE;
......
...@@ -49,15 +49,9 @@ extern ULONG RTDebugLevel; ...@@ -49,15 +49,9 @@ extern ULONG RTDebugLevel;
#define GROUP_KEY_NO 4 #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_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_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) #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 CipherWpa2Template[];
extern UCHAR CipherWpaPskTkip[]; extern UCHAR CipherWpaPskTkip[];
...@@ -679,11 +673,9 @@ int rt_ioctl_siwmode(struct net_device *dev, ...@@ -679,11 +673,9 @@ int rt_ioctl_siwmode(struct net_device *dev,
case IW_MODE_INFRA: case IW_MODE_INFRA:
Set_NetworkType_Proc(pAdapter, "Infra"); Set_NetworkType_Proc(pAdapter, "Infra");
break; break;
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20))
case IW_MODE_MONITOR: case IW_MODE_MONITOR:
Set_NetworkType_Proc(pAdapter, "Monitor"); Set_NetworkType_Proc(pAdapter, "Monitor");
break; break;
#endif
default: default:
DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_siwmode::SIOCSIWMODE (unknown %d)\n", *mode)); DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_siwmode::SIOCSIWMODE (unknown %d)\n", *mode));
return -EINVAL; return -EINVAL;
...@@ -724,12 +716,10 @@ int rt_ioctl_giwmode(struct net_device *dev, ...@@ -724,12 +716,10 @@ int rt_ioctl_giwmode(struct net_device *dev,
*mode = IW_MODE_ADHOC; *mode = IW_MODE_ADHOC;
else if (INFRA_ON(pAdapter)) else if (INFRA_ON(pAdapter))
*mode = IW_MODE_INFRA; *mode = IW_MODE_INFRA;
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20))
else if (MONITOR_ON(pAdapter)) else if (MONITOR_ON(pAdapter))
{ {
*mode = IW_MODE_MONITOR; *mode = IW_MODE_MONITOR;
} }
#endif
else else
*mode = IW_MODE_AUTO; *mode = IW_MODE_AUTO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment