direct-io.hg

changeset 8467:7ab6ddd6ada9

reorganize code to avoid duplication

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Sat Dec 31 15:58:44 2005 +0000 (2005-12-31)
parents 9270bb6b0421
children 0d93a85b5fa4
files linux-2.6-xen-sparse/drivers/xen/console/console.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c	Sat Dec 31 14:20:01 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c	Sat Dec 31 15:58:44 2005 +0000
     1.3 @@ -314,39 +314,31 @@ static void __xencons_tx_flush(void)
     1.4  {
     1.5  	int sent, sz, work_done = 0;
     1.6  
     1.7 -	if (xen_start_info->flags & SIF_INITDOMAIN) {
     1.8 -		if (x_char) {
     1.9 +	if (x_char) {
    1.10 +		if (xen_start_info->flags & SIF_INITDOMAIN) {
    1.11 +			while (x_char)
    1.12 +				if (xencons_ring_send(&x_char, 1) == 1)
    1.13 +					break;
    1.14 +		} else
    1.15  			kcons_write_dom0(NULL, &x_char, 1);
    1.16 -			x_char = 0;
    1.17 -			work_done = 1;
    1.18 -		}
    1.19 +		x_char = 0;
    1.20 +		work_done = 1;
    1.21 +	}
    1.22  
    1.23 -		while (wc != wp) {
    1.24 -			sz = wp - wc;
    1.25 -			if (sz > (wbuf_size - WBUF_MASK(wc)))
    1.26 -				sz = wbuf_size - WBUF_MASK(wc);
    1.27 +	while (wc != wp) {
    1.28 +		sz = wp - wc;
    1.29 +		if (sz > (wbuf_size - WBUF_MASK(wc)))
    1.30 +			sz = wbuf_size - WBUF_MASK(wc);
    1.31 +		if (xen_start_info->flags & SIF_INITDOMAIN) {
    1.32  			kcons_write_dom0(NULL, &wbuf[WBUF_MASK(wc)], sz);
    1.33  			wc += sz;
    1.34 -			work_done = 1;
    1.35 -		}
    1.36 -	} else {
    1.37 -		while (x_char) {
    1.38 -			if (xencons_ring_send(&x_char, 1) == 1) {
    1.39 -				x_char = 0;
    1.40 -				work_done = 1;
    1.41 -			}
    1.42 -		}
    1.43 -
    1.44 -		while (wc != wp) {
    1.45 -			sz = wp - wc;
    1.46 -			if (sz > (wbuf_size - WBUF_MASK(wc)))
    1.47 -				sz = wbuf_size - WBUF_MASK(wc);
    1.48 +		} else {
    1.49  			sent = xencons_ring_send(&wbuf[WBUF_MASK(wc)], sz);
    1.50  			if (sent == 0)
    1.51  				break;
    1.52  			wc += sent;
    1.53 -			work_done = 1;
    1.54  		}
    1.55 +		work_done = 1;
    1.56  	}
    1.57  
    1.58  	if (work_done && (xencons_tty != NULL)) {