/* Returns the number of characters actually written, which may be anything from zero to @count. If an error occurs, it returns the negative errno value.  */
int usb_serial_generic_write(struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count)
/* Returns the number of characters actually written, which may be anything from zero to @count. If an error occurs, it returns the negative errno value.  */
int usb_serial_generic_write(struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count)
{
	struct usb_serial *serial = port->serial;
	int result;
	dbg("%s - port %d", __func__, port->number);
	if (count == 0) {
		dbg("%s - write request of 0 bytes", __func__);
		return 0;
	}
	if (!serial->num_bulk_out)
		return 0;
	if (serial->type->max_in_flight_urbs)
		return usb_serial_multi_urb_write(tty, port,
						  buf, count);
	count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock);
	result = usb_serial_generic_write_start(port);
	if (result >= 0)
		result = count;
	return result;
}