| @@ -277,8 +277,15 @@ static void notify_update(struct vc_data *vc) · 276 unmodified lines |
| 277 | 277 | * Low-Level Functions |
| 278 | 278 | */ |
| 279 | 279 | |
| 280 | | −#define IS_FG(vc) ((vc)->vc_num == fg_console) |
| 281 | | −#define DO_UPDATE(vc) (CON_IS_VISIBLE(vc) && !console_blanked) |
| 280 | +static inline bool con_is_fg(const struct vc_data *vc) |
| 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 | 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) · 31 unmodified lines |
| 316 | 323 | nr = b - t - 1; |
| 317 | 324 | if (b > vc->vc_rows || t >= b || nr < 1) |
| 318 | 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 | 327 | return; |
| 321 | 328 | d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); |
| 322 | 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) · 11 unmodified lines |
| 334 | 341 | nr = b - t - 1; |
| 335 | 342 | if (b > vc->vc_rows || t >= b || nr < 1) |
| 336 | 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 | 345 | return; |
| 339 | 346 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); |
| 340 | 347 | step = vc->vc_cols * nr; |
| @@ -390,7 +397,7 @@ void update_region(struct vc_data *vc, unsigned long start, int count) · 49 unmodified lines |
| 390 | 397 | { |
| 391 | 398 | WARN_CONSOLE_UNLOCKED(); |
| 392 | 399 | |
| 393 | | − if (DO_UPDATE(vc)) { |
| 400 | + if (con_should_update(vc)) { |
| 394 | 401 | hide_cursor(vc); |
| 395 | 402 | do_update_region(vc, start, count); |
| 396 | 403 | set_cursor(vc); |
| @@ -490,7 +497,7 @@ void invert_screen(struct vc_data *vc, int offset, int count, int viewed) · 93 unmodified lines |
| 490 | 497 | } |
| 491 | 498 | } |
| 492 | 499 | |
| 493 | | − if (DO_UPDATE(vc)) |
| 500 | + if (con_should_update(vc)) |
| 494 | 501 | do_update_region(vc, (unsigned long) p, count); |
| 495 | 502 | notify_update(vc); |
| 496 | 503 | } |
| @@ -507,7 +514,7 @@ void complement_pos(struct vc_data *vc, int offset) · 10 unmodified lines |
| 507 | 514 | if (old_offset != -1 && old_offset >= 0 && |
| 508 | 515 | old_offset < vc->vc_screenbuf_size) { |
| 509 | 516 | scr_writew(old, screenpos(vc, old_offset, 1)); |
| 510 | | − if (DO_UPDATE(vc)) |
| 517 | + if (con_should_update(vc)) |
| 511 | 518 | vc->vc_sw->con_putc(vc, old, oldy, oldx); |
| 512 | 519 | notify_update(vc); |
| 513 | 520 | } |
| @@ -522,7 +529,7 @@ void complement_pos(struct vc_data *vc, int offset) · 8 unmodified lines |
| 522 | 529 | old = scr_readw(p); |
| 523 | 530 | new = old ^ vc->vc_complement_mask; |
| 524 | 531 | scr_writew(new, p); |
| 525 | | − if (DO_UPDATE(vc)) { |
| 532 | + if (con_should_update(vc)) { |
| 526 | 533 | oldx = (offset >> 1) % vc->vc_cols; |
| 527 | 534 | oldy = (offset >> 1) / vc->vc_cols; |
| 528 | 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) · 9 unmodified lines |
| 538 | 545 | scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x - nr) * 2); |
| 539 | 546 | scr_memsetw(p, vc->vc_video_erase_char, nr * 2); |
| 540 | 547 | vc->vc_need_wrap = 0; |
| 541 | | − if (DO_UPDATE(vc)) |
| 548 | + if (con_should_update(vc)) |
| 542 | 549 | do_update_region(vc, (unsigned long) p, |
| 543 | 550 | vc->vc_cols - vc->vc_x); |
| 544 | 551 | } |
| @@ -551,7 +558,7 @@ static void delete_char(struct vc_data *vc, unsigned int nr) · 6 unmodified lines |
| 551 | 558 | scr_memsetw(p + vc->vc_cols - vc->vc_x - nr, vc->vc_video_erase_char, |
| 552 | 559 | nr * 2); |
| 553 | 560 | vc->vc_need_wrap = 0; |
| 554 | | − if (DO_UPDATE(vc)) |
| 561 | + if (con_should_update(vc)) |
| 555 | 562 | do_update_region(vc, (unsigned long) p, |
| 556 | 563 | vc->vc_cols - vc->vc_x); |
| 557 | 564 | } |
| @@ -571,7 +578,7 @@ static void add_softcursor(struct vc_data *vc) · 13 unmodified lines |
| 571 | 578 | if ((type & 0x20) && ((softcursor_original & 0x7000) == (i & 0x7000))) i ^= 0x7000; |
| 572 | 579 | if ((type & 0x40) && ((i & 0x700) == ((i & 0x7000) >> 4))) i ^= 0x0700; |
| 573 | 580 | scr_writew(i, (u16 *) vc->vc_pos); |
| 574 | | − if (DO_UPDATE(vc)) |
| 581 | + if (con_should_update(vc)) |
| 575 | 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) · 1 unmodified line |
| 579 | 586 | { |
| 580 | 587 | if (softcursor_original != -1) { |
| 581 | 588 | scr_writew(softcursor_original, (u16 *)vc->vc_pos); |
| 582 | | − if (DO_UPDATE(vc)) |
| 589 | + if (con_should_update(vc)) |
| 583 | 590 | vc->vc_sw->con_putc(vc, softcursor_original, |
| 584 | 591 | vc->vc_y, vc->vc_x); |
| 585 | 592 | softcursor_original = -1; |
| @@ -596,8 +603,7 @@ static void hide_cursor(struct vc_data *vc) · 10 unmodified lines |
| 596 | 603 | |
| 597 | 604 | static void set_cursor(struct vc_data *vc) |
| 598 | 605 | { |
| 599 | | − if (!IS_FG(vc) || console_blanked || |
| 600 | | − vc->vc_mode == KD_GRAPHICS) |
| 606 | + if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS) |
| 601 | 607 | return; |
| 602 | 608 | if (vc->vc_deccm) { |
| 603 | 609 | if (vc == sel_cons) |
| @@ -613,7 +619,7 @@ static void set_origin(struct vc_data *vc) · 9 unmodified lines |
| 613 | 619 | { |
| 614 | 620 | WARN_CONSOLE_UNLOCKED(); |
| 615 | 621 | |
| 616 | | − if (!CON_IS_VISIBLE(vc) || |
| 622 | + if (!con_is_visible(vc) || |
| 617 | 623 | !vc->vc_sw->con_set_origin || |
| 618 | 624 | !vc->vc_sw->con_set_origin(vc)) |
| 619 | 625 | vc->vc_origin = (unsigned long)vc->vc_screenbuf; |
| @@ -661,12 +667,12 @@ void redraw_screen(struct vc_data *vc, int is_switch) · 41 unmodified lines |
| 661 | 667 | struct vc_data *old_vc = vc_cons[fg_console].d; |
| 662 | 668 | if (old_vc == vc) |
| 663 | 669 | return; |
| 664 | | − if (!CON_IS_VISIBLE(vc)) |
| 670 | + if (!con_is_visible(vc)) |
| 665 | 671 | redraw = 1; |
| 666 | 672 | *vc->vc_display_fg = vc; |
| 667 | 673 | fg_console = vc->vc_num; |
| 668 | 674 | hide_cursor(old_vc); |
| 669 | | − if (!CON_IS_VISIBLE(old_vc)) { |
| 675 | + if (!con_is_visible(old_vc)) { |
| 670 | 676 | save_screen(old_vc); |
| 671 | 677 | set_origin(old_vc); |
| 672 | 678 | } |
| @@ -941,7 +947,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, · 268 unmodified lines |
| 941 | 947 | tty_do_resize(tty, &ws); |
| 942 | 948 | } |
| 943 | 949 | |
| 944 | | − if (CON_IS_VISIBLE(vc)) |
| 950 | + if (con_is_visible(vc)) |
| 945 | 951 | update_screen(vc); |
| 946 | 952 | vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); |
| 947 | 953 | return err; |
| @@ -1171,7 +1177,7 @@ static void csi_J(struct vc_data *vc, int vpar) · 223 unmodified lines |
| 1171 | 1177 | scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char, |
| 1172 | 1178 | vc->vc_screenbuf_size >> 1); |
| 1173 | 1179 | set_origin(vc); |
| 1174 | | − if (CON_IS_VISIBLE(vc)) |
| 1180 | + if (con_is_visible(vc)) |
| 1175 | 1181 | update_screen(vc); |
| 1176 | 1182 | /* fall through */ |
| 1177 | 1183 | case 2: /* erase whole display */ |
| @@ -1182,7 +1188,7 @@ static void csi_J(struct vc_data *vc, int vpar) · 4 unmodified lines |
| 1182 | 1188 | return; |
| 1183 | 1189 | } |
| 1184 | 1190 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); |
| 1185 | | − if (DO_UPDATE(vc)) |
| 1191 | + if (con_should_update(vc)) |
| 1186 | 1192 | do_update_region(vc, (unsigned long) start, count); |
| 1187 | 1193 | vc->vc_need_wrap = 0; |
| 1188 | 1194 | } |
| @@ -1210,7 +1216,7 @@ static void csi_K(struct vc_data *vc, int vpar) · 21 unmodified lines |
| 1210 | 1216 | } |
| 1211 | 1217 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); |
| 1212 | 1218 | vc->vc_need_wrap = 0; |
| 1213 | | − if (DO_UPDATE(vc)) |
| 1219 | + if (con_should_update(vc)) |
| 1214 | 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 · 6 unmodified lines |
| 1223 | 1229 | count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar; |
| 1224 | 1230 | |
| 1225 | 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 | 1233 | vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count); |
| 1228 | 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 · 978 unmodified lines |
| 2208 | 2214 | charmask = himask ? 0x1ff : 0xff; |
| 2209 | 2215 | |
| 2210 | 2216 | /* undraw cursor first */ |
| 2211 | | − if (IS_FG(vc)) |
| 2217 | + if (con_is_fg(vc)) |
| 2212 | 2218 | hide_cursor(vc); |
| 2213 | 2219 | |
| 2214 | 2220 | param.vc = vc; |
| @@ -2380,7 +2386,7 @@ rescan_last_byte: · 165 unmodified lines |
| 2380 | 2386 | ((vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) : |
| 2381 | 2387 | (vc_attr << 8) + tc, |
| 2382 | 2388 | (u16 *) vc->vc_pos); |
| 2383 | | − if (DO_UPDATE(vc) && draw_x < 0) { |
| 2389 | + if (con_should_update(vc) && draw_x < 0) { |
| 2384 | 2390 | draw_x = vc->vc_x; |
| 2385 | 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) · 177 unmodified lines |
| 2564 | 2570 | goto quit; |
| 2565 | 2571 | |
| 2566 | 2572 | /* undraw cursor first */ |
| 2567 | | − if (IS_FG(vc)) |
| 2573 | + if (con_is_fg(vc)) |
| 2568 | 2574 | hide_cursor(vc); |
| 2569 | 2575 | |
| 2570 | 2576 | start = (ushort *)vc->vc_pos; |
| @@ -2575,7 +2581,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) · 4 unmodified lines |
| 2575 | 2581 | c = *b++; |
| 2576 | 2582 | if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { |
| 2577 | 2583 | if (cnt > 0) { |
| 2578 | | − if (CON_IS_VISIBLE(vc)) |
| 2584 | + if (con_is_visible(vc)) |
| 2579 | 2585 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); |
| 2580 | 2586 | vc->vc_x += cnt; |
| 2581 | 2587 | if (vc->vc_need_wrap) |
| @@ -2607,7 +2613,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) · 25 unmodified lines |
| 2607 | 2613 | myx++; |
| 2608 | 2614 | } |
| 2609 | 2615 | if (cnt > 0) { |
| 2610 | | − if (CON_IS_VISIBLE(vc)) |
| 2616 | + if (con_is_visible(vc)) |
| 2611 | 2617 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); |
| 2612 | 2618 | vc->vc_x += cnt; |
| 2613 | 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, · 540 unmodified lines |
| 3154 | 3160 | |
| 3155 | 3161 | j = i; |
| 3156 | 3162 | |
| 3157 | | − if (CON_IS_VISIBLE(vc)) { |
| 3163 | + if (con_is_visible(vc)) { |
| 3158 | 3164 | k = i; |
| 3159 | 3165 | save_screen(vc); |
| 3160 | 3166 | } |