Commit 709280da authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

tty: vt, consw->con_set_palette cleanup

* allow NULL consw->con_set_palette (some consoles define an empty
  hook)
* => remove empty hooks now
* return value of consw->con_set_palette is never checked => make the
  function void
* document consw->con_set_palette a bit
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: linux-usb@vger.kernel.org
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: linux-parisc@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 97293de9
...@@ -3978,7 +3978,7 @@ static void set_palette(struct vc_data *vc) ...@@ -3978,7 +3978,7 @@ static void set_palette(struct vc_data *vc)
{ {
WARN_CONSOLE_UNLOCKED(); WARN_CONSOLE_UNLOCKED();
if (vc->vc_mode != KD_GRAPHICS) if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_set_palette)
vc->vc_sw->con_set_palette(vc, color_table); vc->vc_sw->con_set_palette(vc, color_table);
} }
......
...@@ -595,7 +595,7 @@ sisusbcon_save_screen(struct vc_data *c) ...@@ -595,7 +595,7 @@ sisusbcon_save_screen(struct vc_data *c)
} }
/* interface routine */ /* interface routine */
static int static void
sisusbcon_set_palette(struct vc_data *c, const unsigned char *table) sisusbcon_set_palette(struct vc_data *c, const unsigned char *table)
{ {
struct sisusb_usb_data *sisusb; struct sisusb_usb_data *sisusb;
...@@ -604,17 +604,17 @@ sisusbcon_set_palette(struct vc_data *c, const unsigned char *table) ...@@ -604,17 +604,17 @@ sisusbcon_set_palette(struct vc_data *c, const unsigned char *table)
/* Return value not used by vt */ /* Return value not used by vt */
if (!CON_IS_VISIBLE(c)) if (!CON_IS_VISIBLE(c))
return -EINVAL; return;
sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb) if (!sisusb)
return -EINVAL; return;
/* sisusb->lock is down */ /* sisusb->lock is down */
if (sisusb_is_inactive(c, sisusb)) { if (sisusb_is_inactive(c, sisusb)) {
mutex_unlock(&sisusb->lock); mutex_unlock(&sisusb->lock);
return -EINVAL; return;
} }
for (i = j = 0; i < 16; i++) { for (i = j = 0; i < 16; i++) {
...@@ -629,8 +629,6 @@ sisusbcon_set_palette(struct vc_data *c, const unsigned char *table) ...@@ -629,8 +629,6 @@ sisusbcon_set_palette(struct vc_data *c, const unsigned char *table)
} }
mutex_unlock(&sisusb->lock); mutex_unlock(&sisusb->lock);
return 0;
} }
/* interface routine */ /* interface routine */
...@@ -1428,7 +1426,6 @@ static const struct consw sisusb_dummy_con = { ...@@ -1428,7 +1426,6 @@ static const struct consw sisusb_dummy_con = {
.con_font_get = SISUSBCONDUMMY, .con_font_get = SISUSBCONDUMMY,
.con_font_default = SISUSBCONDUMMY, .con_font_default = SISUSBCONDUMMY,
.con_font_copy = SISUSBCONDUMMY, .con_font_copy = SISUSBCONDUMMY,
.con_set_palette = SISUSBCONDUMMY,
}; };
int int
......
...@@ -71,6 +71,5 @@ const struct consw dummy_con = { ...@@ -71,6 +71,5 @@ const struct consw dummy_con = {
.con_font_get = DUMMY, .con_font_get = DUMMY,
.con_font_default = DUMMY, .con_font_default = DUMMY,
.con_font_copy = DUMMY, .con_font_copy = DUMMY,
.con_set_palette = DUMMY,
}; };
EXPORT_SYMBOL_GPL(dummy_con); EXPORT_SYMBOL_GPL(dummy_con);
...@@ -170,7 +170,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, ...@@ -170,7 +170,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
int height, int width); int height, int width);
static int fbcon_switch(struct vc_data *vc); static int fbcon_switch(struct vc_data *vc);
static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch); static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch);
static int fbcon_set_palette(struct vc_data *vc, const unsigned char *table); static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
/* /*
* Internal routines * Internal routines
...@@ -2651,17 +2651,17 @@ static struct fb_cmap palette_cmap = { ...@@ -2651,17 +2651,17 @@ static struct fb_cmap palette_cmap = {
0, 16, palette_red, palette_green, palette_blue, NULL 0, 16, palette_red, palette_green, palette_blue, NULL
}; };
static int fbcon_set_palette(struct vc_data *vc, const unsigned char *table) static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
{ {
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
int i, j, k, depth; int i, j, k, depth;
u8 val; u8 val;
if (fbcon_is_inactive(vc, info)) if (fbcon_is_inactive(vc, info))
return -EINVAL; return;
if (!CON_IS_VISIBLE(vc)) if (!CON_IS_VISIBLE(vc))
return 0; return;
depth = fb_get_color_depth(&info->var, &info->fix); depth = fb_get_color_depth(&info->var, &info->fix);
if (depth > 3) { if (depth > 3) {
...@@ -2683,7 +2683,7 @@ static int fbcon_set_palette(struct vc_data *vc, const unsigned char *table) ...@@ -2683,7 +2683,7 @@ static int fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
} else } else
fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap); fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
return fb_set_cmap(&palette_cmap, info); fb_set_cmap(&palette_cmap, info);
} }
static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
......
...@@ -481,11 +481,6 @@ static int mdacon_switch(struct vc_data *c) ...@@ -481,11 +481,6 @@ static int mdacon_switch(struct vc_data *c)
return 1; /* redrawing needed */ return 1; /* redrawing needed */
} }
static int mdacon_set_palette(struct vc_data *c, const unsigned char *table)
{
return -EINVAL;
}
static int mdacon_blank(struct vc_data *c, int blank, int mode_switch) static int mdacon_blank(struct vc_data *c, int blank, int mode_switch)
{ {
if (mda_type == TYPE_MDA) { if (mda_type == TYPE_MDA) {
...@@ -572,7 +567,6 @@ static const struct consw mda_con = { ...@@ -572,7 +567,6 @@ static const struct consw mda_con = {
.con_bmove = mdacon_bmove, .con_bmove = mdacon_bmove,
.con_switch = mdacon_switch, .con_switch = mdacon_switch,
.con_blank = mdacon_blank, .con_blank = mdacon_blank,
.con_set_palette = mdacon_set_palette,
.con_build_attr = mdacon_build_attr, .con_build_attr = mdacon_build_attr,
.con_invert_region = mdacon_invert_region, .con_invert_region = mdacon_invert_region,
}; };
......
...@@ -574,11 +574,6 @@ static int newport_font_set(struct vc_data *vc, struct console_font *font, unsig ...@@ -574,11 +574,6 @@ static int newport_font_set(struct vc_data *vc, struct console_font *font, unsig
return newport_set_font(vc->vc_num, font); return newport_set_font(vc->vc_num, font);
} }
static int newport_set_palette(struct vc_data *vc, const unsigned char *table)
{
return -EINVAL;
}
static int newport_scroll(struct vc_data *vc, int t, int b, int dir, static int newport_scroll(struct vc_data *vc, int t, int b, int dir,
int lines) int lines)
{ {
...@@ -728,7 +723,6 @@ const struct consw newport_con = { ...@@ -728,7 +723,6 @@ const struct consw newport_con = {
.con_blank = newport_blank, .con_blank = newport_blank,
.con_font_set = newport_font_set, .con_font_set = newport_font_set,
.con_font_default = newport_font_default, .con_font_default = newport_font_default,
.con_set_palette = newport_set_palette,
.con_set_origin = DUMMY, .con_set_origin = DUMMY,
.con_save_screen = DUMMY .con_save_screen = DUMMY
}; };
......
...@@ -79,11 +79,6 @@ static const char *sticon_startup(void) ...@@ -79,11 +79,6 @@ static const char *sticon_startup(void)
return "STI console"; return "STI console";
} }
static int sticon_set_palette(struct vc_data *c, const unsigned char *table)
{
return -EINVAL;
}
static void sticon_putc(struct vc_data *conp, int c, int ypos, int xpos) static void sticon_putc(struct vc_data *conp, int c, int ypos, int xpos)
{ {
int redraw_cursor = 0; int redraw_cursor = 0;
...@@ -353,7 +348,6 @@ static const struct consw sti_con = { ...@@ -353,7 +348,6 @@ static const struct consw sti_con = {
.con_bmove = sticon_bmove, .con_bmove = sticon_bmove,
.con_switch = sticon_switch, .con_switch = sticon_switch,
.con_blank = sticon_blank, .con_blank = sticon_blank,
.con_set_palette = sticon_set_palette,
.con_set_origin = sticon_set_origin, .con_set_origin = sticon_set_origin,
.con_save_screen = sticon_save_screen, .con_save_screen = sticon_save_screen,
.con_build_attr = sticon_build_attr, .con_build_attr = sticon_build_attr,
......
...@@ -856,16 +856,13 @@ static void vga_set_palette(struct vc_data *vc, const unsigned char *table) ...@@ -856,16 +856,13 @@ static void vga_set_palette(struct vc_data *vc, const unsigned char *table)
} }
} }
static int vgacon_set_palette(struct vc_data *vc, const unsigned char *table) static void vgacon_set_palette(struct vc_data *vc, const unsigned char *table)
{ {
#ifdef CAN_LOAD_PALETTE #ifdef CAN_LOAD_PALETTE
if (vga_video_type != VIDEO_TYPE_VGAC || vga_palette_blanked if (vga_video_type != VIDEO_TYPE_VGAC || vga_palette_blanked
|| !CON_IS_VISIBLE(vc)) || !CON_IS_VISIBLE(vc))
return -EINVAL; return;
vga_set_palette(vc, table); vga_set_palette(vc, table);
return 0;
#else
return -EINVAL;
#endif #endif
} }
......
...@@ -31,6 +31,7 @@ struct tty_struct; ...@@ -31,6 +31,7 @@ struct tty_struct;
/** /**
* struct consw - callbacks for consoles * struct consw - callbacks for consoles
* *
* @con_set_palette: sets the palette of the console to @table (optional)
* @con_scrolldelta: the contents of the console should be scrolled by @lines. * @con_scrolldelta: the contents of the console should be scrolled by @lines.
* Invoked by user. (optional) * Invoked by user. (optional)
*/ */
...@@ -53,7 +54,8 @@ struct consw { ...@@ -53,7 +54,8 @@ struct consw {
int (*con_font_copy)(struct vc_data *, int); int (*con_font_copy)(struct vc_data *, int);
int (*con_resize)(struct vc_data *, unsigned int, unsigned int, int (*con_resize)(struct vc_data *, unsigned int, unsigned int,
unsigned int); unsigned int);
int (*con_set_palette)(struct vc_data *, const unsigned char *); void (*con_set_palette)(struct vc_data *,
const unsigned char *table);
void (*con_scrolldelta)(struct vc_data *, int lines); void (*con_scrolldelta)(struct vc_data *, int lines);
int (*con_set_origin)(struct vc_data *); int (*con_set_origin)(struct vc_data *);
void (*con_save_screen)(struct vc_data *); void (*con_save_screen)(struct vc_data *);
......
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