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

greybus/uart: switch to ->[sg]et_serial()

Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 0aad5ad5 b98e5a67

+17 -28
+17 -28
drivers/staging/greybus/uart.c
··· 616 616 } 617 617 } 618 618 619 - static int get_serial_info(struct gb_tty *gb_tty, 620 - struct serial_struct __user *info) 619 + static int get_serial_info(struct tty_struct *tty, 620 + struct serial_struct *ss) 621 621 { 622 - struct serial_struct tmp; 622 + struct gb_tty *gb_tty = tty->driver_data; 623 623 624 - memset(&tmp, 0, sizeof(tmp)); 625 - tmp.type = PORT_16550A; 626 - tmp.line = gb_tty->minor; 627 - tmp.xmit_fifo_size = 16; 628 - tmp.baud_base = 9600; 629 - tmp.close_delay = gb_tty->port.close_delay / 10; 630 - tmp.closing_wait = 624 + ss->type = PORT_16550A; 625 + ss->line = gb_tty->minor; 626 + ss->xmit_fifo_size = 16; 627 + ss->baud_base = 9600; 628 + ss->close_delay = gb_tty->port.close_delay / 10; 629 + ss->closing_wait = 631 630 gb_tty->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? 632 631 ASYNC_CLOSING_WAIT_NONE : gb_tty->port.closing_wait / 10; 633 - 634 - if (copy_to_user(info, &tmp, sizeof(tmp))) 635 - return -EFAULT; 636 632 return 0; 637 633 } 638 634 639 - static int set_serial_info(struct gb_tty *gb_tty, 640 - struct serial_struct __user *newinfo) 635 + static int set_serial_info(struct tty_struct *tty, 636 + struct serial_struct *ss) 641 637 { 642 - struct serial_struct new_serial; 638 + struct gb_tty *gb_tty = tty->driver_data; 643 639 unsigned int closing_wait; 644 640 unsigned int close_delay; 645 641 int retval = 0; 646 642 647 - if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) 648 - return -EFAULT; 649 - 650 - close_delay = new_serial.close_delay * 10; 651 - closing_wait = new_serial.closing_wait == ASYNC_CLOSING_WAIT_NONE ? 652 - ASYNC_CLOSING_WAIT_NONE : new_serial.closing_wait * 10; 643 + close_delay = ss->close_delay * 10; 644 + closing_wait = ss->closing_wait == ASYNC_CLOSING_WAIT_NONE ? 645 + ASYNC_CLOSING_WAIT_NONE : ss->closing_wait * 10; 653 646 654 647 mutex_lock(&gb_tty->port.mutex); 655 648 if (!capable(CAP_SYS_ADMIN)) { ··· 721 728 struct gb_tty *gb_tty = tty->driver_data; 722 729 723 730 switch (cmd) { 724 - case TIOCGSERIAL: 725 - return get_serial_info(gb_tty, 726 - (struct serial_struct __user *)arg); 727 - case TIOCSSERIAL: 728 - return set_serial_info(gb_tty, 729 - (struct serial_struct __user *)arg); 730 731 case TIOCMIWAIT: 731 732 return wait_serial_change(gb_tty, arg); 732 733 } ··· 805 818 .tiocmget = gb_tty_tiocmget, 806 819 .tiocmset = gb_tty_tiocmset, 807 820 .get_icount = gb_tty_get_icount, 821 + .set_serial = set_serial_info, 822 + .get_serial = get_serial_info, 808 823 }; 809 824 810 825 static const struct tty_port_operations gb_port_ops = {