static int sx_write(struct tty_struct * tty,                     const unsigned char *buf, int count){	struct specialix_port *port = (struct specialix_port *)tty->driver_data;	struct specialix_board *bp;	int c, total = 0;	unsigned long flags;	func_enter();	if (sx_paranoia_check(port, tty->name, "sx_write")) {		func_exit();		return 0;	}		bp = port_Board(port);	if (!tty || !port->xmit_buf || !tmp_buf) {		func_exit();		return 0;	}	while (1) {		spin_lock_irqsave(&port->lock, flags);		c = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,				   SERIAL_XMIT_SIZE - port->xmit_head));		if (c <= 0) {			spin_unlock_irqrestore(&port->lock, flags);			break;		}		memcpy(port->xmit_buf + port->xmit_head, buf, c);		port->xmit_head = (port->xmit_head + c) & (SERIAL_XMIT_SIZE-1);		port->xmit_cnt += c;		spin_unlock_irqrestore(&port->lock, flags);		buf += c;		count -= c;		total += c;	}	spin_lock_irqsave(&bp->lock, flags);	if (port->xmit_cnt && !tty->stopped && !tty->hw_stopped &&	    !(port->IER & IER_TXRDY)) {		port->IER |= IER_TXRDY;		sx_out(bp, CD186x_CAR, port_No(port));		sx_out(bp, CD186x_IER, port->IER);	}	spin_unlock_irqrestore(&bp->lock, flags);	func_exit();	return total;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d61780c0d384939ef31c46b47442854d5def4623/specialix.c/buggy/drivers/char/specialix.c