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>
This commit is contained in:
Jiri Slaby 2016-06-23 13:34:30 +02:00 committed by Greg Kroah-Hartman
parent 6af39ed302
commit d711ea8f76

View File

@ -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 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
} 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 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
}
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 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
}
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
}
/*