if (port->write_urb->status == -EINPROGRESS) { dbg ("%s - already writing", __FUNCTION__); return (0); 
spin_lock(&port->lock); if (port->write_urb_busy) { spin_unlock(&port->lock); dbg("%s - already writing", __FUNCTION__); return 0; 
static int safe_write (struct usb_serial_port *port, const unsigned char *buf, int count){	unsigned char *data;	int result;	int i;	int packet_length;	dbg ("safe_write port: %p %d urb: %p count: %d", port, port->number, port->write_urb,	     count);	if (!port->write_urb) {		dbg ("%s - write urb NULL", __FUNCTION__);		return (0);	}	dbg ("safe_write write_urb: %d transfer_buffer_length",	     port->write_urb->transfer_buffer_length);	if (!port->write_urb->transfer_buffer_length) {		dbg ("%s - write urb transfer_buffer_length zero", __FUNCTION__);		return (0);	}	if (count == 0) {		dbg ("%s - write request of 0 bytes", __FUNCTION__);		return (0);	}	if (port->write_urb->status == -EINPROGRESS) {		dbg ("%s - already writing", __FUNCTION__);		return (0);	}	packet_length = port->bulk_out_size;	// get max packetsize	i = packet_length - (safe ? 2 : 0);	// get bytes to send	count = (count > i) ? i : count;	// get the data into the transfer buffer	data = port->write_urb->transfer_buffer;	memset (data, '0', packet_length);	memcpy (data, buf, count);	if (safe) {		__u16 fcs;		// pad if necessary		if (!padded) {			packet_length = count + 2;		}		// set count		data[packet_length - 2] = count << 2;		data[packet_length - 1] = 0;		// compute fcs and insert into trailer		fcs = fcs_compute10 (data, packet_length, CRC10_INITFCS);		data[packet_length - 2] |= fcs >> 8;		data[packet_length - 1] |= fcs & 0xff;		// set length to send		port->write_urb->transfer_buffer_length = packet_length;	} else {		port->write_urb->transfer_buffer_length = count;	}	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, port->write_urb->transfer_buffer);#ifdef ECHO_TX	{		int i;		unsigned char *cp = port->write_urb->transfer_buffer;		for (i = 0; i < port->write_urb->transfer_buffer_length; i++) {			if ((i % 32) == 0) {				printk ("\nsu[%02x] ", i);			}			printk ("%02x ", *cp++);		}		printk ("\n");	}#endif	port->write_urb->dev = port->serial->dev;	if ((result = usb_submit_urb (port->write_urb, GFP_KERNEL))) {		err ("%s - failed submitting write urb, error %d", __FUNCTION__, result);		return 0;	}	dbg ("%s urb: %p submitted", __FUNCTION__, port->write_urb);	return (count);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/507ca9bc0476662f3463888d583864834eab1e11/safe_serial.c/clean/drivers/usb/serial/safe_serial.c