forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/tty/tty_ioctl.c
....@@ -443,51 +443,6 @@
443443 return 0;
444444 }
445445
446
-
447
-#ifdef TCGETX
448
-
449
-/**
450
- * set_termiox - set termiox fields if possible
451
- * @tty: terminal
452
- * @arg: termiox structure from user
453
- * @opt: option flags for ioctl type
454
- *
455
- * Implement the device calling points for the SYS5 termiox ioctl
456
- * interface in Linux
457
- */
458
-
459
-static int set_termiox(struct tty_struct *tty, void __user *arg, int opt)
460
-{
461
- struct termiox tnew;
462
- struct tty_ldisc *ld;
463
-
464
- if (tty->termiox == NULL)
465
- return -EINVAL;
466
- if (copy_from_user(&tnew, arg, sizeof(struct termiox)))
467
- return -EFAULT;
468
-
469
- ld = tty_ldisc_ref(tty);
470
- if (ld != NULL) {
471
- if ((opt & TERMIOS_FLUSH) && ld->ops->flush_buffer)
472
- ld->ops->flush_buffer(tty);
473
- tty_ldisc_deref(ld);
474
- }
475
- if (opt & TERMIOS_WAIT) {
476
- tty_wait_until_sent(tty, 0);
477
- if (signal_pending(current))
478
- return -ERESTARTSYS;
479
- }
480
-
481
- down_write(&tty->termios_rwsem);
482
- if (tty->ops->set_termiox)
483
- tty->ops->set_termiox(tty, &tnew);
484
- up_write(&tty->termios_rwsem);
485
- return 0;
486
-}
487
-
488
-#endif
489
-
490
-
491446 #ifdef TIOCGETP
492447 /*
493448 * These are deprecated, but there is limited support..
....@@ -815,24 +770,12 @@
815770 return ret;
816771 #endif
817772 #ifdef TCGETX
818
- case TCGETX: {
819
- struct termiox ktermx;
820
- if (real_tty->termiox == NULL)
821
- return -EINVAL;
822
- down_read(&real_tty->termios_rwsem);
823
- memcpy(&ktermx, real_tty->termiox, sizeof(struct termiox));
824
- up_read(&real_tty->termios_rwsem);
825
- if (copy_to_user(p, &ktermx, sizeof(struct termiox)))
826
- ret = -EFAULT;
827
- return ret;
828
- }
773
+ case TCGETX:
829774 case TCSETX:
830
- return set_termiox(real_tty, p, 0);
831775 case TCSETXW:
832
- return set_termiox(real_tty, p, TERMIOS_WAIT);
833776 case TCSETXF:
834
- return set_termiox(real_tty, p, TERMIOS_FLUSH);
835
-#endif
777
+ return -ENOTTY;
778
+#endif
836779 case TIOCGSOFTCAR:
837780 copy_termios(real_tty, &kterm);
838781 ret = put_user((kterm.c_cflag & CLOCAL) ? 1 : 0,
....@@ -866,7 +809,7 @@
866809 ld->ops->flush_buffer(tty);
867810 tty_unthrottle(tty);
868811 }
869
- /* fall through */
812
+ fallthrough;
870813 case TCOFLUSH:
871814 tty_driver_flush_buffer(tty);
872815 break;
....@@ -941,19 +884,3 @@
941884 }
942885 }
943886 EXPORT_SYMBOL(n_tty_ioctl_helper);
944
-
945
-#ifdef CONFIG_COMPAT
946
-long n_tty_compat_ioctl_helper(struct tty_struct *tty, struct file *file,
947
- unsigned int cmd, unsigned long arg)
948
-{
949
- switch (cmd) {
950
- case TIOCGLCKTRMIOS:
951
- case TIOCSLCKTRMIOS:
952
- return tty_mode_ioctl(tty, file, cmd, (unsigned long) compat_ptr(arg));
953
- default:
954
- return -ENOIOCTLCMD;
955
- }
956
-}
957
-EXPORT_SYMBOL(n_tty_compat_ioctl_helper);
958
-#endif
959
-