summaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt/vt_ioctl.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2020-06-15 09:49:02 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-24 17:08:34 +0200
commiteca734d8f0043e9597c9426f829d48c381dbb388 (patch)
tree485daee93b897a9db855b5df9056b3db60fadbab /drivers/tty/vt/vt_ioctl.c
parent0ce8179e248023606980823d970252e715f9f504 (diff)
downloadlinux-eca734d8f0043e9597c9426f829d48c381dbb388.tar.bz2
vt_ioctl: eliminate use of uival and ucval
They were used for the first parameter of put_user. But put_user accepts constants in the parameter and also determines the type only by the second parameter. So we can safely drop these helpers and simplify the code a bit. Including the removal of set_int label. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200615074910.19267-30-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt/vt_ioctl.c')
-rw-r--r--drivers/tty/vt/vt_ioctl.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index 87fe088c3eb4..911edd8d1272 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -353,8 +353,6 @@ int vt_ioctl(struct tty_struct *tty,
struct vc_data *vc = tty->driver_data;
struct console_font_op op; /* used in multiple places here */
unsigned int console = vc->vc_num;
- unsigned char ucval;
- unsigned int uival;
void __user *up = (void __user *)arg;
int i, perm;
int ret;
@@ -406,8 +404,7 @@ int vt_ioctl(struct tty_struct *tty,
/*
* this is naïve.
*/
- ucval = KB_101;
- return put_user(ucval, (char __user *)arg);
+ return put_user(KB_101, (char __user *)arg);
/*
* These cannot be implemented on any machine that implements
@@ -495,8 +492,7 @@ int vt_ioctl(struct tty_struct *tty,
break;
case KDGETMODE:
- uival = vc->vc_mode;
- goto setint;
+ return put_user(vc->vc_mode, (int __user *)arg);
case KDMAPDISP:
case KDUNMAPDISP:
@@ -516,8 +512,7 @@ int vt_ioctl(struct tty_struct *tty,
break;
case KDGKBMODE:
- uival = vt_do_kdgkbmode(console);
- return put_user(uival, (int __user *)arg);
+ return put_user(vt_do_kdgkbmode(console), (int __user *)arg);
/* this could be folded into KDSKBMODE, but for compatibility
reasons it is not so easy to fold KDGKBMETA into KDGKBMODE */
@@ -526,9 +521,7 @@ int vt_ioctl(struct tty_struct *tty,
case KDGKBMETA:
/* FIXME: should review whether this is worth locking */
- uival = vt_do_kdgkbmeta(console);
- setint:
- return put_user(uival, (int __user *)arg);
+ return put_user(vt_do_kdgkbmeta(console), (int __user *)arg);
case KDGETKEYCODE:
case KDSETKEYCODE:
@@ -650,8 +643,8 @@ int vt_ioctl(struct tty_struct *tty,
if (!vt_in_use(i))
break;
console_unlock();
- uival = i < MAX_NR_CONSOLES ? (i+1) : -1;
- goto setint;
+ i = i < MAX_NR_CONSOLES ? (i+1) : -1;
+ return put_user(i, (int __user *)arg);
/*
* ioctl(fd, VT_ACTIVATE, num) will cause us to switch to vt # num,