hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/usb/serial/quatech2.c
....@@ -453,39 +453,19 @@
453453 usb_kill_urb(serial_priv->read_urb);
454454 }
455455
456
-static int get_serial_info(struct usb_serial_port *port,
457
- struct serial_struct __user *retinfo)
458
-{
459
- struct serial_struct tmp;
460
-
461
- memset(&tmp, 0, sizeof(tmp));
462
- tmp.line = port->minor;
463
- tmp.port = 0;
464
- tmp.irq = 0;
465
- tmp.xmit_fifo_size = port->bulk_out_size;
466
- tmp.baud_base = 9600;
467
- tmp.close_delay = 5*HZ;
468
- tmp.closing_wait = 30*HZ;
469
-
470
- if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
471
- return -EFAULT;
472
- return 0;
473
-}
474
-
475
-static int qt2_ioctl(struct tty_struct *tty,
476
- unsigned int cmd, unsigned long arg)
456
+static int get_serial_info(struct tty_struct *tty,
457
+ struct serial_struct *ss)
477458 {
478459 struct usb_serial_port *port = tty->driver_data;
479460
480
- switch (cmd) {
481
- case TIOCGSERIAL:
482
- return get_serial_info(port,
483
- (struct serial_struct __user *)arg);
484
- default:
485
- break;
486
- }
487
-
488
- return -ENOIOCTLCMD;
461
+ ss->line = port->minor;
462
+ ss->port = 0;
463
+ ss->irq = 0;
464
+ ss->xmit_fifo_size = port->bulk_out_size;
465
+ ss->baud_base = 9600;
466
+ ss->close_delay = 5*HZ;
467
+ ss->closing_wait = 30*HZ;
468
+ return 0;
489469 }
490470
491471 static void qt2_process_status(struct usb_serial_port *port, unsigned char *ch)
....@@ -500,27 +480,11 @@
500480 }
501481 }
502482
503
-/* not needed, kept to document functionality */
504
-static void qt2_process_xmit_empty(struct usb_serial_port *port,
505
- unsigned char *ch)
506
-{
507
- int bytes_written;
508
-
509
- bytes_written = (int)(*ch) + (int)(*(ch + 1) << 4);
510
-}
511
-
512
-/* not needed, kept to document functionality */
513
-static void qt2_process_flush(struct usb_serial_port *port, unsigned char *ch)
514
-{
515
- return;
516
-}
517
-
518483 static void qt2_process_read_urb(struct urb *urb)
519484 {
520485 struct usb_serial *serial;
521486 struct qt2_serial_private *serial_priv;
522487 struct usb_serial_port *port;
523
- struct qt2_port_private *port_priv;
524488 bool escapeflag;
525489 unsigned char *ch;
526490 int i;
....@@ -534,7 +498,6 @@
534498 serial = urb->context;
535499 serial_priv = usb_get_serial_data(serial);
536500 port = serial->port[serial_priv->current_port];
537
- port_priv = usb_get_serial_port_data(port);
538501
539502 for (i = 0; i < urb->actual_length; i++) {
540503 ch = (unsigned char *)urb->transfer_buffer + i;
....@@ -562,7 +525,7 @@
562525 __func__);
563526 break;
564527 }
565
- qt2_process_xmit_empty(port, ch + 3);
528
+ /* bytes_written = (ch[1] << 4) + ch[0]; */
566529 i += 4;
567530 escapeflag = true;
568531 break;
....@@ -586,13 +549,11 @@
586549
587550 serial_priv->current_port = newport;
588551 port = serial->port[serial_priv->current_port];
589
- port_priv = usb_get_serial_port_data(port);
590552 i += 3;
591553 escapeflag = true;
592554 break;
593555 case QT2_REC_FLUSH:
594556 case QT2_XMIT_FLUSH:
595
- qt2_process_flush(port, ch + 2);
596557 i += 2;
597558 escapeflag = true;
598559 break;
....@@ -1019,7 +980,7 @@
1019980 .tiocmset = qt2_tiocmset,
1020981 .tiocmiwait = usb_serial_generic_tiocmiwait,
1021982 .get_icount = usb_serial_generic_get_icount,
1022
- .ioctl = qt2_ioctl,
983
+ .get_serial = get_serial_info,
1023984 .set_termios = qt2_set_termios,
1024985 };
1025986