From b74c746120376822fb9b5a28ab419cd4e07ac44f Mon Sep 17 00:00:00 2001 From: Lidza Louina Date: Mon, 9 Sep 2013 15:01:26 -0400 Subject: [PATCH] staging: dgnc: removes LINUX_VERSION_CODE conditionals This patch removes the conditionals that make sure the driver supports various versions of the kernel. They aren't needed. Signed-off-by: Lidza Louina Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 12 -------- drivers/staging/dgnc/dgnc_kcompat.h | 24 --------------- drivers/staging/dgnc/dgnc_tty.c | 61 ++----------------------------------- 3 files changed, 2 insertions(+), 95 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index 1318a70..3c547590 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -31,15 +31,10 @@ #include -#include #include #include #include - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) #include -#endif - #include "dgnc_driver.h" #include "dgnc_pci.h" #include "dpacompat.h" @@ -291,16 +286,9 @@ static int dgnc_start(void) dgnc_Major = rc; dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) - device_create_drvdata(dgnc_class, NULL, - MKDEV(dgnc_Major, 0), - NULL, "dgnc_mgmt"); -#else device_create(dgnc_class, NULL, MKDEV(dgnc_Major, 0), NULL, "dgnc_mgmt"); -#endif - dgnc_Major_Control_Registered = TRUE; } diff --git a/drivers/staging/dgnc/dgnc_kcompat.h b/drivers/staging/dgnc/dgnc_kcompat.h index 00f589a..ed85152 100644 --- a/drivers/staging/dgnc/dgnc_kcompat.h +++ b/drivers/staging/dgnc/dgnc_kcompat.h @@ -28,8 +28,6 @@ #ifndef __DGNC_KCOMPAT_H #define __DGNC_KCOMPAT_H -#include - # ifndef KERNEL_VERSION # define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) # endif @@ -68,26 +66,4 @@ module_param(VAR, long, PERM); \ MODULE_PARM_DESC(VAR, DESC); - - - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - - - -/* NOTHING YET */ - - - -# else - - - -# error "this driver does not support anything below the 2.6.27 kernel series." - - - -# endif - #endif /* ! __DGNC_KCOMPAT_H */ diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 6906e98..1350d62 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -38,7 +38,6 @@ */ #include -#include #include /* For jiffies, task states */ #include /* For tasklet and interrupt structs/defines */ #include @@ -60,11 +59,9 @@ #include "dpacompat.h" #include "dgnc_sysfs.h" -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) #define init_MUTEX(sem) sema_init(sem, 1) #define DECLARE_MUTEX(name) \ struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) -#endif /* * internal variables @@ -126,13 +123,8 @@ static void dgnc_tty_flush_buffer(struct tty_struct *tty); static void dgnc_tty_hangup(struct tty_struct *tty); static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, unsigned int __user *value); static int dgnc_get_modem_info(struct channel_t *ch, unsigned int __user *value); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) static int dgnc_tty_tiocmget(struct tty_struct *tty); static int dgnc_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); -#else -static int dgnc_tty_tiocmget(struct tty_struct *tty, struct file *file); -static int dgnc_tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); -#endif static int dgnc_tty_send_break(struct tty_struct *tty, int msec); static void dgnc_tty_wait_until_sent(struct tty_struct *tty, int timeout); static int dgnc_tty_write(struct tty_struct *tty, const unsigned char *buf, int count); @@ -234,21 +226,11 @@ int dgnc_tty_register(struct dgnc_board *brd) if (!brd->SerialDriver.ttys) return -ENOMEM; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) - brd->SerialDriver.refcount = brd->TtyRefCnt; -#else kref_init(&brd->SerialDriver.kref); -#endif - brd->SerialDriver.termios = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL); if (!brd->SerialDriver.termios) return -ENOMEM; -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - brd->SerialDriver.termios_locked = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL); - if (!brd->SerialDriver.termios_locked) - return -ENOMEM; -#endif /* * Entry points for driver. Called by the kernel from * tty_io.c and n_tty.c. @@ -292,23 +274,11 @@ int dgnc_tty_register(struct dgnc_board *brd) brd->PrintDriver.ttys = kzalloc(brd->maxports * sizeof(struct tty_struct *), GFP_KERNEL); if (!brd->PrintDriver.ttys) return -ENOMEM; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) - brd->PrintDriver.refcount = brd->TtyRefCnt; -#else kref_init(&brd->PrintDriver.kref); -#endif - brd->PrintDriver.termios = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL); if (!brd->PrintDriver.termios) return -ENOMEM; -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - brd->PrintDriver.termios_locked = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL); - if (!brd->PrintDriver.termios_locked) - return -ENOMEM; -#endif - /* * Entry points for driver. Called by the kernel from * tty_io.c and n_tty.c. @@ -1158,7 +1128,6 @@ void dgnc_wakeup_writes(struct channel_t *ch) } if (ch->ch_tun.un_flags & UN_ISOPEN) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && ch->ch_tun.un_tty->ldisc->ops->write_wakeup) { @@ -1166,15 +1135,6 @@ void dgnc_wakeup_writes(struct channel_t *ch) (ch->ch_tun.un_tty->ldisc->ops->write_wakeup)(ch->ch_tun.un_tty); DGNC_LOCK(ch->ch_lock, lock_flags); } -#else - if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && - ch->ch_tun.un_tty->ldisc.ops->write_wakeup) - { - DGNC_UNLOCK(ch->ch_lock, lock_flags); - (ch->ch_tun.un_tty->ldisc.ops->write_wakeup)(ch->ch_tun.un_tty); - DGNC_LOCK(ch->ch_lock, lock_flags); - } -#endif wake_up_interruptible(&ch->ch_tun.un_tty->write_wait); @@ -1210,7 +1170,6 @@ void dgnc_wakeup_writes(struct channel_t *ch) } if (ch->ch_pun.un_flags & UN_ISOPEN) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && ch->ch_pun.un_tty->ldisc->ops->write_wakeup) { @@ -1218,15 +1177,6 @@ void dgnc_wakeup_writes(struct channel_t *ch) (ch->ch_pun.un_tty->ldisc->ops->write_wakeup)(ch->ch_pun.un_tty); DGNC_LOCK(ch->ch_lock, lock_flags); } -#else - if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && - ch->ch_pun.un_tty->ldisc.ops->write_wakeup) - { - DGNC_UNLOCK(ch->ch_lock, lock_flags); - (ch->ch_pun.un_tty->ldisc.ops->write_wakeup)(ch->ch_pun.un_tty); - DGNC_LOCK(ch->ch_lock, lock_flags); - } -#endif wake_up_interruptible(&ch->ch_pun.un_tty->write_wait); @@ -2236,11 +2186,8 @@ static int dgnc_tty_write(struct tty_struct *tty, /* * Return modem signals to ld. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) + static int dgnc_tty_tiocmget(struct tty_struct *tty) -#else -static int dgnc_tty_tiocmget(struct tty_struct *tty, struct file *file) -#endif { struct channel_t *ch; struct un_t *un; @@ -2293,13 +2240,9 @@ static int dgnc_tty_tiocmget(struct tty_struct *tty, struct file *file) * * Set modem signals, called by ld. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) + static int dgnc_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) -#else -static int dgnc_tty_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) -#endif { struct dgnc_board *bd; struct channel_t *ch; -- 2.7.4