hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/usb/serial/ssu100.c
....@@ -331,39 +331,19 @@
331331 return usb_serial_generic_open(tty, port);
332332 }
333333
334
-static int get_serial_info(struct usb_serial_port *port,
335
- struct serial_struct __user *retinfo)
336
-{
337
- struct serial_struct tmp;
338
-
339
- memset(&tmp, 0, sizeof(tmp));
340
- tmp.line = port->minor;
341
- tmp.port = 0;
342
- tmp.irq = 0;
343
- tmp.xmit_fifo_size = port->bulk_out_size;
344
- tmp.baud_base = 9600;
345
- tmp.close_delay = 5*HZ;
346
- tmp.closing_wait = 30*HZ;
347
-
348
- if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
349
- return -EFAULT;
350
- return 0;
351
-}
352
-
353
-static int ssu100_ioctl(struct tty_struct *tty,
354
- unsigned int cmd, unsigned long arg)
334
+static int get_serial_info(struct tty_struct *tty,
335
+ struct serial_struct *ss)
355336 {
356337 struct usb_serial_port *port = tty->driver_data;
357338
358
- switch (cmd) {
359
- case TIOCGSERIAL:
360
- return get_serial_info(port,
361
- (struct serial_struct __user *) arg);
362
- default:
363
- break;
364
- }
365
-
366
- return -ENOIOCTLCMD;
339
+ ss->line = port->minor;
340
+ ss->port = 0;
341
+ ss->irq = 0;
342
+ ss->xmit_fifo_size = port->bulk_out_size;
343
+ ss->baud_base = 9600;
344
+ ss->close_delay = 5*HZ;
345
+ ss->closing_wait = 30*HZ;
346
+ return 0;
367347 }
368348
369349 static int ssu100_attach(struct usb_serial *serial)
....@@ -515,7 +495,7 @@
515495 static void ssu100_process_read_urb(struct urb *urb)
516496 {
517497 struct usb_serial_port *port = urb->context;
518
- char *packet = (char *)urb->transfer_buffer;
498
+ char *packet = urb->transfer_buffer;
519499 char flag = TTY_NORMAL;
520500 u32 len = urb->actual_length;
521501 int i;
....@@ -537,13 +517,14 @@
537517 if (!len)
538518 return; /* status only */
539519
540
- if (port->port.console && port->sysrq) {
520
+ if (port->sysrq) {
541521 for (i = 0; i < len; i++, ch++) {
542522 if (!usb_serial_handle_sysrq_char(port, *ch))
543523 tty_insert_flip_char(&port->port, *ch, flag);
544524 }
545
- } else
525
+ } else {
546526 tty_insert_flip_string_fixed_flag(&port->port, ch, flag, len);
527
+ }
547528
548529 tty_flip_buffer_push(&port->port);
549530 }
....@@ -566,7 +547,7 @@
566547 .tiocmset = ssu100_tiocmset,
567548 .tiocmiwait = usb_serial_generic_tiocmiwait,
568549 .get_icount = usb_serial_generic_get_icount,
569
- .ioctl = ssu100_ioctl,
550
+ .get_serial = get_serial_info,
570551 .set_termios = ssu100_set_termios,
571552 };
572553