diff options
author | Jiri Slaby <jslaby@suse.cz> | 2016-06-23 11:34:30 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-06-25 16:04:48 (GMT) |
commit | d711ea8f762eec3bc057bc92423c6ec804523a40 (patch) | |
tree | d5544b753db9c9f8a7641ce181a6861671eda362 /drivers/tty | |
parent | 6af39ed30264691994647daba07a416830f674b2 (diff) | |
download | linux-d711ea8f762eec3bc057bc92423c6ec804523a40.tar.xz |
tty: vt, get rid of ugly FLUSH macro
It's a macro accessing and changing some local variables. And the code
uses it without appending semicolon which confuses everybody too.
Switch from this bad guy to a sane standard function.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/vt/vt.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 600c3bb..6e12d9c 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -2163,14 +2163,20 @@ static int is_double_width(uint32_t ucs) return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1); } +static void con_flush(struct vc_data *vc, unsigned long draw_from, + unsigned long draw_to, int *draw_x) +{ + if (*draw_x < 0) + return; + + vc->vc_sw->con_putcs(vc, (u16 *)draw_from, + (u16 *)draw_to - (u16 *)draw_from, vc->vc_y, *draw_x); + *draw_x = -1; +} + /* acquires console_lock */ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) { -#define FLUSH if (draw_x >= 0) { \ - vc->vc_sw->con_putcs(vc, (u16 *)draw_from, (u16 *)draw_to - (u16 *)draw_from, vc->vc_y, draw_x); \ - draw_x = -1; \ - } - int c, tc, ok, n = 0, draw_x = -1; unsigned int currcons; unsigned long draw_from = 0, draw_to = 0; @@ -2362,12 +2368,13 @@ rescan_last_byte: } else { vc_attr = ((vc->vc_attr) & 0x88) | (((vc->vc_attr) & 0x70) >> 4) | (((vc->vc_attr) & 0x07) << 4); } - FLUSH + con_flush(vc, draw_from, draw_to, &draw_x); } while (1) { if (vc->vc_need_wrap || vc->vc_decim) - FLUSH + con_flush(vc, draw_from, draw_to, + &draw_x); if (vc->vc_need_wrap) { cr(vc); lf(vc); @@ -2397,9 +2404,8 @@ rescan_last_byte: } notify_write(vc, c); - if (inverse) { - FLUSH - } + if (inverse) + con_flush(vc, draw_from, draw_to, &draw_x); if (rescan) { rescan = 0; @@ -2410,15 +2416,14 @@ rescan_last_byte: } continue; } - FLUSH + con_flush(vc, draw_from, draw_to, &draw_x); do_con_trol(tty, vc, orig); } - FLUSH + con_flush(vc, draw_from, draw_to, &draw_x); console_conditional_schedule(); console_unlock(); notify_update(vc); return n; -#undef FLUSH } /* |