aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2005-11-07 04:00:36 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:50 -0500
commit4d9c5b6eb42d9e235003dd4531b44462a77131ea (patch)
tree5e851412d612bd143d378db1ceb1a87da3b31a56 /drivers
parentc465e05a03209651078b95686158648fd7ed84c5 (diff)
[PATCH] fbcon: Consolidate redundant code
Lot's of redundant code scattered throughout fbcon.c. Consolidate them all into one function, fbcon_update_softback(). Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/console/fbcon.c85
1 files changed, 23 insertions, 62 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 0fc8bb499c3f..188053eafc69 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -281,6 +281,18 @@ static inline int get_color(struct vc_data *vc, struct fb_info *info,
281 return color; 281 return color;
282} 282}
283 283
284static void fbcon_update_softback(struct vc_data *vc)
285{
286 int l = fbcon_softback_size / vc->vc_size_row;
287
288 if (l > 5)
289 softback_end = softback_buf + l * vc->vc_size_row;
290 else
291 /* Smaller scrollback makes no sense, and 0 would screw
292 the operation totally */
293 softback_top = 0;
294}
295
284static void fb_flashcursor(void *private) 296static void fb_flashcursor(void *private)
285{ 297{
286 struct fb_info *info = private; 298 struct fb_info *info = private;
@@ -1007,16 +1019,8 @@ static void fbcon_init(struct vc_data *vc, int init)
1007 if (logo) 1019 if (logo)
1008 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); 1020 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows);
1009 1021
1010 if (vc == svc && softback_buf) { 1022 if (vc == svc && softback_buf)
1011 int l = fbcon_softback_size / vc->vc_size_row; 1023 fbcon_update_softback(vc);
1012 if (l > 5)
1013 softback_end = softback_buf + l * vc->vc_size_row;
1014 else {
1015 /* Smaller scrollback makes no sense, and 0 would screw
1016 the operation totally */
1017 softback_top = 0;
1018 }
1019 }
1020} 1024}
1021 1025
1022static void fbcon_deinit(struct vc_data *vc) 1026static void fbcon_deinit(struct vc_data *vc)
@@ -1223,18 +1227,8 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
1223 vc_resize(vc, cols, rows); 1227 vc_resize(vc, cols, rows);
1224 if (CON_IS_VISIBLE(vc)) { 1228 if (CON_IS_VISIBLE(vc)) {
1225 update_screen(vc); 1229 update_screen(vc);
1226 if (softback_buf) { 1230 if (softback_buf)
1227 int l = fbcon_softback_size / vc->vc_size_row; 1231 fbcon_update_softback(vc);
1228
1229 if (l > 5)
1230 softback_end = softback_buf + l *
1231 vc->vc_size_row;
1232 else {
1233 /* Smaller scrollback makes no sense, and 0
1234 would screw the operation totally */
1235 softback_top = 0;
1236 }
1237 }
1238 } 1232 }
1239} 1233}
1240 1234
@@ -1933,19 +1927,11 @@ static int fbcon_switch(struct vc_data *vc)
1933 info = registered_fb[con2fb_map[vc->vc_num]]; 1927 info = registered_fb[con2fb_map[vc->vc_num]];
1934 1928
1935 if (softback_top) { 1929 if (softback_top) {
1936 int l = fbcon_softback_size / vc->vc_size_row;
1937 if (softback_lines) 1930 if (softback_lines)
1938 fbcon_set_origin(vc); 1931 fbcon_set_origin(vc);
1939 softback_top = softback_curr = softback_in = softback_buf; 1932 softback_top = softback_curr = softback_in = softback_buf;
1940 softback_lines = 0; 1933 softback_lines = 0;
1941 1934 fbcon_update_softback(vc);
1942 if (l > 5)
1943 softback_end = softback_buf + l * vc->vc_size_row;
1944 else {
1945 /* Smaller scrollback makes no sense, and 0 would screw
1946 the operation totally */
1947 softback_top = 0;
1948 }
1949 } 1935 }
1950 1936
1951 if (logo_shown >= 0) { 1937 if (logo_shown >= 0) {
@@ -2235,17 +2221,8 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
2235 /* reset wrap/pan */ 2221 /* reset wrap/pan */
2236 info->var.xoffset = info->var.yoffset = p->yscroll = 0; 2222 info->var.xoffset = info->var.yoffset = p->yscroll = 0;
2237 vc_resize(vc, info->var.xres / w, info->var.yres / h); 2223 vc_resize(vc, info->var.xres / w, info->var.yres / h);
2238 if (CON_IS_VISIBLE(vc) && softback_buf) { 2224 if (CON_IS_VISIBLE(vc) && softback_buf)
2239 int l = fbcon_softback_size / vc->vc_size_row; 2225 fbcon_update_softback(vc);
2240 if (l > 5)
2241 softback_end =
2242 softback_buf + l * vc->vc_size_row;
2243 else {
2244 /* Smaller scrollback makes no sense, and 0 would screw
2245 the operation totally */
2246 softback_top = 0;
2247 }
2248 }
2249 } else if (CON_IS_VISIBLE(vc) 2226 } else if (CON_IS_VISIBLE(vc)
2250 && vc->vc_mode == KD_TEXT) { 2227 && vc->vc_mode == KD_TEXT) {
2251 fbcon_clear_margins(vc, 0); 2228 fbcon_clear_margins(vc, 0);
@@ -2615,16 +2592,8 @@ static void fbcon_modechanged(struct fb_info *info)
2615 update_var(vc->vc_num, info); 2592 update_var(vc->vc_num, info);
2616 fbcon_set_palette(vc, color_table); 2593 fbcon_set_palette(vc, color_table);
2617 update_screen(vc); 2594 update_screen(vc);
2618 if (softback_buf) { 2595 if (softback_buf)
2619 int l = fbcon_softback_size / vc->vc_size_row; 2596 fbcon_update_softback(vc);
2620 if (l > 5)
2621 softback_end = softback_buf + l * vc->vc_size_row;
2622 else {
2623 /* Smaller scrollback makes no sense, and 0
2624 would screw the operation totally */
2625 softback_top = 0;
2626 }
2627 }
2628 } 2597 }
2629} 2598}
2630 2599
@@ -2659,16 +2628,8 @@ static void fbcon_set_all_vcs(struct fb_info *info)
2659 update_var(vc->vc_num, info); 2628 update_var(vc->vc_num, info);
2660 fbcon_set_palette(vc, color_table); 2629 fbcon_set_palette(vc, color_table);
2661 update_screen(vc); 2630 update_screen(vc);
2662 if (softback_buf) { 2631 if (softback_buf)
2663 int l = fbcon_softback_size / vc->vc_size_row; 2632 fbcon_update_softback(vc);
2664 if (l > 5)
2665 softback_end = softback_buf + l * vc->vc_size_row;
2666 else {
2667 /* Smaller scrollback makes no sense, and 0
2668 would screw the operation totally */
2669 softback_top = 0;
2670 }
2671 }
2672 } 2633 }
2673 } 2634 }
2674} 2635}