summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/char/vt.c17
-rw-r--r--drivers/video/console/fbcon.c23
-rw-r--r--drivers/video/console/newport_con.c6
-rw-r--r--include/linux/console.h3
-rw-r--r--include/linux/kd.h6
5 files changed, 37 insertions, 18 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 12db83db68bc..578c24115e12 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -100,6 +100,7 @@
#include <linux/workqueue.h>
#include <linux/bootmem.h>
#include <linux/pm.h>
+#include <linux/font.h>
#include <asm/io.h>
#include <asm/system.h>
@@ -3139,17 +3140,31 @@ out:
int con_font_default(int currcons, struct console_font_op *op)
{
+ struct console_font font = {.width = op->width, .height = op->height};
+ char name[MAX_FONT_NAME];
+ char *s = name;
int rc;
if (vt_cons[currcons]->vc_mode != KD_TEXT)
return -EINVAL;
+ if (!op->data)
+ s = NULL;
+ else if (strncpy_from_user(name, op->data, MAX_FONT_NAME - 1) < 0)
+ return -EFAULT;
+ else
+ name[MAX_FONT_NAME - 1] = 0;
+
acquire_console_sem();
if (sw->con_font_default)
- rc = sw->con_font_default(vc_cons[currcons].d, op);
+ rc = sw->con_font_default(vc_cons[currcons].d, &font, s);
else
rc = -ENOSYS;
release_console_sem();
+ if (!rc) {
+ op->width = font.width;
+ op->height = font.height;
+ }
return rc;
}
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 42727f9d32bc..933753994ac1 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -2272,24 +2272,21 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font_op *op)
return fbcon_do_set_font(vc, op, new_data, 1);
}
-static int fbcon_set_def_font(struct vc_data *vc, struct console_font_op *op)
+static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, char *name)
{
struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
- char name[MAX_FONT_NAME];
struct font_desc *f;
+ struct console_font_op crap;
- if (!op->data)
+ if (!name)
f = get_default_font(info->var.xres, info->var.yres);
- else if (strncpy_from_user(name, op->data, MAX_FONT_NAME - 1) < 0)
- return -EFAULT;
- else {
- name[MAX_FONT_NAME - 1] = 0;
- if (!(f = find_font(name)))
- return -ENOENT;
- }
- op->width = f->width;
- op->height = f->height;
- return fbcon_do_set_font(vc, op, f->data, 0);
+ else if (!(f = find_font(name)))
+ return -ENOENT;
+
+ crap.op = KD_FONT_OP_SET_DEFAULT;
+ crap.width = font->width = f->width;
+ crap.height = font->height = f->height;
+ return fbcon_do_set_font(vc, &crap, f->data, 0);
}
static u16 palette_red[16];
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
index bf566efd038f..ad59eed1793e 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -52,7 +52,7 @@ static int xcurs_correction = 29;
static int newport_xsize;
static int newport_ysize;
-static int newport_set_def_font(int unit, struct console_font_op *op);
+static int newport_set_def_font(int unit, struct console_font *op);
#define BMASK(c) (c << 24)
@@ -531,7 +531,7 @@ static int newport_set_font(int unit, struct console_font_op *op)
return 0;
}
-static int newport_set_def_font(int unit, struct console_font_op *op)
+static int newport_set_def_font(int unit, struct console_font *op)
{
if (font_data[unit] != FONT_DATA) {
if (--REFCOUNT(font_data[unit]) == 0)
@@ -543,7 +543,7 @@ static int newport_set_def_font(int unit, struct console_font_op *op)
return 0;
}
-static int newport_font_default(struct vc_data *vc, struct console_font_op *op)
+static int newport_font_default(struct vc_data *vc, struct console_font *op, char *name)
{
return newport_set_def_font(vc->vc_num, op);
}
diff --git a/include/linux/console.h b/include/linux/console.h
index 357e7711f08e..56f907bff455 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -19,6 +19,7 @@
struct vc_data;
struct console_font_op;
+struct console_font;
struct module;
/*
@@ -42,7 +43,7 @@ struct consw {
int (*con_blank)(struct vc_data *, int, int);
int (*con_font_set)(struct vc_data *, struct console_font_op *);
int (*con_font_get)(struct vc_data *, struct console_font_op *);
- int (*con_font_default)(struct vc_data *, struct console_font_op *);
+ int (*con_font_default)(struct vc_data *, struct console_font *, char *);
int (*con_font_copy)(struct vc_data *, struct console_font_op *);
int (*con_resize)(struct vc_data *, unsigned int, unsigned int);
int (*con_set_palette)(struct vc_data *, unsigned char *);
diff --git a/include/linux/kd.h b/include/linux/kd.h
index f8c48b497533..834885b8da63 100644
--- a/include/linux/kd.h
+++ b/include/linux/kd.h
@@ -152,6 +152,12 @@ struct console_font_op {
unsigned char *data; /* font data with height fixed to 32 */
};
+struct console_font {
+ unsigned int width, height; /* font size */
+ unsigned int charcount;
+ unsigned char *data; /* font data with height fixed to 32 */
+};
+
#define KD_FONT_OP_SET 0 /* Set font */
#define KD_FONT_OP_GET 1 /* Get font */
#define KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */