Skip to content

Commit

Permalink
Staging: rt2860: remove kernel version compatibility wrappers
Browse files Browse the repository at this point in the history
The driver is in mainline now so there's no point in keeping the
kernel version compatibility wrappers around.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Pekka Enberg authored and Greg Kroah-Hartman committed Apr 3, 2009
1 parent 7034ca4 commit 7f20a18
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 208 deletions.
43 changes: 3 additions & 40 deletions drivers/staging/rt2860/2860_main_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@ void init_thread_task(PRTMP_ADAPTER pAd);
static void __exit rt2860_cleanup_module(void);
static int __init rt2860_init_module(void);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#ifdef CONFIG_PM
static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state);
static int rt2860_resume(struct pci_dev *pci_dev);
#endif // CONFIG_PM //
#endif


//
Expand Down Expand Up @@ -128,22 +126,15 @@ static struct pci_driver rt2860_driver =
name: "rt2860",
id_table: rt2860_pci_tbl,
probe: rt2860_init_one,
#if LINUX_VERSION_CODE >= 0x20412
remove: __devexit_p(rt2860_remove_one),
#else
remove: __devexit(rt2860_remove_one),
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#ifdef CONFIG_PM
suspend: rt2860_suspend,
resume: rt2860_resume,
#endif
#endif
};


#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#ifdef CONFIG_PM

VOID RT2860RejectPendingPackets(
Expand Down Expand Up @@ -284,16 +275,11 @@ static int rt2860_resume(
return 0;
}
#endif // CONFIG_PM //
#endif


static INT __init rt2860_init_module(VOID)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
return pci_register_driver(&rt2860_driver);
#else
return pci_module_init(&rt2860_driver);
#endif
}


Expand Down Expand Up @@ -374,11 +360,7 @@ static VOID __devexit rt2860_remove_one(
}

// Free pre-allocated net_device memory
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
free_netdev(net_dev);
#else
kfree(net_dev);
#endif
}

//
Expand Down Expand Up @@ -758,11 +740,7 @@ static void ac0_dma_done_tasklet(unsigned long data)
int print_int_count;

IRQ_HANDLE_TYPE
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
rt2860_interrupt(int irq, void *dev_instance)
#else
rt2860_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
#endif
{
struct net_device *net_dev = (struct net_device *) dev_instance;
PRTMP_ADAPTER pAd = net_dev->ml_priv;
Expand Down Expand Up @@ -809,11 +787,7 @@ rt2860_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) ||
RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
return IRQ_HANDLED;
#else
return;
#endif
return IRQ_HANDLED;
}

//
Expand All @@ -832,11 +806,7 @@ rt2860_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
if (IntSource.word == 0xffffffff)
{
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
return IRQ_HANDLED;
#else
return;
#endif
return IRQ_HANDLED;
}

if (IntSource.word & TxCoherent)
Expand Down Expand Up @@ -970,10 +940,7 @@ rt2860_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
}
#endif // CONFIG_STA_SUPPORT //

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
return IRQ_HANDLED;
#endif

}

/*
Expand Down Expand Up @@ -1026,11 +993,7 @@ BOOLEAN RT28XXNetDevInit(
ULONG csr_addr;


#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
print_name = pci_dev ? pci_name(pci_dev) : "rt2860";
#else
print_name = pci_dev ? pci_dev->slot_name : "rt2860";
#endif // LINUX_VERSION_CODE //
print_name = pci_dev ? pci_name(pci_dev) : "rt2860";

net_dev->base_addr = 0;
net_dev->irq = 0;
Expand Down
18 changes: 0 additions & 18 deletions drivers/staging/rt2860/rt2860.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,10 @@
Status = NDIS_STATUS_SUCCESS;

/* function declarations */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#define IRQ_HANDLE_TYPE irqreturn_t
#else
#define IRQ_HANDLE_TYPE void
#endif

IRQ_HANDLE_TYPE
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
rt2860_interrupt(int irq, void *dev_instance);
#else
rt2860_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
#endif

/* ----------------- Frimware Related MACRO ----------------- */
#define RT28XX_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \
Expand Down Expand Up @@ -237,9 +229,7 @@ rt2860_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
#define RTMP_MSI_DISABLE(_pAd)
#endif // PCI_MSI_SUPPORT //

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
#define SA_SHIRQ IRQF_SHARED
#endif

#define RT28XX_IRQ_REQUEST(net_dev) \
{ PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)((net_dev)->ml_priv); \
Expand All @@ -251,20 +241,12 @@ rt2860_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
printk("RT2860: request_irq ERROR(%d)\n", retval); \
return retval; } }

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#define RT28XX_IRQ_RELEASE(net_dev) \
{ PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)((net_dev)->ml_priv); \
POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \
synchronize_irq(_pObj->pci_dev->irq); \
free_irq(_pObj->pci_dev->irq, (net_dev)); \
RTMP_MSI_DISABLE(_pAd); }
#else
#define RT28XX_IRQ_RELEASE(net_dev) \
{ PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)((net_dev)->priv); \
POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \
free_irq(_pObj->pci_dev->irq, (net_dev)); \
RTMP_MSI_DISABLE(_pAd); }
#endif

#define RT28XX_IRQ_INIT(pAd) \
{ pAd->int_enable_reg = ((DELAYINTMASK) | \
Expand Down
23 changes: 1 addition & 22 deletions drivers/staging/rt2860/rt_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,35 +1005,14 @@ void send_monitor_packets(

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(
Expand Down
19 changes: 0 additions & 19 deletions drivers/staging/rt2860/rt_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
#endif // PCI_DEVICE //
#endif // RT2860 //

#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) && \
Expand All @@ -122,11 +120,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)) \
{ \
Expand All @@ -135,10 +129,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

Expand Down Expand Up @@ -170,21 +160,12 @@ 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 THREAD_PID_INIT_VALUE NULL
#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 THREAD_PID_INIT_VALUE -1
#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;
Expand Down
Loading

0 comments on commit 7f20a18

Please sign in to comment.