short rdtodo; /* Bytes still to read */
unsigned char wrbuf[5*64]; /* Buffer for collecting data to write */
short wrfilled; /* Overall data size we already got */
- short wrsent; /* Data akready sent */
+ short wrsent; /* Data already sent */
};
/* do some startup allocations not currently performed by usb_serial_probe() */
dbg("%s - usb_clear_halt", __FUNCTION__ );
usb_clear_halt(port->serial->dev, port->write_urb->pipe);
- usb_clear_halt(port->serial->dev, port->read_urb->pipe);
- usb_clear_halt(port->serial->dev, port->interrupt_in_urb->pipe);
/* force low_latency on so that our tty_push actually forces
* the data through, otherwise it is scheduled, and with high
unsigned long flags;
int result;
int wrexpected;
- unsigned char localbuf[CYBERJACK_LOCAL_BUF_SIZE]; /* Buffer for collecting data to write */
dbg("%s - port %d", __FUNCTION__, port->number);
dbg("%s - from_user %d", __FUNCTION__, from_user);
spin_lock_irqsave(&priv->lock, flags);
- if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ||
- (count>sizeof(localbuf)) ) {
- /* To much data for buffer. Reset buffer. */
+ if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ) {
+ /* To much data for buffer. Reset buffer. */
priv->wrfilled=0;
spin_unlock_irqrestore(&priv->lock, flags);
return (0);
}
- spin_unlock_irqrestore(&priv->lock, flags);
-
/* Copy data */
if (from_user) {
- if (copy_from_user(localbuf, buf, count)) {
+ if (copy_from_user(priv->wrbuf+priv->wrfilled, buf, count)) {
+ spin_unlock_irqrestore(&priv->lock, flags);
return -EFAULT;
}
} else {
- memcpy (localbuf, buf, count);
+ memcpy (priv->wrbuf+priv->wrfilled, buf, count);
}
- spin_lock_irqsave(&priv->lock, flags);
-
- memcpy (priv->wrbuf+priv->wrfilled, localbuf, count);
-
usb_serial_debug_data (__FILE__, __FUNCTION__, count,
priv->wrbuf+priv->wrfilled);
priv->wrfilled += count;