Commit 2f4516db authored by Jan Beulich's avatar Jan Beulich Committed by Linus Torvalds

[PATCH] fbcon: constify font data

const-ify the font control structures and data, to make somewhat better
guarantees that these are not modified anywhere in the kernel.
Specifically for a kernel debugger to share this information from the
normal kernel code, such a guarantee seems rather desirable.
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
Cc: "Antonino A. Daplas" <adaplas@hotpop.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e703ecc3
......@@ -767,7 +767,7 @@ static const char *fbcon_startup(void)
const char *display_desc = "frame buffer device";
struct display *p = &fb_display[fg_console];
struct vc_data *vc = vc_cons[fg_console].d;
struct font_desc *font = NULL;
const struct font_desc *font = NULL;
struct module *owner;
struct fb_info *info = NULL;
struct fbcon_ops *ops;
......@@ -841,7 +841,7 @@ static const char *fbcon_startup(void)
info->var.yres);
vc->vc_font.width = font->width;
vc->vc_font.height = font->height;
vc->vc_font.data = p->fontdata = font->data;
vc->vc_font.data = (void *)(p->fontdata = font->data);
vc->vc_font.charcount = 256; /* FIXME Need to support more fonts */
}
......@@ -941,7 +941,7 @@ static void fbcon_init(struct vc_data *vc, int init)
fb, copy the font from that console */
t = &fb_display[svc->vc_num];
if (!vc->vc_font.data) {
vc->vc_font.data = p->fontdata = t->fontdata;
vc->vc_font.data = (void *)(p->fontdata = t->fontdata);
vc->vc_font.width = (*default_mode)->vc_font.width;
vc->vc_font.height = (*default_mode)->vc_font.height;
p->userfont = t->userfont;
......@@ -1188,7 +1188,7 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
return;
t = &fb_display[svc->vc_num];
if (!vc->vc_font.data) {
vc->vc_font.data = p->fontdata = t->fontdata;
vc->vc_font.data = (void *)(p->fontdata = t->fontdata);
vc->vc_font.width = (*default_mode)->vc_font.width;
vc->vc_font.height = (*default_mode)->vc_font.height;
p->userfont = t->userfont;
......@@ -2150,7 +2150,7 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
}
static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
u8 * data, int userfont)
const u8 * data, int userfont)
{
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
struct display *p = &fb_display[vc->vc_num];
......@@ -2168,7 +2168,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
cnt = FNTCHARCNT(data);
else
cnt = 256;
vc->vc_font.data = p->fontdata = data;
vc->vc_font.data = (void *)(p->fontdata = data);
if ((p->userfont = userfont))
REFCOUNT(data)++;
vc->vc_font.width = w;
......@@ -2325,7 +2325,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
tmp->vc_font.width == w &&
!memcmp(fb_display[i].fontdata, new_data, size)) {
kfree(new_data - FONT_EXTRA_WORDS * sizeof(int));
new_data = fb_display[i].fontdata;
new_data = (u8 *)fb_display[i].fontdata;
break;
}
}
......@@ -2335,7 +2335,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, char *name)
{
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
struct font_desc *f;
const struct font_desc *f;
if (!name)
f = get_default_font(info->var.xres, info->var.yres);
......
......@@ -30,7 +30,7 @@ struct display {
/* Filled in by the frame buffer device */
u_short inverse; /* != 0 text black on white as default */
/* Filled in by the low-level console driver */
u_char *fontdata;
const u_char *fontdata;
int userfont; /* != 0 if fontdata kmalloc()ed */
u_short scrollmode; /* Scroll Method */
short yscroll; /* Hardware scrolling */
......
......@@ -7,7 +7,7 @@
#define FONTDATAMAX 9216
static unsigned char fontdata_10x18[FONTDATAMAX] = {
static const unsigned char fontdata_10x18[FONTDATAMAX] = {
/* 0 0x00 '^@' */
0x00, 0x00, /* 0000000000 */
......@@ -5132,7 +5132,7 @@ static unsigned char fontdata_10x18[FONTDATAMAX] = {
};
struct font_desc font_10x18 = {
const struct font_desc font_10x18 = {
FONT10x18_IDX,
"10x18",
10,
......
......@@ -8,7 +8,7 @@
#define FONTDATAMAX (11*256)
static unsigned char fontdata_6x11[FONTDATAMAX] = {
static const unsigned char fontdata_6x11[FONTDATAMAX] = {
/* 0 0x00 '^@' */
0x00, /* 00000000 */
......@@ -3341,7 +3341,7 @@ static unsigned char fontdata_6x11[FONTDATAMAX] = {
};
struct font_desc font_vga_6x11 = {
const struct font_desc font_vga_6x11 = {
VGA6x11_IDX,
"ProFont6x11",
6,
......
......@@ -7,7 +7,7 @@
#define FONTDATAMAX 3584
static unsigned char fontdata_7x14[FONTDATAMAX] = {
static const unsigned char fontdata_7x14[FONTDATAMAX] = {
/* 0 0x00 '^@' */
0x00, /* 0000000 */
......@@ -4108,7 +4108,7 @@ static unsigned char fontdata_7x14[FONTDATAMAX] = {
};
struct font_desc font_7x14 = {
const struct font_desc font_7x14 = {
FONT7x14_IDX,
"7x14",
7,
......
......@@ -8,7 +8,7 @@
#define FONTDATAMAX 4096
static unsigned char fontdata_8x16[FONTDATAMAX] = {
static const unsigned char fontdata_8x16[FONTDATAMAX] = {
/* 0 0x00 '^@' */
0x00, /* 00000000 */
......@@ -4621,7 +4621,7 @@ static unsigned char fontdata_8x16[FONTDATAMAX] = {
};
struct font_desc font_vga_8x16 = {
const struct font_desc font_vga_8x16 = {
VGA8x16_IDX,
"VGA8x16",
8,
......
......@@ -8,7 +8,7 @@
#define FONTDATAMAX 2048
static unsigned char fontdata_8x8[FONTDATAMAX] = {
static const unsigned char fontdata_8x8[FONTDATAMAX] = {
/* 0 0x00 '^@' */
0x00, /* 00000000 */
......@@ -2573,7 +2573,7 @@ static unsigned char fontdata_8x8[FONTDATAMAX] = {
};
struct font_desc font_vga_8x8 = {
const struct font_desc font_vga_8x8 = {
VGA8x8_IDX,
"VGA8x8",
8,
......
......@@ -3,7 +3,7 @@
#include <linux/config.h>
#include <linux/font.h>
static unsigned char acorndata_8x8[] = {
static const unsigned char acorndata_8x8[] = {
/* 00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */
/* 01 */ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */
/* 02 */ 0x7e, 0xff, 0xbd, 0xff, 0xc3, 0xe7, 0xff, 0x7e, /* ^B */
......@@ -262,7 +262,7 @@ static unsigned char acorndata_8x8[] = {
/* FF */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
struct font_desc font_acorn_8x8 = {
const struct font_desc font_acorn_8x8 = {
ACORN8x8_IDX,
"Acorn8x8",
8,
......
......@@ -43,7 +43,7 @@ __END__;
#define FONTDATAMAX 1536
static unsigned char fontdata_mini_4x6[FONTDATAMAX] = {
static const unsigned char fontdata_mini_4x6[FONTDATAMAX] = {
/*{*/
/* Char 0: ' ' */
......@@ -2147,7 +2147,7 @@ static unsigned char fontdata_mini_4x6[FONTDATAMAX] = {
/*}*/
};
struct font_desc font_mini_4x6 = {
const struct font_desc font_mini_4x6 = {
MINI4x6_IDX,
"MINI4x6",
4,
......
......@@ -13,7 +13,7 @@
#define FONTDATAMAX 2048
static unsigned char fontdata_pearl8x8[FONTDATAMAX] = {
static const unsigned char fontdata_pearl8x8[FONTDATAMAX] = {
/* 0 0x00 '^@' */
0x00, /* 00000000 */
......@@ -2577,7 +2577,7 @@ static unsigned char fontdata_pearl8x8[FONTDATAMAX] = {
};
struct font_desc font_pearl_8x8 = {
const struct font_desc font_pearl_8x8 = {
PEARL8x8_IDX,
"PEARL8x8",
8,
......
......@@ -2,7 +2,7 @@
#define FONTDATAMAX 11264
static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
static const unsigned char fontdata_sun12x22[FONTDATAMAX] = {
/* 0 0x00 '^@' */
0x00, 0x00, /* 000000000000 */
......@@ -6151,7 +6151,7 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
};
struct font_desc font_sun_12x22 = {
const struct font_desc font_sun_12x22 = {
SUN12x22_IDX,
"SUN12x22",
12,
......
......@@ -2,7 +2,7 @@
#define FONTDATAMAX 4096
static unsigned char fontdata_sun8x16[FONTDATAMAX] = {
static const unsigned char fontdata_sun8x16[FONTDATAMAX] = {
/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00,
/* */ 0x00,0x00,0x7e,0xff,0xdb,0xff,0xff,0xc3,0xe7,0xff,0xff,0x7e,0x00,0x00,0x00,0x00,
......@@ -261,7 +261,7 @@ static unsigned char fontdata_sun8x16[FONTDATAMAX] = {
/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
struct font_desc font_sun_8x16 = {
const struct font_desc font_sun_8x16 = {
SUN8x16_IDX,
"SUN8x16",
8,
......
......@@ -23,7 +23,7 @@
#define NO_FONTS
static struct font_desc *fonts[] = {
static const struct font_desc *fonts[] = {
#ifdef CONFIG_FONT_8x8
#undef NO_FONTS
&font_vga_8x8,
......@@ -84,7 +84,7 @@ static struct font_desc *fonts[] = {
*
*/
struct font_desc *find_font(char *name)
const struct font_desc *find_font(const char *name)
{
unsigned int i;
......@@ -108,10 +108,10 @@ struct font_desc *find_font(char *name)
*
*/
struct font_desc *get_default_font(int xres, int yres)
const struct font_desc *get_default_font(int xres, int yres)
{
int i, c, cc;
struct font_desc *f, *g;
const struct font_desc *f, *g;
g = NULL;
cc = -10000;
......@@ -138,7 +138,6 @@ struct font_desc *get_default_font(int xres, int yres)
return g;
}
EXPORT_SYMBOL(fonts);
EXPORT_SYMBOL(find_font);
EXPORT_SYMBOL(get_default_font);
......
......@@ -619,7 +619,7 @@ struct fb_tilemap {
__u32 height; /* height of each tile in scanlines */
__u32 depth; /* color depth of each tile */
__u32 length; /* number of tiles in the map */
__u8 *data; /* actual tile map: a bitmap array, packed
const __u8 *data; /* actual tile map: a bitmap array, packed
to the nearest byte */
};
......
......@@ -15,9 +15,9 @@
struct font_desc {
int idx;
char *name;
const char *name;
int width, height;
void *data;
const void *data;
int pref;
};
......@@ -32,7 +32,7 @@ struct font_desc {
#define ACORN8x8_IDX 8
#define MINI4x6_IDX 9
extern struct font_desc font_vga_8x8,
extern const struct font_desc font_vga_8x8,
font_vga_8x16,
font_pearl_8x8,
font_vga_6x11,
......@@ -45,11 +45,11 @@ extern struct font_desc font_vga_8x8,
/* Find a font with a specific name */
extern struct font_desc *find_font(char *name);
extern const struct font_desc *find_font(const char *name);
/* Get the default font for a specific screen size */
extern struct font_desc *get_default_font(int xres, int yres);
extern const struct font_desc *get_default_font(int xres, int yres);
/* Max. length for the name of a predefined font */
#define MAX_FONT_NAME 32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment