forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/usb/serial/whiteheat.c
....@@ -8,7 +8,7 @@
88 * Copyright (C) 1999 - 2001
99 * Greg Kroah-Hartman (greg@kroah.com)
1010 *
11
- * See Documentation/usb/usb-serial.txt for more information on using this
11
+ * See Documentation/usb/usb-serial.rst for more information on using this
1212 * driver
1313 */
1414
....@@ -83,8 +83,8 @@
8383 static int whiteheat_open(struct tty_struct *tty,
8484 struct usb_serial_port *port);
8585 static void whiteheat_close(struct usb_serial_port *port);
86
-static int whiteheat_ioctl(struct tty_struct *tty,
87
- unsigned int cmd, unsigned long arg);
86
+static int whiteheat_get_serial(struct tty_struct *tty,
87
+ struct serial_struct *ss);
8888 static void whiteheat_set_termios(struct tty_struct *tty,
8989 struct usb_serial_port *port, struct ktermios *old);
9090 static int whiteheat_tiocmget(struct tty_struct *tty);
....@@ -120,7 +120,7 @@
120120 .port_remove = whiteheat_port_remove,
121121 .open = whiteheat_open,
122122 .close = whiteheat_close,
123
- .ioctl = whiteheat_ioctl,
123
+ .get_serial = whiteheat_get_serial,
124124 .set_termios = whiteheat_set_termios,
125125 .break_ctl = whiteheat_break_ctl,
126126 .tiocmget = whiteheat_tiocmget,
....@@ -442,33 +442,21 @@
442442 }
443443
444444
445
-static int whiteheat_ioctl(struct tty_struct *tty,
446
- unsigned int cmd, unsigned long arg)
445
+static int whiteheat_get_serial(struct tty_struct *tty,
446
+ struct serial_struct *ss)
447447 {
448448 struct usb_serial_port *port = tty->driver_data;
449
- struct serial_struct serstruct;
450
- void __user *user_arg = (void __user *)arg;
451449
452
- switch (cmd) {
453
- case TIOCGSERIAL:
454
- memset(&serstruct, 0, sizeof(serstruct));
455
- serstruct.type = PORT_16654;
456
- serstruct.line = port->minor;
457
- serstruct.port = port->port_number;
458
- serstruct.xmit_fifo_size = kfifo_size(&port->write_fifo);
459
- serstruct.custom_divisor = 0;
460
- serstruct.baud_base = 460800;
461
- serstruct.close_delay = CLOSING_DELAY;
462
- serstruct.closing_wait = CLOSING_DELAY;
450
+ ss->type = PORT_16654;
451
+ ss->line = port->minor;
452
+ ss->port = port->port_number;
453
+ ss->xmit_fifo_size = kfifo_size(&port->write_fifo);
454
+ ss->custom_divisor = 0;
455
+ ss->baud_base = 460800;
456
+ ss->close_delay = CLOSING_DELAY;
457
+ ss->closing_wait = CLOSING_DELAY;
463458
464
- if (copy_to_user(user_arg, &serstruct, sizeof(serstruct)))
465
- return -EFAULT;
466
- break;
467
- default:
468
- break;
469
- }
470
-
471
- return -ENOIOCTLCMD;
459
+ return 0;
472460 }
473461
474462
....@@ -611,9 +599,8 @@
611599 switch (command) {
612600 case WHITEHEAT_GET_DTR_RTS:
613601 info = usb_get_serial_port_data(port);
614
- memcpy(&info->mcr, command_info->result_buffer,
615
- sizeof(struct whiteheat_dr_info));
616
- break;
602
+ info->mcr = command_info->result_buffer[0];
603
+ break;
617604 }
618605 }
619606 exit: