/* mos7720_chars_in_buffer this function is called by the tty driver when it wants to know how many bytes of data we currently have outstanding in the port (data that has been written, but hasn't made it out the port yet) If successful, we return the number of bytes left to be written in the system, Otherwise we return a negative error number.  */
static int mos7720_chars_in_buffer(struct tty_struct *tty)
/* mos7720_chars_in_buffer this function is called by the tty driver when it wants to know how many bytes of data we currently have outstanding in the port (data that has been written, but hasn't made it out the port yet) If successful, we return the number of bytes left to be written in the system, Otherwise we return a negative error number.  */
static int mos7720_chars_in_buffer(struct tty_struct *tty)
{
	struct usb_serial_port *port = tty->driver_data;
	int i;
	int chars = 0;
	struct moschip_port *mos7720_port;
	dbg("%s:entering ...........", __func__);
	mos7720_port = usb_get_serial_port_data(port);
	if (mos7720_port == NULL) {
		dbg("%s:leaving ...........", __func__);
		return 0;
	}
	for (i = 0; i < NUM_URBS; ++i) {
		if (mos7720_port->write_urb_pool[i] &&
		    mos7720_port->write_urb_pool[i]->status == -EINPROGRESS)
			chars += URB_TRANSFER_BUFFER_SIZE;
	}
	dbg("%s - returns %d", __func__, chars);
	return chars;
}