diff options
author | Jiri Slaby <jslaby@suse.cz> | 2016-06-23 07:34:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-06-25 12:04:48 -0400 |
commit | 6ca8dfd78187d8238abc5b2996848a0c8f07948d (patch) | |
tree | 9ac4c3325558f7e31ca35e34c7f07407ce865d53 | |
parent | aada0a344182e3aec7bfb0cc611f272e6297c3e3 (diff) |
tty: vt, convert more macros to functions
Namely convert:
* IS_FG -> con_is_fg
* DO_UPDATE -> con_should_update
* CON_IS_VISIBLE -> con_is_visible
DO_UPDATE was a weird name for a yes/no answer, so the new name is
con_should_update.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: linux-usb@vger.kernel.org
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/vt/vt.c | 62 | ||||
-rw-r--r-- | drivers/usb/misc/sisusbvga/sisusb_con.c | 4 | ||||
-rw-r--r-- | drivers/video/console/fbcon.c | 26 | ||||
-rw-r--r-- | drivers/video/console/vgacon.c | 8 | ||||
-rw-r--r-- | include/linux/console_struct.h | 5 |
5 files changed, 57 insertions, 48 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 8ceabfd20561..26de5c0fc056 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -277,8 +277,15 @@ static void notify_update(struct vc_data *vc) | |||
277 | * Low-Level Functions | 277 | * Low-Level Functions |
278 | */ | 278 | */ |
279 | 279 | ||
280 | #define IS_FG(vc) ((vc)->vc_num == fg_console) | 280 | static inline bool con_is_fg(const struct vc_data *vc) |
281 | #define DO_UPDATE(vc) (CON_IS_VISIBLE(vc) && !console_blanked) | 281 | { |
282 | return vc->vc_num == fg_console; | ||
283 | } | ||
284 | |||
285 | static inline bool con_should_update(const struct vc_data *vc) | ||
286 | { | ||
287 | return con_is_visible(vc) && !console_blanked; | ||
288 | } | ||
282 | 289 | ||
283 | static inline unsigned short *screenpos(struct vc_data *vc, int offset, int viewed) | 290 | static inline unsigned short *screenpos(struct vc_data *vc, int offset, int viewed) |
284 | { | 291 | { |
@@ -316,7 +323,7 @@ static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr) | |||
316 | nr = b - t - 1; | 323 | nr = b - t - 1; |
317 | if (b > vc->vc_rows || t >= b || nr < 1) | 324 | if (b > vc->vc_rows || t >= b || nr < 1) |
318 | return; | 325 | return; |
319 | if (CON_IS_VISIBLE(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_UP, nr)) | 326 | if (con_is_visible(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_UP, nr)) |
320 | return; | 327 | return; |
321 | d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); | 328 | d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); |
322 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr)); | 329 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr)); |
@@ -334,7 +341,7 @@ static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr) | |||
334 | nr = b - t - 1; | 341 | nr = b - t - 1; |
335 | if (b > vc->vc_rows || t >= b || nr < 1) | 342 | if (b > vc->vc_rows || t >= b || nr < 1) |
336 | return; | 343 | return; |
337 | if (CON_IS_VISIBLE(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_DOWN, nr)) | 344 | if (con_is_visible(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_DOWN, nr)) |
338 | return; | 345 | return; |
339 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); | 346 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); |
340 | step = vc->vc_cols * nr; | 347 | step = vc->vc_cols * nr; |
@@ -390,7 +397,7 @@ void update_region(struct vc_data *vc, unsigned long start, int count) | |||
390 | { | 397 | { |
391 | WARN_CONSOLE_UNLOCKED(); | 398 | WARN_CONSOLE_UNLOCKED(); |
392 | 399 | ||
393 | if (DO_UPDATE(vc)) { | 400 | if (con_should_update(vc)) { |
394 | hide_cursor(vc); | 401 | hide_cursor(vc); |
395 | do_update_region(vc, start, count); | 402 | do_update_region(vc, start, count); |
396 | set_cursor(vc); | 403 | set_cursor(vc); |
@@ -490,7 +497,7 @@ void invert_screen(struct vc_data *vc, int offset, int count, int viewed) | |||
490 | } | 497 | } |
491 | } | 498 | } |
492 | 499 | ||
493 | if (DO_UPDATE(vc)) | 500 | if (con_should_update(vc)) |
494 | do_update_region(vc, (unsigned long) p, count); | 501 | do_update_region(vc, (unsigned long) p, count); |
495 | notify_update(vc); | 502 | notify_update(vc); |
496 | } | 503 | } |
@@ -507,7 +514,7 @@ void complement_pos(struct vc_data *vc, int offset) | |||
507 | if (old_offset != -1 && old_offset >= 0 && | 514 | if (old_offset != -1 && old_offset >= 0 && |
508 | old_offset < vc->vc_screenbuf_size) { | 515 | old_offset < vc->vc_screenbuf_size) { |
509 | scr_writew(old, screenpos(vc, old_offset, 1)); | 516 | scr_writew(old, screenpos(vc, old_offset, 1)); |
510 | if (DO_UPDATE(vc)) | 517 | if (con_should_update(vc)) |
511 | vc->vc_sw->con_putc(vc, old, oldy, oldx); | 518 | vc->vc_sw->con_putc(vc, old, oldy, oldx); |
512 | notify_update(vc); | 519 | notify_update(vc); |
513 | } | 520 | } |
@@ -522,7 +529,7 @@ void complement_pos(struct vc_data *vc, int offset) | |||
522 | old = scr_readw(p); | 529 | old = scr_readw(p); |
523 | new = old ^ vc->vc_complement_mask; | 530 | new = old ^ vc->vc_complement_mask; |
524 | scr_writew(new, p); | 531 | scr_writew(new, p); |
525 | if (DO_UPDATE(vc)) { | 532 | if (con_should_update(vc)) { |
526 | oldx = (offset >> 1) % vc->vc_cols; | 533 | oldx = (offset >> 1) % vc->vc_cols; |
527 | oldy = (offset >> 1) / vc->vc_cols; | 534 | oldy = (offset >> 1) / vc->vc_cols; |
528 | vc->vc_sw->con_putc(vc, new, oldy, oldx); | 535 | vc->vc_sw->con_putc(vc, new, oldy, oldx); |
@@ -538,7 +545,7 @@ static void insert_char(struct vc_data *vc, unsigned int nr) | |||
538 | scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x - nr) * 2); | 545 | scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x - nr) * 2); |
539 | scr_memsetw(p, vc->vc_video_erase_char, nr * 2); | 546 | scr_memsetw(p, vc->vc_video_erase_char, nr * 2); |
540 | vc->vc_need_wrap = 0; | 547 | vc->vc_need_wrap = 0; |
541 | if (DO_UPDATE(vc)) | 548 | if (con_should_update(vc)) |
542 | do_update_region(vc, (unsigned long) p, | 549 | do_update_region(vc, (unsigned long) p, |
543 | vc->vc_cols - vc->vc_x); | 550 | vc->vc_cols - vc->vc_x); |
544 | } | 551 | } |
@@ -551,7 +558,7 @@ static void delete_char(struct vc_data *vc, unsigned int nr) | |||
551 | scr_memsetw(p + vc->vc_cols - vc->vc_x - nr, vc->vc_video_erase_char, | 558 | scr_memsetw(p + vc->vc_cols - vc->vc_x - nr, vc->vc_video_erase_char, |
552 | nr * 2); | 559 | nr * 2); |
553 | vc->vc_need_wrap = 0; | 560 | vc->vc_need_wrap = 0; |
554 | if (DO_UPDATE(vc)) | 561 | if (con_should_update(vc)) |
555 | do_update_region(vc, (unsigned long) p, | 562 | do_update_region(vc, (unsigned long) p, |
556 | vc->vc_cols - vc->vc_x); | 563 | vc->vc_cols - vc->vc_x); |
557 | } | 564 | } |
@@ -571,7 +578,7 @@ static void add_softcursor(struct vc_data *vc) | |||
571 | if ((type & 0x20) && ((softcursor_original & 0x7000) == (i & 0x7000))) i ^= 0x7000; | 578 | if ((type & 0x20) && ((softcursor_original & 0x7000) == (i & 0x7000))) i ^= 0x7000; |
572 | if ((type & 0x40) && ((i & 0x700) == ((i & 0x7000) >> 4))) i ^= 0x0700; | 579 | if ((type & 0x40) && ((i & 0x700) == ((i & 0x7000) >> 4))) i ^= 0x0700; |
573 | scr_writew(i, (u16 *) vc->vc_pos); | 580 | scr_writew(i, (u16 *) vc->vc_pos); |
574 | if (DO_UPDATE(vc)) | 581 | if (con_should_update(vc)) |
575 | vc->vc_sw->con_putc(vc, i, vc->vc_y, vc->vc_x); | 582 | vc->vc_sw->con_putc(vc, i, vc->vc_y, vc->vc_x); |
576 | } | 583 | } |
577 | 584 | ||
@@ -579,7 +586,7 @@ static void hide_softcursor(struct vc_data *vc) | |||
579 | { | 586 | { |
580 | if (softcursor_original != -1) { | 587 | if (softcursor_original != -1) { |
581 | scr_writew(softcursor_original, (u16 *)vc->vc_pos); | 588 | scr_writew(softcursor_original, (u16 *)vc->vc_pos); |
582 | if (DO_UPDATE(vc)) | 589 | if (con_should_update(vc)) |
583 | vc->vc_sw->con_putc(vc, softcursor_original, | 590 | vc->vc_sw->con_putc(vc, softcursor_original, |
584 | vc->vc_y, vc->vc_x); | 591 | vc->vc_y, vc->vc_x); |
585 | softcursor_original = -1; | 592 | softcursor_original = -1; |
@@ -596,8 +603,7 @@ static void hide_cursor(struct vc_data *vc) | |||
596 | 603 | ||
597 | static void set_cursor(struct vc_data *vc) | 604 | static void set_cursor(struct vc_data *vc) |
598 | { | 605 | { |
599 | if (!IS_FG(vc) || console_blanked || | 606 | if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS) |
600 | vc->vc_mode == KD_GRAPHICS) | ||
601 | return; | 607 | return; |
602 | if (vc->vc_deccm) { | 608 | if (vc->vc_deccm) { |
603 | if (vc == sel_cons) | 609 | if (vc == sel_cons) |
@@ -613,7 +619,7 @@ static void set_origin(struct vc_data *vc) | |||
613 | { | 619 | { |
614 | WARN_CONSOLE_UNLOCKED(); | 620 | WARN_CONSOLE_UNLOCKED(); |
615 | 621 | ||
616 | if (!CON_IS_VISIBLE(vc) || | 622 | if (!con_is_visible(vc) || |
617 | !vc->vc_sw->con_set_origin || | 623 | !vc->vc_sw->con_set_origin || |
618 | !vc->vc_sw->con_set_origin(vc)) | 624 | !vc->vc_sw->con_set_origin(vc)) |
619 | vc->vc_origin = (unsigned long)vc->vc_screenbuf; | 625 | vc->vc_origin = (unsigned long)vc->vc_screenbuf; |
@@ -661,12 +667,12 @@ void redraw_screen(struct vc_data *vc, int is_switch) | |||
661 | struct vc_data *old_vc = vc_cons[fg_console].d; | 667 | struct vc_data *old_vc = vc_cons[fg_console].d; |
662 | if (old_vc == vc) | 668 | if (old_vc == vc) |
663 | return; | 669 | return; |
664 | if (!CON_IS_VISIBLE(vc)) | 670 | if (!con_is_visible(vc)) |
665 | redraw = 1; | 671 | redraw = 1; |
666 | *vc->vc_display_fg = vc; | 672 | *vc->vc_display_fg = vc; |
667 | fg_console = vc->vc_num; | 673 | fg_console = vc->vc_num; |
668 | hide_cursor(old_vc); | 674 | hide_cursor(old_vc); |
669 | if (!CON_IS_VISIBLE(old_vc)) { | 675 | if (!con_is_visible(old_vc)) { |
670 | save_screen(old_vc); | 676 | save_screen(old_vc); |
671 | set_origin(old_vc); | 677 | set_origin(old_vc); |
672 | } | 678 | } |
@@ -941,7 +947,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, | |||
941 | tty_do_resize(tty, &ws); | 947 | tty_do_resize(tty, &ws); |
942 | } | 948 | } |
943 | 949 | ||
944 | if (CON_IS_VISIBLE(vc)) | 950 | if (con_is_visible(vc)) |
945 | update_screen(vc); | 951 | update_screen(vc); |
946 | vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); | 952 | vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); |
947 | return err; | 953 | return err; |
@@ -1171,7 +1177,7 @@ static void csi_J(struct vc_data *vc, int vpar) | |||
1171 | scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char, | 1177 | scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char, |
1172 | vc->vc_screenbuf_size >> 1); | 1178 | vc->vc_screenbuf_size >> 1); |
1173 | set_origin(vc); | 1179 | set_origin(vc); |
1174 | if (CON_IS_VISIBLE(vc)) | 1180 | if (con_is_visible(vc)) |
1175 | update_screen(vc); | 1181 | update_screen(vc); |
1176 | /* fall through */ | 1182 | /* fall through */ |
1177 | case 2: /* erase whole display */ | 1183 | case 2: /* erase whole display */ |
@@ -1182,7 +1188,7 @@ static void csi_J(struct vc_data *vc, int vpar) | |||
1182 | return; | 1188 | return; |
1183 | } | 1189 | } |
1184 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); | 1190 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); |
1185 | if (DO_UPDATE(vc)) | 1191 | if (con_should_update(vc)) |
1186 | do_update_region(vc, (unsigned long) start, count); | 1192 | do_update_region(vc, (unsigned long) start, count); |
1187 | vc->vc_need_wrap = 0; | 1193 | vc->vc_need_wrap = 0; |
1188 | } | 1194 | } |
@@ -1210,7 +1216,7 @@ static void csi_K(struct vc_data *vc, int vpar) | |||
1210 | } | 1216 | } |
1211 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); | 1217 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); |
1212 | vc->vc_need_wrap = 0; | 1218 | vc->vc_need_wrap = 0; |
1213 | if (DO_UPDATE(vc)) | 1219 | if (con_should_update(vc)) |
1214 | do_update_region(vc, (unsigned long) start, count); | 1220 | do_update_region(vc, (unsigned long) start, count); |
1215 | } | 1221 | } |
1216 | 1222 | ||
@@ -1223,7 +1229,7 @@ static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar posi | |||
1223 | count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar; | 1229 | count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar; |
1224 | 1230 | ||
1225 | scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count); | 1231 | scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count); |
1226 | if (DO_UPDATE(vc)) | 1232 | if (con_should_update(vc)) |
1227 | vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count); | 1233 | vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count); |
1228 | vc->vc_need_wrap = 0; | 1234 | vc->vc_need_wrap = 0; |
1229 | } | 1235 | } |
@@ -2208,7 +2214,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co | |||
2208 | charmask = himask ? 0x1ff : 0xff; | 2214 | charmask = himask ? 0x1ff : 0xff; |
2209 | 2215 | ||
2210 | /* undraw cursor first */ | 2216 | /* undraw cursor first */ |
2211 | if (IS_FG(vc)) | 2217 | if (con_is_fg(vc)) |
2212 | hide_cursor(vc); | 2218 | hide_cursor(vc); |
2213 | 2219 | ||
2214 | param.vc = vc; | 2220 | param.vc = vc; |
@@ -2380,7 +2386,7 @@ rescan_last_byte: | |||
2380 | ((vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) : | 2386 | ((vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) : |
2381 | (vc_attr << 8) + tc, | 2387 | (vc_attr << 8) + tc, |
2382 | (u16 *) vc->vc_pos); | 2388 | (u16 *) vc->vc_pos); |
2383 | if (DO_UPDATE(vc) && draw_x < 0) { | 2389 | if (con_should_update(vc) && draw_x < 0) { |
2384 | draw_x = vc->vc_x; | 2390 | draw_x = vc->vc_x; |
2385 | draw_from = vc->vc_pos; | 2391 | draw_from = vc->vc_pos; |
2386 | } | 2392 | } |
@@ -2564,7 +2570,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) | |||
2564 | goto quit; | 2570 | goto quit; |
2565 | 2571 | ||
2566 | /* undraw cursor first */ | 2572 | /* undraw cursor first */ |
2567 | if (IS_FG(vc)) | 2573 | if (con_is_fg(vc)) |
2568 | hide_cursor(vc); | 2574 | hide_cursor(vc); |
2569 | 2575 | ||
2570 | start = (ushort *)vc->vc_pos; | 2576 | start = (ushort *)vc->vc_pos; |
@@ -2575,7 +2581,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) | |||
2575 | c = *b++; | 2581 | c = *b++; |
2576 | if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { | 2582 | if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { |
2577 | if (cnt > 0) { | 2583 | if (cnt > 0) { |
2578 | if (CON_IS_VISIBLE(vc)) | 2584 | if (con_is_visible(vc)) |
2579 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); | 2585 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); |
2580 | vc->vc_x += cnt; | 2586 | vc->vc_x += cnt; |
2581 | if (vc->vc_need_wrap) | 2587 | if (vc->vc_need_wrap) |
@@ -2607,7 +2613,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) | |||
2607 | myx++; | 2613 | myx++; |
2608 | } | 2614 | } |
2609 | if (cnt > 0) { | 2615 | if (cnt > 0) { |
2610 | if (CON_IS_VISIBLE(vc)) | 2616 | if (con_is_visible(vc)) |
2611 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); | 2617 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); |
2612 | vc->vc_x += cnt; | 2618 | vc->vc_x += cnt; |
2613 | if (vc->vc_x == vc->vc_cols) { | 2619 | if (vc->vc_x == vc->vc_cols) { |
@@ -3154,7 +3160,7 @@ static int do_bind_con_driver(const struct consw *csw, int first, int last, | |||
3154 | 3160 | ||
3155 | j = i; | 3161 | j = i; |
3156 | 3162 | ||
3157 | if (CON_IS_VISIBLE(vc)) { | 3163 | if (con_is_visible(vc)) { |
3158 | k = i; | 3164 | k = i; |
3159 | save_screen(vc); | 3165 | save_screen(vc); |
3160 | } | 3166 | } |
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c b/drivers/usb/misc/sisusbvga/sisusb_con.c index 52a6da991165..460cebf322e3 100644 --- a/drivers/usb/misc/sisusbvga/sisusb_con.c +++ b/drivers/usb/misc/sisusbvga/sisusb_con.c | |||
@@ -570,7 +570,7 @@ sisusbcon_set_palette(struct vc_data *c, const unsigned char *table) | |||
570 | 570 | ||
571 | /* Return value not used by vt */ | 571 | /* Return value not used by vt */ |
572 | 572 | ||
573 | if (!CON_IS_VISIBLE(c)) | 573 | if (!con_is_visible(c)) |
574 | return; | 574 | return; |
575 | 575 | ||
576 | sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); | 576 | sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); |
@@ -1226,7 +1226,7 @@ sisusbcon_do_font_op(struct sisusb_usb_data *sisusb, int set, int slot, | |||
1226 | struct vc_data *vc = vc_cons[i].d; | 1226 | struct vc_data *vc = vc_cons[i].d; |
1227 | 1227 | ||
1228 | if (vc && vc->vc_sw == &sisusb_con) { | 1228 | if (vc && vc->vc_sw == &sisusb_con) { |
1229 | if (CON_IS_VISIBLE(vc)) { | 1229 | if (con_is_visible(vc)) { |
1230 | vc->vc_sw->con_cursor(vc, CM_DRAW); | 1230 | vc->vc_sw->con_cursor(vc, CM_DRAW); |
1231 | } | 1231 | } |
1232 | vc->vc_font.height = fh; | 1232 | vc->vc_font.height = fh; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index eef8a8b7274f..b87f5cfdaea5 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -380,7 +380,7 @@ static void fb_flashcursor(struct work_struct *work) | |||
380 | if (ops && ops->currcon != -1) | 380 | if (ops && ops->currcon != -1) |
381 | vc = vc_cons[ops->currcon].d; | 381 | vc = vc_cons[ops->currcon].d; |
382 | 382 | ||
383 | if (!vc || !CON_IS_VISIBLE(vc) || | 383 | if (!vc || !con_is_visible(vc) || |
384 | registered_fb[con2fb_map[vc->vc_num]] != info || | 384 | registered_fb[con2fb_map[vc->vc_num]] != info || |
385 | vc->vc_deccm != 1) { | 385 | vc->vc_deccm != 1) { |
386 | console_unlock(); | 386 | console_unlock(); |
@@ -618,7 +618,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, | |||
618 | erase, | 618 | erase, |
619 | vc->vc_size_row * logo_lines); | 619 | vc->vc_size_row * logo_lines); |
620 | 620 | ||
621 | if (CON_IS_VISIBLE(vc) && vc->vc_mode == KD_TEXT) { | 621 | if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { |
622 | fbcon_clear_margins(vc, 0); | 622 | fbcon_clear_margins(vc, 0); |
623 | update_screen(vc); | 623 | update_screen(vc); |
624 | } | 624 | } |
@@ -1112,7 +1112,7 @@ static void fbcon_init(struct vc_data *vc, int init) | |||
1112 | * | 1112 | * |
1113 | * We need to do it in fbcon_init() to prevent screen corruption. | 1113 | * We need to do it in fbcon_init() to prevent screen corruption. |
1114 | */ | 1114 | */ |
1115 | if (CON_IS_VISIBLE(vc) && vc->vc_mode == KD_TEXT) { | 1115 | if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { |
1116 | if (info->fbops->fb_set_par && | 1116 | if (info->fbops->fb_set_par && |
1117 | !(ops->flags & FBCON_FLAGS_INIT)) { | 1117 | !(ops->flags & FBCON_FLAGS_INIT)) { |
1118 | ret = info->fbops->fb_set_par(info); | 1118 | ret = info->fbops->fb_set_par(info); |
@@ -1192,7 +1192,7 @@ static void fbcon_deinit(struct vc_data *vc) | |||
1192 | if (!ops) | 1192 | if (!ops) |
1193 | goto finished; | 1193 | goto finished; |
1194 | 1194 | ||
1195 | if (CON_IS_VISIBLE(vc)) | 1195 | if (con_is_visible(vc)) |
1196 | fbcon_del_cursor_timer(info); | 1196 | fbcon_del_cursor_timer(info); |
1197 | 1197 | ||
1198 | ops->flags &= ~FBCON_FLAGS_INIT; | 1198 | ops->flags &= ~FBCON_FLAGS_INIT; |
@@ -1397,7 +1397,7 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, | |||
1397 | rows /= vc->vc_font.height; | 1397 | rows /= vc->vc_font.height; |
1398 | vc_resize(vc, cols, rows); | 1398 | vc_resize(vc, cols, rows); |
1399 | 1399 | ||
1400 | if (CON_IS_VISIBLE(vc)) { | 1400 | if (con_is_visible(vc)) { |
1401 | update_screen(vc); | 1401 | update_screen(vc); |
1402 | if (softback_buf) | 1402 | if (softback_buf) |
1403 | fbcon_update_softback(vc); | 1403 | fbcon_update_softback(vc); |
@@ -2145,7 +2145,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, | |||
2145 | return -EINVAL; | 2145 | return -EINVAL; |
2146 | 2146 | ||
2147 | DPRINTK("resize now %ix%i\n", var.xres, var.yres); | 2147 | DPRINTK("resize now %ix%i\n", var.xres, var.yres); |
2148 | if (CON_IS_VISIBLE(vc)) { | 2148 | if (con_is_visible(vc)) { |
2149 | var.activate = FB_ACTIVATE_NOW | | 2149 | var.activate = FB_ACTIVATE_NOW | |
2150 | FB_ACTIVATE_FORCE; | 2150 | FB_ACTIVATE_FORCE; |
2151 | fb_set_var(info, &var); | 2151 | fb_set_var(info, &var); |
@@ -2448,7 +2448,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, | |||
2448 | int cnt; | 2448 | int cnt; |
2449 | char *old_data = NULL; | 2449 | char *old_data = NULL; |
2450 | 2450 | ||
2451 | if (CON_IS_VISIBLE(vc) && softback_lines) | 2451 | if (con_is_visible(vc) && softback_lines) |
2452 | fbcon_set_origin(vc); | 2452 | fbcon_set_origin(vc); |
2453 | 2453 | ||
2454 | resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); | 2454 | resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); |
@@ -2529,9 +2529,9 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, | |||
2529 | cols /= w; | 2529 | cols /= w; |
2530 | rows /= h; | 2530 | rows /= h; |
2531 | vc_resize(vc, cols, rows); | 2531 | vc_resize(vc, cols, rows); |
2532 | if (CON_IS_VISIBLE(vc) && softback_buf) | 2532 | if (con_is_visible(vc) && softback_buf) |
2533 | fbcon_update_softback(vc); | 2533 | fbcon_update_softback(vc); |
2534 | } else if (CON_IS_VISIBLE(vc) | 2534 | } else if (con_is_visible(vc) |
2535 | && vc->vc_mode == KD_TEXT) { | 2535 | && vc->vc_mode == KD_TEXT) { |
2536 | fbcon_clear_margins(vc, 0); | 2536 | fbcon_clear_margins(vc, 0); |
2537 | update_screen(vc); | 2537 | update_screen(vc); |
@@ -2660,7 +2660,7 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) | |||
2660 | if (fbcon_is_inactive(vc, info)) | 2660 | if (fbcon_is_inactive(vc, info)) |
2661 | return; | 2661 | return; |
2662 | 2662 | ||
2663 | if (!CON_IS_VISIBLE(vc)) | 2663 | if (!con_is_visible(vc)) |
2664 | return; | 2664 | return; |
2665 | 2665 | ||
2666 | depth = fb_get_color_depth(&info->var, &info->fix); | 2666 | depth = fb_get_color_depth(&info->var, &info->fix); |
@@ -2902,7 +2902,7 @@ static void fbcon_modechanged(struct fb_info *info) | |||
2902 | p = &fb_display[vc->vc_num]; | 2902 | p = &fb_display[vc->vc_num]; |
2903 | set_blitting_type(vc, info); | 2903 | set_blitting_type(vc, info); |
2904 | 2904 | ||
2905 | if (CON_IS_VISIBLE(vc)) { | 2905 | if (con_is_visible(vc)) { |
2906 | var_to_display(p, &info->var, info); | 2906 | var_to_display(p, &info->var, info); |
2907 | cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); | 2907 | cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
2908 | rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); | 2908 | rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
@@ -2941,7 +2941,7 @@ static void fbcon_set_all_vcs(struct fb_info *info) | |||
2941 | registered_fb[con2fb_map[i]] != info) | 2941 | registered_fb[con2fb_map[i]] != info) |
2942 | continue; | 2942 | continue; |
2943 | 2943 | ||
2944 | if (CON_IS_VISIBLE(vc)) { | 2944 | if (con_is_visible(vc)) { |
2945 | fg = i; | 2945 | fg = i; |
2946 | continue; | 2946 | continue; |
2947 | } | 2947 | } |
@@ -3180,7 +3180,7 @@ static void fbcon_fb_blanked(struct fb_info *info, int blank) | |||
3180 | registered_fb[con2fb_map[ops->currcon]] != info) | 3180 | registered_fb[con2fb_map[ops->currcon]] != info) |
3181 | return; | 3181 | return; |
3182 | 3182 | ||
3183 | if (CON_IS_VISIBLE(vc)) { | 3183 | if (con_is_visible(vc)) { |
3184 | if (blank) | 3184 | if (blank) |
3185 | do_blank_screen(0); | 3185 | do_blank_screen(0); |
3186 | else | 3186 | else |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index e280b3ceebd9..11576611a974 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -589,7 +589,7 @@ static void vgacon_init(struct vc_data *c, int init) | |||
589 | static void vgacon_deinit(struct vc_data *c) | 589 | static void vgacon_deinit(struct vc_data *c) |
590 | { | 590 | { |
591 | /* When closing the active console, reset video origin */ | 591 | /* When closing the active console, reset video origin */ |
592 | if (CON_IS_VISIBLE(c)) { | 592 | if (con_is_visible(c)) { |
593 | c->vc_visible_origin = vga_vram_base; | 593 | c->vc_visible_origin = vga_vram_base; |
594 | vga_set_mem_top(c); | 594 | vga_set_mem_top(c); |
595 | } | 595 | } |
@@ -860,7 +860,7 @@ static void vgacon_set_palette(struct vc_data *vc, const unsigned char *table) | |||
860 | { | 860 | { |
861 | #ifdef CAN_LOAD_PALETTE | 861 | #ifdef CAN_LOAD_PALETTE |
862 | if (vga_video_type != VIDEO_TYPE_VGAC || vga_palette_blanked | 862 | if (vga_video_type != VIDEO_TYPE_VGAC || vga_palette_blanked |
863 | || !CON_IS_VISIBLE(vc)) | 863 | || !con_is_visible(vc)) |
864 | return; | 864 | return; |
865 | vga_set_palette(vc, table); | 865 | vga_set_palette(vc, table); |
866 | #endif | 866 | #endif |
@@ -1248,7 +1248,7 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight) | |||
1248 | struct vc_data *c = vc_cons[i].d; | 1248 | struct vc_data *c = vc_cons[i].d; |
1249 | 1249 | ||
1250 | if (c && c->vc_sw == &vga_con) { | 1250 | if (c && c->vc_sw == &vga_con) { |
1251 | if (CON_IS_VISIBLE(c)) { | 1251 | if (con_is_visible(c)) { |
1252 | /* void size to cause regs to be rewritten */ | 1252 | /* void size to cause regs to be rewritten */ |
1253 | cursor_size_lastfrom = 0; | 1253 | cursor_size_lastfrom = 0; |
1254 | cursor_size_lastto = 0; | 1254 | cursor_size_lastto = 0; |
@@ -1312,7 +1312,7 @@ static int vgacon_resize(struct vc_data *c, unsigned int width, | |||
1312 | return success */ | 1312 | return success */ |
1313 | return (user) ? 0 : -EINVAL; | 1313 | return (user) ? 0 : -EINVAL; |
1314 | 1314 | ||
1315 | if (CON_IS_VISIBLE(c) && !vga_is_gfx) /* who knows */ | 1315 | if (con_is_visible(c) && !vga_is_gfx) /* who knows */ |
1316 | vgacon_doresize(c, width, height); | 1316 | vgacon_doresize(c, width, height); |
1317 | return 0; | 1317 | return 0; |
1318 | } | 1318 | } |
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index 5fa605c93428..a12d3f2899a8 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h | |||
@@ -168,6 +168,9 @@ extern void vc_SAK(struct work_struct *work); | |||
168 | 168 | ||
169 | #define CUR_DEFAULT CUR_UNDERLINE | 169 | #define CUR_DEFAULT CUR_UNDERLINE |
170 | 170 | ||
171 | #define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp) | 171 | static inline bool con_is_visible(const struct vc_data *vc) |
172 | { | ||
173 | return *vc->vc_display_fg == vc; | ||
174 | } | ||
172 | 175 | ||
173 | #endif /* _LINUX_CONSOLE_STRUCT_H */ | 176 | #endif /* _LINUX_CONSOLE_STRUCT_H */ |