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

Remove magic macros for screen_info structure members

Stop using magic macros for screen_info structure members.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>

+34 -41
+3 -3
arch/arm/mach-footbridge/cats-hw.c
··· 78 78 fixup_cats(struct machine_desc *desc, struct tag *tags, 79 79 char **cmdline, struct meminfo *mi) 80 80 { 81 - ORIG_VIDEO_LINES = 25; 82 - ORIG_VIDEO_POINTS = 16; 83 - ORIG_Y = 24; 81 + screen_info.orig_video_lines = 25; 82 + screen_info.orig_video_points = 16; 83 + screen_info.orig_y = 24; 84 84 } 85 85 86 86 MACHINE_START(CATS, "Chalice-CATS")
+2 -2
drivers/video/console/dummycon.c
··· 18 18 */ 19 19 20 20 #if defined(__arm__) 21 - #define DUMMY_COLUMNS ORIG_VIDEO_COLS 22 - #define DUMMY_ROWS ORIG_VIDEO_LINES 21 + #define DUMMY_COLUMNS screen_info.orig_video_cols 22 + #define DUMMY_ROWS screen_info.orig_video_lines 23 23 #elif defined(__hppa__) 24 24 /* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */ 25 25 #define DUMMY_COLUMNS CONFIG_DUMMY_CONSOLE_COLUMNS
+25 -24
drivers/video/console/vgacon.c
··· 362 362 u16 saved1, saved2; 363 363 volatile u16 *p; 364 364 365 - if (ORIG_VIDEO_ISVGA == VIDEO_TYPE_VLFB) { 365 + if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB) { 366 366 no_vga: 367 367 #ifdef CONFIG_DUMMY_CONSOLE 368 368 conswitchp = &dummy_con; ··· 373 373 } 374 374 375 375 /* boot_params.screen_info initialized? */ 376 - if ((ORIG_VIDEO_MODE == 0) && 377 - (ORIG_VIDEO_LINES == 0) && 378 - (ORIG_VIDEO_COLS == 0)) 376 + if ((screen_info.orig_video_mode == 0) && 377 + (screen_info.orig_video_lines == 0) && 378 + (screen_info.orig_video_cols == 0)) 379 379 goto no_vga; 380 380 381 381 /* VGA16 modes are not handled by VGACON */ 382 - if ((ORIG_VIDEO_MODE == 0x0D) || /* 320x200/4 */ 383 - (ORIG_VIDEO_MODE == 0x0E) || /* 640x200/4 */ 384 - (ORIG_VIDEO_MODE == 0x10) || /* 640x350/4 */ 385 - (ORIG_VIDEO_MODE == 0x12) || /* 640x480/4 */ 386 - (ORIG_VIDEO_MODE == 0x6A)) /* 800x600/4, 0x6A is very common */ 382 + if ((screen_info.orig_video_mode == 0x0D) || /* 320x200/4 */ 383 + (screen_info.orig_video_mode == 0x0E) || /* 640x200/4 */ 384 + (screen_info.orig_video_mode == 0x10) || /* 640x350/4 */ 385 + (screen_info.orig_video_mode == 0x12) || /* 640x480/4 */ 386 + (screen_info.orig_video_mode == 0x6A)) /* 800x600/4 (VESA) */ 387 387 goto no_vga; 388 388 389 - vga_video_num_lines = ORIG_VIDEO_LINES; 390 - vga_video_num_columns = ORIG_VIDEO_COLS; 389 + vga_video_num_lines = screen_info.orig_video_lines; 390 + vga_video_num_columns = screen_info.orig_video_cols; 391 391 state.vgabase = NULL; 392 392 393 - if (ORIG_VIDEO_MODE == 7) { /* Is this a monochrome display? */ 393 + if (screen_info.orig_video_mode == 7) { 394 + /* Monochrome display */ 394 395 vga_vram_base = 0xb0000; 395 396 vga_video_port_reg = VGA_CRT_IM; 396 397 vga_video_port_val = VGA_CRT_DM; 397 - if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) { 398 + if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { 398 399 static struct resource ega_console_resource = 399 400 { .name = "ega", .start = 0x3B0, .end = 0x3BF }; 400 401 vga_video_type = VIDEO_TYPE_EGAM; ··· 423 422 vga_vram_base = 0xb8000; 424 423 vga_video_port_reg = VGA_CRT_IC; 425 424 vga_video_port_val = VGA_CRT_DC; 426 - if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) { 425 + if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { 427 426 int i; 428 427 429 428 vga_vram_size = 0x8000; 430 429 431 - if (!ORIG_VIDEO_ISVGA) { 430 + if (!screen_info.orig_video_isVGA) { 432 431 static struct resource ega_console_resource 433 432 = { .name = "ega", .start = 0x3C0, .end = 0x3DF }; 434 433 vga_video_type = VIDEO_TYPE_EGAC; ··· 522 521 || vga_video_type == VIDEO_TYPE_VGAC 523 522 || vga_video_type == VIDEO_TYPE_EGAM) { 524 523 vga_hardscroll_enabled = vga_hardscroll_user_enable; 525 - vga_default_font_height = ORIG_VIDEO_POINTS; 526 - vga_video_font_height = ORIG_VIDEO_POINTS; 524 + vga_default_font_height = screen_info.orig_video_points; 525 + vga_video_font_height = screen_info.orig_video_points; 527 526 /* This may be suboptimal but is a safe bet - go with it */ 528 527 vga_scan_lines = 529 528 vga_video_font_height * vga_video_num_lines; 530 529 } 531 530 532 - vgacon_xres = ORIG_VIDEO_COLS * VGA_FONTWIDTH; 531 + vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH; 533 532 vgacon_yres = vga_scan_lines; 534 533 535 534 if (!vga_init_done) { ··· 799 798 { 800 799 int x = c->vc_cols * VGA_FONTWIDTH; 801 800 int y = c->vc_rows * c->vc_font.height; 802 - int rows = ORIG_VIDEO_LINES * vga_default_font_height/ 801 + int rows = screen_info.orig_video_lines * vga_default_font_height/ 803 802 c->vc_font.height; 804 803 /* 805 804 * We need to save screen size here as it's the only way ··· 819 818 820 819 if ((vgacon_xres != x || vgacon_yres != y) && 821 820 (!(vga_video_num_columns % 2) && 822 - vga_video_num_columns <= ORIG_VIDEO_COLS && 821 + vga_video_num_columns <= screen_info.orig_video_cols && 823 822 vga_video_num_lines <= rows)) 824 823 vgacon_doresize(c, c->vc_cols, c->vc_rows); 825 824 } ··· 1281 1280 static int vgacon_resize(struct vc_data *c, unsigned int width, 1282 1281 unsigned int height, unsigned int user) 1283 1282 { 1284 - if (width % 2 || width > ORIG_VIDEO_COLS || 1285 - height > (ORIG_VIDEO_LINES * vga_default_font_height)/ 1283 + if (width % 2 || width > screen_info.orig_video_cols || 1284 + height > (screen_info.orig_video_lines * vga_default_font_height)/ 1286 1285 c->vc_font.height) 1287 1286 /* let svgatextmode tinker with video timings and 1288 1287 return success */ ··· 1314 1313 * console initialization routines. 1315 1314 */ 1316 1315 vga_bootup_console = 1; 1317 - c->vc_x = ORIG_X; 1318 - c->vc_y = ORIG_Y; 1316 + c->vc_x = screen_info.orig_x; 1317 + c->vc_y = screen_info.orig_y; 1319 1318 } 1320 1319 1321 1320 /* We can't copy in more then the size of the video buffer,
+3 -2
drivers/video/intelfb/intelfbdrv.c
··· 804 804 if (bailearly == 1) 805 805 bailout(dinfo); 806 806 807 - if (FIXED_MODE(dinfo) && ORIG_VIDEO_ISVGA != VIDEO_TYPE_VLFB) { 807 + if (FIXED_MODE(dinfo) && 808 + screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) { 808 809 ERR_MSG("Video mode must be programmed at boot time.\n"); 809 810 cleanup(dinfo); 810 811 return -ENODEV; ··· 816 815 817 816 /* Initialise dinfo and related data. */ 818 817 /* If an initial mode was programmed at boot time, get its details. */ 819 - if (ORIG_VIDEO_ISVGA == VIDEO_TYPE_VLFB) 818 + if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB) 820 819 get_initial_mode(dinfo); 821 820 822 821 if (bailearly == 3)
+1 -1
drivers/video/vga16fb.c
··· 1364 1364 par = info->par; 1365 1365 1366 1366 mutex_init(&par->open_lock); 1367 - par->isVGA = ORIG_VIDEO_ISVGA; 1367 + par->isVGA = screen_info.orig_video_isVGA; 1368 1368 par->palette_blanked = 0; 1369 1369 par->vesa_blanked = 0; 1370 1370
-9
include/linux/screen_info.h
··· 47 47 48 48 extern struct screen_info screen_info; 49 49 50 - #define ORIG_X (screen_info.orig_x) 51 - #define ORIG_Y (screen_info.orig_y) 52 - #define ORIG_VIDEO_MODE (screen_info.orig_video_mode) 53 - #define ORIG_VIDEO_COLS (screen_info.orig_video_cols) 54 - #define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx) 55 - #define ORIG_VIDEO_LINES (screen_info.orig_video_lines) 56 - #define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA) 57 - #define ORIG_VIDEO_POINTS (screen_info.orig_video_points) 58 - 59 50 #define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */ 60 51 #define VIDEO_TYPE_CGA 0x11 /* CGA Display */ 61 52 #define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */