aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2006-01-09 23:53:44 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:51 -0500
commita39bc34ea8f042e090ade124726ae5a3fd1a51f8 (patch)
tree60dbc6861a9189135d789f305957bbc3f2119c1f
parentc5eec03f314e1406829d9683284673203b91b9b8 (diff)
[PATCH] fbcon: Code cleanups
- replace kmalloc with kzalloc - remove repeated define (FONTCHHCNT) - remove unneeded local variable (redraw) in ypan_{up|down}_redraw - add and delete cursor timer in fbcon_switch() if old_info != info Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/video/console/fbcon.c27
-rw-r--r--drivers/video/console/fbcon_rotate.h2
2 files changed, 11 insertions, 18 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 4f6fc785e95f..041d06987861 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -687,13 +687,12 @@ static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info,
687 err = -ENODEV; 687 err = -ENODEV;
688 688
689 if (!err) { 689 if (!err) {
690 ops = kmalloc(sizeof(struct fbcon_ops), GFP_KERNEL); 690 ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL);
691 if (!ops) 691 if (!ops)
692 err = -ENOMEM; 692 err = -ENOMEM;
693 } 693 }
694 694
695 if (!err) { 695 if (!err) {
696 memset(ops, 0, sizeof(struct fbcon_ops));
697 info->fbcon_par = ops; 696 info->fbcon_par = ops;
698 set_blitting_type(vc, info); 697 set_blitting_type(vc, info);
699 } 698 }
@@ -919,13 +918,12 @@ static const char *fbcon_startup(void)
919 return NULL; 918 return NULL;
920 } 919 }
921 920
922 ops = kmalloc(sizeof(struct fbcon_ops), GFP_KERNEL); 921 ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL);
923 if (!ops) { 922 if (!ops) {
924 module_put(owner); 923 module_put(owner);
925 return NULL; 924 return NULL;
926 } 925 }
927 926
928 memset(ops, 0, sizeof(struct fbcon_ops));
929 ops->currcon = -1; 927 ops->currcon = -1;
930 ops->graphics = 1; 928 ops->graphics = 1;
931 ops->cur_rotate = -1; 929 ops->cur_rotate = -1;
@@ -1408,16 +1406,13 @@ static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count)
1408 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1406 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1409 struct fbcon_ops *ops = info->fbcon_par; 1407 struct fbcon_ops *ops = info->fbcon_par;
1410 struct display *p = &fb_display[vc->vc_num]; 1408 struct display *p = &fb_display[vc->vc_num];
1411 int redraw = 0;
1412 1409
1413 p->yscroll += count; 1410 p->yscroll += count;
1411
1414 if (p->yscroll > p->vrows - vc->vc_rows) { 1412 if (p->yscroll > p->vrows - vc->vc_rows) {
1415 p->yscroll -= p->vrows - vc->vc_rows; 1413 p->yscroll -= p->vrows - vc->vc_rows;
1416 redraw = 1;
1417 }
1418
1419 if (redraw)
1420 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); 1414 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t);
1415 }
1421 1416
1422 ops->var.xoffset = 0; 1417 ops->var.xoffset = 0;
1423 ops->var.yoffset = p->yscroll * vc->vc_font.height; 1418 ops->var.yoffset = p->yscroll * vc->vc_font.height;
@@ -1459,16 +1454,13 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count)
1459 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1454 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1460 struct fbcon_ops *ops = info->fbcon_par; 1455 struct fbcon_ops *ops = info->fbcon_par;
1461 struct display *p = &fb_display[vc->vc_num]; 1456 struct display *p = &fb_display[vc->vc_num];
1462 int redraw = 0;
1463 1457
1464 p->yscroll -= count; 1458 p->yscroll -= count;
1459
1465 if (p->yscroll < 0) { 1460 if (p->yscroll < 0) {
1466 p->yscroll += p->vrows - vc->vc_rows; 1461 p->yscroll += p->vrows - vc->vc_rows;
1467 redraw = 1;
1468 }
1469
1470 if (redraw)
1471 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); 1462 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count);
1463 }
1472 1464
1473 ops->var.xoffset = 0; 1465 ops->var.xoffset = 0;
1474 ops->var.yoffset = p->yscroll * vc->vc_font.height; 1466 ops->var.yoffset = p->yscroll * vc->vc_font.height;
@@ -2105,8 +2097,11 @@ static int fbcon_switch(struct vc_data *vc)
2105 info->flags & FBINFO_MISC_ALWAYS_SETPAR)) { 2097 info->flags & FBINFO_MISC_ALWAYS_SETPAR)) {
2106 if (info->fbops->fb_set_par) 2098 if (info->fbops->fb_set_par)
2107 info->fbops->fb_set_par(info); 2099 info->fbops->fb_set_par(info);
2108 fbcon_del_cursor_timer(old_info); 2100
2109 fbcon_add_cursor_timer(info); 2101 if (old_info != info) {
2102 fbcon_del_cursor_timer(old_info);
2103 fbcon_add_cursor_timer(info);
2104 }
2110 } 2105 }
2111 2106
2112 set_blitting_type(vc, info); 2107 set_blitting_type(vc, info);
diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h
index 1b8f92fdc6a8..75be5ce53dc5 100644
--- a/drivers/video/console/fbcon_rotate.h
+++ b/drivers/video/console/fbcon_rotate.h
@@ -11,8 +11,6 @@
11#ifndef _FBCON_ROTATE_H 11#ifndef _FBCON_ROTATE_H
12#define _FBCON_ROTATE_H 12#define _FBCON_ROTATE_H
13 13
14#define FNTCHARCNT(fd) (((int *)(fd))[-3])
15
16#define GETVYRES(s,i) ({ \ 14#define GETVYRES(s,i) ({ \
17 (s == SCROLL_REDRAW || s == SCROLL_MOVE) ? \ 15 (s == SCROLL_REDRAW || s == SCROLL_MOVE) ? \
18 (i)->var.yres : (i)->var.yres_virtual; }) 16 (i)->var.yres : (i)->var.yres_virtual; })