diff --git a/module/tty0tty.c b/module/tty0tty.c index ddbc807..eded691 100644 --- a/module/tty0tty.c +++ b/module/tty0tty.c @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -240,8 +241,13 @@ static int tty0tty_write(struct tty_struct *tty, const unsigned char *buffer, in if(ttyx != NULL) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) tty_insert_flip_string(ttyx->port, buffer, count); tty_flip_buffer_push(ttyx->port); +#else + tty_insert_flip_string(ttyx, buffer, count); + tty_flip_buffer_push(ttyx); +#endif retval=count; } @@ -280,17 +286,24 @@ exit: static void tty0tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { unsigned int cflag; + unsigned int iflag; #ifdef SCULL_DEBUG printk(KERN_DEBUG "%s - \n", __FUNCTION__); #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) cflag = tty->termios.c_cflag; + iflag = tty->termios.c_iflag; +#else + cflag = tty->termios->c_cflag; + iflag = tty->termios->c_iflag; +#endif /* check that they really want us to change something */ if (old_termios) { if ((cflag == old_termios->c_cflag) && - (RELEVANT_IFLAG(tty->termios.c_iflag) == + (RELEVANT_IFLAG(iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { #ifdef SCULL_DEBUG printk(KERN_DEBUG " - nothing to change...\n"); @@ -643,7 +656,9 @@ static int __init tty0tty_init(void) for(i=0;i= KERNEL_VERSION(3,7,0) tty_port_link_device(&tport[i],tty0tty_tty_driver, i); +#endif } retval = tty_register_driver(tty0tty_tty_driver); @@ -667,7 +682,9 @@ static void __exit tty0tty_exit(void) #endif for (i = 0; i < TTY0TTY_MINORS; ++i) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) tty_port_destroy(&tport[i]); +#endif tty_unregister_device(tty0tty_tty_driver, i); } tty_unregister_driver(tty0tty_tty_driver);