diff options
Diffstat (limited to 'drivers/staging/dgrp/dgrp_tty.c')
-rw-r--r-- | drivers/staging/dgrp/dgrp_tty.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/drivers/staging/dgrp/dgrp_tty.c b/drivers/staging/dgrp/dgrp_tty.c index e125b03598d7..51d3ed3dca27 100644 --- a/drivers/staging/dgrp/dgrp_tty.c +++ b/drivers/staging/dgrp/dgrp_tty.c @@ -432,7 +432,7 @@ static void drp_param(struct ch_struct *ch) /* * From the POSIX.1 spec (7.1.2.6): "If {_POSIX_VDISABLE} * is defined for the terminal device file, and the value - * of one of the changable special control characters (see + * of one of the changeable special control characters (see * 7.1.1.9) is {_POSIX_VDISABLE}, that function shall be * disabled, that is, no input data shall be recognized as * the disabled special character." @@ -2265,9 +2265,7 @@ static int get_modem_info(struct ch_struct *ch, unsigned int *value) | ((mlast & DM_RI) ? TIOCM_RNG : 0) | ((mlast & DM_DSR) ? TIOCM_DSR : 0) | ((mlast & DM_CTS) ? TIOCM_CTS : 0); - put_user(mlast, (unsigned int __user *) value); - - return 0; + return put_user(mlast, (unsigned int __user *) value); } /* @@ -2285,7 +2283,8 @@ static int set_modem_info(struct ch_struct *ch, unsigned int command, if (error == 0) return -EFAULT; - get_user(arg, (unsigned int __user *) value); + if (get_user(arg, (unsigned int __user *) value)) + return -EFAULT; mval |= ((arg & TIOCM_RTS) ? DM_RTS : 0) | ((arg & TIOCM_DTR) ? DM_DTR : 0); @@ -2615,21 +2614,6 @@ static int dgrp_tty_ioctl(struct tty_struct *tty, unsigned int cmd, */ return 0; - case TIOCGSOFTCAR: - rc = access_ok(VERIFY_WRITE, (void __user *) arg, - sizeof(long)); - if (rc == 0) - return -EFAULT; - put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) arg); - return 0; - - case TIOCSSOFTCAR: - get_user(arg, (unsigned long __user *) arg); - tty->termios.c_cflag = - ((tty->termios.c_cflag & ~CLOCAL) | - (arg ? CLOCAL : 0)); - return 0; - case TIOCMGET: rc = access_ok(VERIFY_WRITE, (void __user *) arg, sizeof(unsigned int)); @@ -2699,7 +2683,7 @@ static int dgrp_tty_ioctl(struct tty_struct *tty, unsigned int cmd, - looking at the tty_ioctl code, these command all call our tty_set_termios at the driver's end, when a TCSETA* is sent, it is expecting the tty to have a termio structure, - NOT a termios stucture. These two structures differ in size + NOT a termios structure. These two structures differ in size and the tty_ioctl code does a conversion before processing them both. - we should treat the TCSETAW TCSETAF ioctls the same, and let the tty_ioctl code do the conversion stuff. @@ -2851,17 +2835,16 @@ static int dgrp_tty_ioctl(struct tty_struct *tty, unsigned int cmd, break; case DIGI_GETCUSTOMBAUD: - rc = access_ok(VERIFY_WRITE, (void __user *) arg, sizeof(int)); - if (rc == 0) + if (put_user(ch->ch_custom_speed, (unsigned int __user *) arg)) return -EFAULT; - put_user(ch->ch_custom_speed, (unsigned int __user *) arg); break; case DIGI_SETCUSTOMBAUD: { int new_rate; - get_user(new_rate, (unsigned int __user *) arg); + if (get_user(new_rate, (unsigned int __user *) arg)) + return -EFAULT; dgrp_set_custom_speed(ch, new_rate); break; @@ -2996,7 +2979,7 @@ static void dgrp_tty_start(struct tty_struct *tty) } /* - * Stop the reciever + * Stop the receiver */ static void dgrp_tty_input_stop(struct tty_struct *tty) { @@ -3119,6 +3102,7 @@ static void dgrp_tty_hangup(struct tty_struct *tty) void dgrp_tty_uninit(struct nd_struct *nd) { + unsigned int i; char id[3]; ID_TO_CHAR(nd->nd_ID, id); @@ -3152,6 +3136,8 @@ dgrp_tty_uninit(struct nd_struct *nd) put_tty_driver(nd->nd_xprint_ttdriver); nd->nd_ttdriver_flags &= ~XPRINT_TTDRV_REG; } + for (i = 0; i < CHAN_MAX; i++) + tty_port_destroy(&nd->nd_chan[i].port); } @@ -3335,7 +3321,6 @@ dgrp_tty_init(struct nd_struct *nd) init_waitqueue_head(&(ch->ch_pun.un_open_wait)); init_waitqueue_head(&(ch->ch_pun.un_close_wait)); tty_port_init(&ch->port); - tty_port_init(&ch->port); } return 0; } |