diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2018-09-12 07:21:40 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2018-10-13 00:50:39 -0400 |
| commit | 30296aa419f8caec24e31cc2e6e3e6081460e97d (patch) | |
| tree | 8f4168241cd07fa5d01dd352fe54a9ea737bfc05 | |
| parent | b27ef409b415099aa2c540630db03ea84f45c5cc (diff) | |
opticon: switch to ->get_serial()
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | drivers/usb/serial/opticon.c | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index caa0746326fd..cb7aac9cd9e7 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
| @@ -328,42 +328,23 @@ static int opticon_tiocmset(struct tty_struct *tty, | |||
| 328 | return 0; | 328 | return 0; |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | static int get_serial_info(struct usb_serial_port *port, | 331 | static int get_serial_info(struct tty_struct *tty, |
| 332 | struct serial_struct __user *serial) | 332 | struct serial_struct *ss) |
| 333 | { | 333 | { |
| 334 | struct serial_struct tmp; | 334 | struct usb_serial_port *port = tty->driver_data; |
| 335 | |||
| 336 | memset(&tmp, 0x00, sizeof(tmp)); | ||
| 337 | 335 | ||
| 338 | /* fake emulate a 16550 uart to make userspace code happy */ | 336 | /* fake emulate a 16550 uart to make userspace code happy */ |
| 339 | tmp.type = PORT_16550A; | 337 | ss->type = PORT_16550A; |
| 340 | tmp.line = port->minor; | 338 | ss->line = port->minor; |
| 341 | tmp.port = 0; | 339 | ss->port = 0; |
| 342 | tmp.irq = 0; | 340 | ss->irq = 0; |
| 343 | tmp.xmit_fifo_size = 1024; | 341 | ss->xmit_fifo_size = 1024; |
| 344 | tmp.baud_base = 9600; | 342 | ss->baud_base = 9600; |
| 345 | tmp.close_delay = 5*HZ; | 343 | ss->close_delay = 5*HZ; |
| 346 | tmp.closing_wait = 30*HZ; | 344 | ss->closing_wait = 30*HZ; |
| 347 | |||
| 348 | if (copy_to_user(serial, &tmp, sizeof(*serial))) | ||
| 349 | return -EFAULT; | ||
| 350 | return 0; | 345 | return 0; |
| 351 | } | 346 | } |
| 352 | 347 | ||
| 353 | static int opticon_ioctl(struct tty_struct *tty, | ||
| 354 | unsigned int cmd, unsigned long arg) | ||
| 355 | { | ||
| 356 | struct usb_serial_port *port = tty->driver_data; | ||
| 357 | |||
| 358 | switch (cmd) { | ||
| 359 | case TIOCGSERIAL: | ||
| 360 | return get_serial_info(port, | ||
| 361 | (struct serial_struct __user *)arg); | ||
| 362 | } | ||
| 363 | |||
| 364 | return -ENOIOCTLCMD; | ||
| 365 | } | ||
| 366 | |||
| 367 | static int opticon_port_probe(struct usb_serial_port *port) | 348 | static int opticon_port_probe(struct usb_serial_port *port) |
| 368 | { | 349 | { |
| 369 | struct opticon_private *priv; | 350 | struct opticon_private *priv; |
| @@ -404,7 +385,7 @@ static struct usb_serial_driver opticon_device = { | |||
| 404 | .write_room = opticon_write_room, | 385 | .write_room = opticon_write_room, |
| 405 | .throttle = usb_serial_generic_throttle, | 386 | .throttle = usb_serial_generic_throttle, |
| 406 | .unthrottle = usb_serial_generic_unthrottle, | 387 | .unthrottle = usb_serial_generic_unthrottle, |
| 407 | .ioctl = opticon_ioctl, | 388 | .get_serial = get_serial_info, |
| 408 | .tiocmget = opticon_tiocmget, | 389 | .tiocmget = opticon_tiocmget, |
| 409 | .tiocmset = opticon_tiocmset, | 390 | .tiocmset = opticon_tiocmset, |
| 410 | .process_read_urb = opticon_process_read_urb, | 391 | .process_read_urb = opticon_process_read_urb, |
