diff options
Diffstat (limited to 'drivers/char/synclink_gt.c')
-rw-r--r-- | drivers/char/synclink_gt.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index e63b830c86cc..1746d91205f7 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -1032,9 +1032,6 @@ static int ioctl(struct tty_struct *tty, struct file *file, | |||
1032 | unsigned int cmd, unsigned long arg) | 1032 | unsigned int cmd, unsigned long arg) |
1033 | { | 1033 | { |
1034 | struct slgt_info *info = tty->driver_data; | 1034 | struct slgt_info *info = tty->driver_data; |
1035 | struct mgsl_icount cnow; /* kernel counter temps */ | ||
1036 | struct serial_icounter_struct __user *p_cuser; /* user space */ | ||
1037 | unsigned long flags; | ||
1038 | void __user *argp = (void __user *)arg; | 1035 | void __user *argp = (void __user *)arg; |
1039 | int ret; | 1036 | int ret; |
1040 | 1037 | ||
@@ -1043,7 +1040,7 @@ static int ioctl(struct tty_struct *tty, struct file *file, | |||
1043 | DBGINFO(("%s ioctl() cmd=%08X\n", info->device_name, cmd)); | 1040 | DBGINFO(("%s ioctl() cmd=%08X\n", info->device_name, cmd)); |
1044 | 1041 | ||
1045 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && | 1042 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && |
1046 | (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { | 1043 | (cmd != TIOCMIWAIT)) { |
1047 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1044 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1048 | return -EIO; | 1045 | return -EIO; |
1049 | } | 1046 | } |
@@ -1053,24 +1050,6 @@ static int ioctl(struct tty_struct *tty, struct file *file, | |||
1053 | return wait_mgsl_event(info, argp); | 1050 | return wait_mgsl_event(info, argp); |
1054 | case TIOCMIWAIT: | 1051 | case TIOCMIWAIT: |
1055 | return modem_input_wait(info,(int)arg); | 1052 | return modem_input_wait(info,(int)arg); |
1056 | case TIOCGICOUNT: | ||
1057 | spin_lock_irqsave(&info->lock,flags); | ||
1058 | cnow = info->icount; | ||
1059 | spin_unlock_irqrestore(&info->lock,flags); | ||
1060 | p_cuser = argp; | ||
1061 | if (put_user(cnow.cts, &p_cuser->cts) || | ||
1062 | put_user(cnow.dsr, &p_cuser->dsr) || | ||
1063 | put_user(cnow.rng, &p_cuser->rng) || | ||
1064 | put_user(cnow.dcd, &p_cuser->dcd) || | ||
1065 | put_user(cnow.rx, &p_cuser->rx) || | ||
1066 | put_user(cnow.tx, &p_cuser->tx) || | ||
1067 | put_user(cnow.frame, &p_cuser->frame) || | ||
1068 | put_user(cnow.overrun, &p_cuser->overrun) || | ||
1069 | put_user(cnow.parity, &p_cuser->parity) || | ||
1070 | put_user(cnow.brk, &p_cuser->brk) || | ||
1071 | put_user(cnow.buf_overrun, &p_cuser->buf_overrun)) | ||
1072 | return -EFAULT; | ||
1073 | return 0; | ||
1074 | case MGSL_IOCSGPIO: | 1053 | case MGSL_IOCSGPIO: |
1075 | return set_gpio(info, argp); | 1054 | return set_gpio(info, argp); |
1076 | case MGSL_IOCGGPIO: | 1055 | case MGSL_IOCGGPIO: |
@@ -1117,6 +1096,33 @@ static int ioctl(struct tty_struct *tty, struct file *file, | |||
1117 | return ret; | 1096 | return ret; |
1118 | } | 1097 | } |
1119 | 1098 | ||
1099 | static int get_icount(struct tty_struct *tty, | ||
1100 | struct serial_icounter_struct *icount) | ||
1101 | |||
1102 | { | ||
1103 | struct slgt_info *info = tty->driver_data; | ||
1104 | struct mgsl_icount cnow; /* kernel counter temps */ | ||
1105 | unsigned long flags; | ||
1106 | |||
1107 | spin_lock_irqsave(&info->lock,flags); | ||
1108 | cnow = info->icount; | ||
1109 | spin_unlock_irqrestore(&info->lock,flags); | ||
1110 | |||
1111 | icount->cts = cnow.cts; | ||
1112 | icount->dsr = cnow.dsr; | ||
1113 | icount->rng = cnow.rng; | ||
1114 | icount->dcd = cnow.dcd; | ||
1115 | icount->rx = cnow.rx; | ||
1116 | icount->tx = cnow.tx; | ||
1117 | icount->frame = cnow.frame; | ||
1118 | icount->overrun = cnow.overrun; | ||
1119 | icount->parity = cnow.parity; | ||
1120 | icount->brk = cnow.brk; | ||
1121 | icount->buf_overrun = cnow.buf_overrun; | ||
1122 | |||
1123 | return 0; | ||
1124 | } | ||
1125 | |||
1120 | /* | 1126 | /* |
1121 | * support for 32 bit ioctl calls on 64 bit systems | 1127 | * support for 32 bit ioctl calls on 64 bit systems |
1122 | */ | 1128 | */ |
@@ -1206,10 +1212,6 @@ static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file, | |||
1206 | case MGSL_IOCSGPIO: | 1212 | case MGSL_IOCSGPIO: |
1207 | case MGSL_IOCGGPIO: | 1213 | case MGSL_IOCGGPIO: |
1208 | case MGSL_IOCWAITGPIO: | 1214 | case MGSL_IOCWAITGPIO: |
1209 | case TIOCGICOUNT: | ||
1210 | rc = ioctl(tty, file, cmd, (unsigned long)(compat_ptr(arg))); | ||
1211 | break; | ||
1212 | |||
1213 | case MGSL_IOCSTXIDLE: | 1215 | case MGSL_IOCSTXIDLE: |
1214 | case MGSL_IOCTXENABLE: | 1216 | case MGSL_IOCTXENABLE: |
1215 | case MGSL_IOCRXENABLE: | 1217 | case MGSL_IOCRXENABLE: |
@@ -3642,6 +3644,7 @@ static const struct tty_operations ops = { | |||
3642 | .hangup = hangup, | 3644 | .hangup = hangup, |
3643 | .tiocmget = tiocmget, | 3645 | .tiocmget = tiocmget, |
3644 | .tiocmset = tiocmset, | 3646 | .tiocmset = tiocmset, |
3647 | .get_icount = get_icount, | ||
3645 | .proc_fops = &synclink_gt_proc_fops, | 3648 | .proc_fops = &synclink_gt_proc_fops, |
3646 | }; | 3649 | }; |
3647 | 3650 | ||