.. | .. |
---|
129 | 129 | static int r3964_open(struct tty_struct *tty); |
---|
130 | 130 | static void r3964_close(struct tty_struct *tty); |
---|
131 | 131 | static ssize_t r3964_read(struct tty_struct *tty, struct file *file, |
---|
132 | | - unsigned char __user * buf, size_t nr); |
---|
| 132 | + void *cookie, unsigned char *buf, size_t nr); |
---|
133 | 133 | static ssize_t r3964_write(struct tty_struct *tty, struct file *file, |
---|
134 | 134 | const unsigned char *buf, size_t nr); |
---|
135 | 135 | static int r3964_ioctl(struct tty_struct *tty, struct file *file, |
---|
136 | 136 | unsigned int cmd, unsigned long arg); |
---|
| 137 | +#ifdef CONFIG_COMPAT |
---|
| 138 | +static int r3964_compat_ioctl(struct tty_struct *tty, struct file *file, |
---|
| 139 | + unsigned int cmd, unsigned long arg); |
---|
| 140 | +#endif |
---|
137 | 141 | static void r3964_set_termios(struct tty_struct *tty, struct ktermios *old); |
---|
138 | 142 | static __poll_t r3964_poll(struct tty_struct *tty, struct file *file, |
---|
139 | 143 | struct poll_table_struct *wait); |
---|
.. | .. |
---|
149 | 153 | .read = r3964_read, |
---|
150 | 154 | .write = r3964_write, |
---|
151 | 155 | .ioctl = r3964_ioctl, |
---|
| 156 | +#ifdef CONFIG_COMPAT |
---|
| 157 | + .compat_ioctl = r3964_compat_ioctl, |
---|
| 158 | +#endif |
---|
152 | 159 | .set_termios = r3964_set_termios, |
---|
153 | 160 | .poll = r3964_poll, |
---|
154 | 161 | .receive_buf = r3964_receive_buf, |
---|
.. | .. |
---|
598 | 605 | } |
---|
599 | 606 | break; |
---|
600 | 607 | case R3964_WAIT_FOR_RX_REPEAT: |
---|
601 | | - /* FALLTHROUGH */ |
---|
602 | 608 | case R3964_IDLE: |
---|
603 | 609 | if (c == STX) { |
---|
604 | 610 | /* Prevent rx_queue from overflow: */ |
---|
.. | .. |
---|
1052 | 1058 | } |
---|
1053 | 1059 | |
---|
1054 | 1060 | static ssize_t r3964_read(struct tty_struct *tty, struct file *file, |
---|
1055 | | - unsigned char __user * buf, size_t nr) |
---|
| 1061 | + unsigned char *kbuf, size_t nr, |
---|
| 1062 | + void **cookie, unsigned long offset) |
---|
1056 | 1063 | { |
---|
1057 | 1064 | struct r3964_info *pInfo = tty->disc_data; |
---|
1058 | 1065 | struct r3964_client_info *pClient; |
---|
.. | .. |
---|
1103 | 1110 | kfree(pMsg); |
---|
1104 | 1111 | TRACE_M("r3964_read - msg kfree %p", pMsg); |
---|
1105 | 1112 | |
---|
1106 | | - if (copy_to_user(buf, &theMsg, ret)) { |
---|
1107 | | - ret = -EFAULT; |
---|
1108 | | - goto unlock; |
---|
1109 | | - } |
---|
| 1113 | + memcpy(kbuf, &theMsg, ret); |
---|
1110 | 1114 | |
---|
1111 | 1115 | TRACE_PS("read - return %d", ret); |
---|
1112 | 1116 | goto unlock; |
---|
.. | .. |
---|
1210 | 1214 | } |
---|
1211 | 1215 | } |
---|
1212 | 1216 | |
---|
| 1217 | +#ifdef CONFIG_COMPAT |
---|
| 1218 | +static int r3964_compat_ioctl(struct tty_struct *tty, struct file *file, |
---|
| 1219 | + unsigned int cmd, unsigned long arg) |
---|
| 1220 | +{ |
---|
| 1221 | + switch (cmd) { |
---|
| 1222 | + case R3964_ENABLE_SIGNALS: |
---|
| 1223 | + case R3964_SETPRIORITY: |
---|
| 1224 | + case R3964_USE_BCC: |
---|
| 1225 | + return r3964_ioctl(tty, file, cmd, arg); |
---|
| 1226 | + default: |
---|
| 1227 | + return -ENOIOCTLCMD; |
---|
| 1228 | + } |
---|
| 1229 | +} |
---|
| 1230 | +#endif |
---|
| 1231 | + |
---|
1213 | 1232 | static void r3964_set_termios(struct tty_struct *tty, struct ktermios *old) |
---|
1214 | 1233 | { |
---|
1215 | 1234 | TRACE_L("set_termios"); |
---|