Commit d23736abe5be73415a3be4700555c61be86e857f
Merge pull request #4 from ReallyNiceGuy/master
Make version 1.2 compile and run on linux 3.2
Showing
1 changed file
with
18 additions
and
1 deletions
module/tty0tty.c
| ... | ... | @@ -38,6 +38,7 @@ |
| 38 | 38 | #include <linux/tty_flip.h> |
| 39 | 39 | #include <linux/serial.h> |
| 40 | 40 | #include <linux/sched.h> |
| 41 | +#include <linux/version.h> | |
| 41 | 42 | #include <asm/uaccess.h> |
| 42 | 43 | |
| 43 | 44 | |
| ... | ... | @@ -240,8 +241,13 @@ static int tty0tty_write(struct tty_struct *tty, const unsigned char *buffer, in |
| 240 | 241 | |
| 241 | 242 | if(ttyx != NULL) |
| 242 | 243 | { |
| 244 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) | |
| 243 | 245 | tty_insert_flip_string(ttyx->port, buffer, count); |
| 244 | 246 | tty_flip_buffer_push(ttyx->port); |
| 247 | +#else | |
| 248 | + tty_insert_flip_string(ttyx, buffer, count); | |
| 249 | + tty_flip_buffer_push(ttyx); | |
| 250 | +#endif | |
| 245 | 251 | retval=count; |
| 246 | 252 | } |
| 247 | 253 | |
| ... | ... | @@ -280,17 +286,24 @@ exit: |
| 280 | 286 | static void tty0tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) |
| 281 | 287 | { |
| 282 | 288 | unsigned int cflag; |
| 289 | + unsigned int iflag; | |
| 283 | 290 | |
| 284 | 291 | #ifdef SCULL_DEBUG |
| 285 | 292 | printk(KERN_DEBUG "%s - \n", __FUNCTION__); |
| 286 | 293 | #endif |
| 287 | 294 | |
| 295 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) | |
| 288 | 296 | cflag = tty->termios.c_cflag; |
| 297 | + iflag = tty->termios.c_iflag; | |
| 298 | +#else | |
| 299 | + cflag = tty->termios->c_cflag; | |
| 300 | + iflag = tty->termios->c_iflag; | |
| 301 | +#endif | |
| 289 | 302 | |
| 290 | 303 | /* check that they really want us to change something */ |
| 291 | 304 | if (old_termios) { |
| 292 | 305 | if ((cflag == old_termios->c_cflag) && |
| 293 | - (RELEVANT_IFLAG(tty->termios.c_iflag) == | |
| 306 | + (RELEVANT_IFLAG(iflag) == | |
| 294 | 307 | RELEVANT_IFLAG(old_termios->c_iflag))) { |
| 295 | 308 | #ifdef SCULL_DEBUG |
| 296 | 309 | printk(KERN_DEBUG " - nothing to change...\n"); |
| ... | ... | @@ -643,7 +656,9 @@ static int __init tty0tty_init(void) |
| 643 | 656 | for(i=0;i<TTY0TTY_MINORS;i++) |
| 644 | 657 | { |
| 645 | 658 | tty_port_init(&tport[i]); |
| 659 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) | |
| 646 | 660 | tty_port_link_device(&tport[i],tty0tty_tty_driver, i); |
| 661 | +#endif | |
| 647 | 662 | } |
| 648 | 663 | |
| 649 | 664 | retval = tty_register_driver(tty0tty_tty_driver); |
| ... | ... | @@ -667,7 +682,9 @@ static void __exit tty0tty_exit(void) |
| 667 | 682 | #endif |
| 668 | 683 | for (i = 0; i < TTY0TTY_MINORS; ++i) |
| 669 | 684 | { |
| 685 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) | |
| 670 | 686 | tty_port_destroy(&tport[i]); |
| 687 | +#endif | |
| 671 | 688 | tty_unregister_device(tty0tty_tty_driver, i); |
| 672 | 689 | } |
| 673 | 690 | tty_unregister_driver(tty0tty_tty_driver); | ... | ... |