Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Lidza Louina and committed by
Greg Kroah-Hartman
b74c7461 05557445

+2 -95
-12
drivers/staging/dgnc/dgnc_driver.c
··· 31 31 32 32 33 33 #include <linux/kernel.h> 34 - #include <linux/version.h> 35 34 #include <linux/module.h> 36 35 #include <linux/pci.h> 37 36 #include <linux/slab.h> 38 - 39 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) 40 37 #include <linux/sched.h> 41 - #endif 42 - 43 38 #include "dgnc_driver.h" 44 39 #include "dgnc_pci.h" 45 40 #include "dpacompat.h" ··· 286 291 dgnc_Major = rc; 287 292 288 293 dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt"); 289 - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) 290 - device_create_drvdata(dgnc_class, NULL, 291 - MKDEV(dgnc_Major, 0), 292 - NULL, "dgnc_mgmt"); 293 - #else 294 294 device_create(dgnc_class, NULL, 295 295 MKDEV(dgnc_Major, 0), 296 296 NULL, "dgnc_mgmt"); 297 - #endif 298 - 299 297 dgnc_Major_Control_Registered = TRUE; 300 298 } 301 299
-24
drivers/staging/dgnc/dgnc_kcompat.h
··· 28 28 #ifndef __DGNC_KCOMPAT_H 29 29 #define __DGNC_KCOMPAT_H 30 30 31 - #include <linux/version.h> 32 - 33 31 # ifndef KERNEL_VERSION 34 32 # define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 35 33 # endif ··· 65 67 ulong dgnc_##VAR; \ 66 68 module_param(VAR, long, PERM); \ 67 69 MODULE_PARM_DESC(VAR, DESC); 68 - 69 - 70 - 71 - 72 - 73 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) 74 - 75 - 76 - 77 - /* NOTHING YET */ 78 - 79 - 80 - 81 - # else 82 - 83 - 84 - 85 - # error "this driver does not support anything below the 2.6.27 kernel series." 86 - 87 - 88 - 89 - # endif 90 70 91 71 #endif /* ! __DGNC_KCOMPAT_H */
+2 -59
drivers/staging/dgnc/dgnc_tty.c
··· 38 38 */ 39 39 40 40 #include <linux/kernel.h> 41 - #include <linux/version.h> 42 41 #include <linux/sched.h> /* For jiffies, task states */ 43 42 #include <linux/interrupt.h> /* For tasklet and interrupt structs/defines */ 44 43 #include <linux/module.h> ··· 59 60 #include "dpacompat.h" 60 61 #include "dgnc_sysfs.h" 61 62 62 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) 63 63 #define init_MUTEX(sem) sema_init(sem, 1) 64 64 #define DECLARE_MUTEX(name) \ 65 65 struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) 66 - #endif 67 66 68 67 /* 69 68 * internal variables ··· 123 126 static void dgnc_tty_hangup(struct tty_struct *tty); 124 127 static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, unsigned int __user *value); 125 128 static int dgnc_get_modem_info(struct channel_t *ch, unsigned int __user *value); 126 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) 127 129 static int dgnc_tty_tiocmget(struct tty_struct *tty); 128 130 static int dgnc_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); 129 - #else 130 - static int dgnc_tty_tiocmget(struct tty_struct *tty, struct file *file); 131 - static int dgnc_tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); 132 - #endif 133 131 static int dgnc_tty_send_break(struct tty_struct *tty, int msec); 134 132 static void dgnc_tty_wait_until_sent(struct tty_struct *tty, int timeout); 135 133 static int dgnc_tty_write(struct tty_struct *tty, const unsigned char *buf, int count); ··· 226 234 if (!brd->SerialDriver.ttys) 227 235 return -ENOMEM; 228 236 229 - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) 230 - brd->SerialDriver.refcount = brd->TtyRefCnt; 231 - #else 232 237 kref_init(&brd->SerialDriver.kref); 233 - #endif 234 - 235 238 brd->SerialDriver.termios = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL); 236 239 if (!brd->SerialDriver.termios) 237 240 return -ENOMEM; 238 241 239 - #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) 240 - brd->SerialDriver.termios_locked = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL); 241 - if (!brd->SerialDriver.termios_locked) 242 - return -ENOMEM; 243 - #endif 244 242 /* 245 243 * Entry points for driver. Called by the kernel from 246 244 * tty_io.c and n_tty.c. ··· 274 292 brd->PrintDriver.ttys = kzalloc(brd->maxports * sizeof(struct tty_struct *), GFP_KERNEL); 275 293 if (!brd->PrintDriver.ttys) 276 294 return -ENOMEM; 277 - 278 - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) 279 - brd->PrintDriver.refcount = brd->TtyRefCnt; 280 - #else 281 295 kref_init(&brd->PrintDriver.kref); 282 - #endif 283 - 284 296 brd->PrintDriver.termios = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL); 285 297 if (!brd->PrintDriver.termios) 286 298 return -ENOMEM; 287 - 288 - #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) 289 - brd->PrintDriver.termios_locked = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL); 290 - if (!brd->PrintDriver.termios_locked) 291 - return -ENOMEM; 292 - #endif 293 299 294 300 /* 295 301 * Entry points for driver. Called by the kernel from ··· 1128 1158 } 1129 1159 1130 1160 if (ch->ch_tun.un_flags & UN_ISOPEN) { 1131 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) 1132 1161 if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 1133 1162 ch->ch_tun.un_tty->ldisc->ops->write_wakeup) 1134 1163 { ··· 1135 1166 (ch->ch_tun.un_tty->ldisc->ops->write_wakeup)(ch->ch_tun.un_tty); 1136 1167 DGNC_LOCK(ch->ch_lock, lock_flags); 1137 1168 } 1138 - #else 1139 - if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 1140 - ch->ch_tun.un_tty->ldisc.ops->write_wakeup) 1141 - { 1142 - DGNC_UNLOCK(ch->ch_lock, lock_flags); 1143 - (ch->ch_tun.un_tty->ldisc.ops->write_wakeup)(ch->ch_tun.un_tty); 1144 - DGNC_LOCK(ch->ch_lock, lock_flags); 1145 - } 1146 - #endif 1147 1169 1148 1170 wake_up_interruptible(&ch->ch_tun.un_tty->write_wait); 1149 1171 ··· 1170 1210 } 1171 1211 1172 1212 if (ch->ch_pun.un_flags & UN_ISOPEN) { 1173 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) 1174 1213 if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 1175 1214 ch->ch_pun.un_tty->ldisc->ops->write_wakeup) 1176 1215 { ··· 1177 1218 (ch->ch_pun.un_tty->ldisc->ops->write_wakeup)(ch->ch_pun.un_tty); 1178 1219 DGNC_LOCK(ch->ch_lock, lock_flags); 1179 1220 } 1180 - #else 1181 - if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 1182 - ch->ch_pun.un_tty->ldisc.ops->write_wakeup) 1183 - { 1184 - DGNC_UNLOCK(ch->ch_lock, lock_flags); 1185 - (ch->ch_pun.un_tty->ldisc.ops->write_wakeup)(ch->ch_pun.un_tty); 1186 - DGNC_LOCK(ch->ch_lock, lock_flags); 1187 - } 1188 - #endif 1189 1221 1190 1222 wake_up_interruptible(&ch->ch_pun.un_tty->write_wait); 1191 1223 ··· 2186 2236 /* 2187 2237 * Return modem signals to ld. 2188 2238 */ 2189 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) 2239 + 2190 2240 static int dgnc_tty_tiocmget(struct tty_struct *tty) 2191 - #else 2192 - static int dgnc_tty_tiocmget(struct tty_struct *tty, struct file *file) 2193 - #endif 2194 2241 { 2195 2242 struct channel_t *ch; 2196 2243 struct un_t *un; ··· 2240 2293 * 2241 2294 * Set modem signals, called by ld. 2242 2295 */ 2243 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) 2296 + 2244 2297 static int dgnc_tty_tiocmset(struct tty_struct *tty, 2245 2298 unsigned int set, unsigned int clear) 2246 - #else 2247 - static int dgnc_tty_tiocmset(struct tty_struct *tty, struct file *file, 2248 - unsigned int set, unsigned int clear) 2249 - #endif 2250 2299 { 2251 2300 struct dgnc_board *bd; 2252 2301 struct channel_t *ch;