Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vgacon: cache vc_cell_height in vgacon_cursor()

There are many places c->vc_cell_height is used in the code of
vgacon_cursor(). Caching the value to a local variable makes the code
much easier to follow.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Jiri Slaby (SUSE) and committed by
Helge Deller
1023ca19 93686f6b

+15 -19
+15 -19
drivers/video/console/vgacon.c
··· 470 470 471 471 static void vgacon_cursor(struct vc_data *c, int mode) 472 472 { 473 + unsigned int c_height; 474 + 473 475 if (c->vc_mode != KD_TEXT) 474 476 return; 475 477 476 478 vgacon_restore_screen(c); 479 + 480 + c_height = c->vc_cell_height; 477 481 478 482 switch (mode) { 479 483 case CM_ERASE: ··· 493 489 write_vga(14, (c->vc_pos - vga_vram_base) / 2); 494 490 switch (CUR_SIZE(c->vc_cursor_type)) { 495 491 case CUR_UNDERLINE: 496 - vgacon_set_cursor_size(c->vc_cell_height - 497 - (c->vc_cell_height < 498 - 10 ? 2 : 3), 499 - c->vc_cell_height - 500 - (c->vc_cell_height < 501 - 10 ? 1 : 2)); 492 + vgacon_set_cursor_size(c_height - 493 + (c_height < 10 ? 2 : 3), 494 + c_height - 495 + (c_height < 10 ? 1 : 2)); 502 496 break; 503 497 case CUR_TWO_THIRDS: 504 - vgacon_set_cursor_size(c->vc_cell_height / 3, 505 - c->vc_cell_height - 506 - (c->vc_cell_height < 507 - 10 ? 1 : 2)); 498 + vgacon_set_cursor_size(c_height / 3, c_height - 499 + (c_height < 10 ? 1 : 2)); 508 500 break; 509 501 case CUR_LOWER_THIRD: 510 - vgacon_set_cursor_size((c->vc_cell_height * 2) / 3, 511 - c->vc_cell_height - 512 - (c->vc_cell_height < 513 - 10 ? 1 : 2)); 502 + vgacon_set_cursor_size(c_height * 2 / 3, c_height - 503 + (c_height < 10 ? 1 : 2)); 514 504 break; 515 505 case CUR_LOWER_HALF: 516 - vgacon_set_cursor_size(c->vc_cell_height / 2, 517 - c->vc_cell_height - 518 - (c->vc_cell_height < 519 - 10 ? 1 : 2)); 506 + vgacon_set_cursor_size(c_height / 2, c_height - 507 + (c_height < 10 ? 1 : 2)); 520 508 break; 521 509 case CUR_NONE: 522 510 if (vga_video_type >= VIDEO_TYPE_VGAC) ··· 517 521 vgacon_set_cursor_size(31, 31); 518 522 break; 519 523 default: 520 - vgacon_set_cursor_size(1, c->vc_cell_height); 524 + vgacon_set_cursor_size(1, c_height); 521 525 break; 522 526 } 523 527 break;