staging: dgnc: removes LINUX_VERSION_CODE conditionals
authorLidza Louina <lidza.louina@gmail.com>
Mon, 9 Sep 2013 19:01:26 +0000 (15:01 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Sep 2013 23:07:12 +0000 (16:07 -0700)
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 <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dgnc/dgnc_driver.c
drivers/staging/dgnc/dgnc_kcompat.h
drivers/staging/dgnc/dgnc_tty.c

index 1318a70..3c54759 100644 (file)
 
 
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
 #include <linux/sched.h>
-#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;
                }
 
index 00f589a..ed85152 100644 (file)
@@ -28,8 +28,6 @@
 #ifndef __DGNC_KCOMPAT_H
 #define __DGNC_KCOMPAT_H
 
-#include <linux/version.h>
-
 # ifndef KERNEL_VERSION
 #  define KERNEL_VERSION(a,b,c)  (((a) << 16) + ((b) << 8) + (c))
 # endif
                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 */
index 6906e98..1350d62 100644 (file)
@@ -38,7 +38,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/sched.h>       /* For jiffies, task states */
 #include <linux/interrupt.h>   /* For tasklet and interrupt structs/defines */
 #include <linux/module.h>
 #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;