mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-08 23:55:14 +00:00
vt_ioctl: move vt_io_fontreset out of vt_io_ioctl
This also eliminates the ifdeffery by using if and __is_defined. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200615074910.19267-36-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5422337d56
commit
7a0ac4b17f
1 changed files with 26 additions and 18 deletions
|
@ -518,6 +518,31 @@ static inline int do_fontx_ioctl(int cmd,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vt_io_fontreset(struct console_font_op *op)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (__is_defined(BROKEN_GRAPHICS_PROGRAMS)) {
|
||||||
|
/*
|
||||||
|
* With BROKEN_GRAPHICS_PROGRAMS defined, the default font is
|
||||||
|
* not saved.
|
||||||
|
*/
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
op->op = KD_FONT_OP_SET_DEFAULT;
|
||||||
|
op->data = NULL;
|
||||||
|
ret = con_font_op(vc_cons[fg_console].d, op);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
console_lock();
|
||||||
|
con_set_default_unimap(vc_cons[fg_console].d);
|
||||||
|
console_unlock();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud,
|
static inline int do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud,
|
||||||
int perm, struct vc_data *vc)
|
int perm, struct vc_data *vc)
|
||||||
{
|
{
|
||||||
|
@ -581,24 +606,7 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up,
|
||||||
if (!perm)
|
if (!perm)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
#ifdef BROKEN_GRAPHICS_PROGRAMS
|
return vt_io_fontreset(&op);
|
||||||
/* With BROKEN_GRAPHICS_PROGRAMS defined, the default
|
|
||||||
font is not saved. */
|
|
||||||
return -ENOSYS;
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
op.op = KD_FONT_OP_SET_DEFAULT;
|
|
||||||
op.data = NULL;
|
|
||||||
ret = con_font_op(vc_cons[fg_console].d, &op);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
console_lock();
|
|
||||||
con_set_default_unimap(vc_cons[fg_console].d);
|
|
||||||
console_unlock();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case PIO_SCRNMAP:
|
case PIO_SCRNMAP:
|
||||||
if (!perm)
|
if (!perm)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue