mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
USB: serial: digi_acceleport: clean up write completion
Clean up the write completion handler by adding a temporary variable for the transfer buffer and using the pre-existing urb pointer while dropping some redundant casts. Signed-off-by: Johan Hovold <johan@kernel.org>
This commit is contained in:
parent
6016799d33
commit
cc94b7b0cd
|
|
@ -943,6 +943,7 @@ static void digi_write_bulk_callback(struct urb *urb)
|
|||
struct usb_serial_port *port = urb->context;
|
||||
struct digi_serial *serial_priv = usb_get_serial_data(port->serial);
|
||||
struct digi_port *priv = usb_get_serial_port_data(port);
|
||||
unsigned char *data = urb->transfer_buffer;
|
||||
unsigned long flags;
|
||||
bool wakeup;
|
||||
int ret = 0;
|
||||
|
|
@ -962,15 +963,13 @@ static void digi_write_bulk_callback(struct urb *urb)
|
|||
spin_lock_irqsave(&priv->dp_port_lock, flags);
|
||||
priv->dp_write_urb_in_use = 0;
|
||||
if (priv->dp_out_buf_len > 0) {
|
||||
*((unsigned char *)(port->write_urb->transfer_buffer))
|
||||
= (unsigned char)DIGI_CMD_SEND_DATA;
|
||||
*((unsigned char *)(port->write_urb->transfer_buffer) + 1)
|
||||
= (unsigned char)priv->dp_out_buf_len;
|
||||
port->write_urb->transfer_buffer_length =
|
||||
priv->dp_out_buf_len + 2;
|
||||
memcpy(port->write_urb->transfer_buffer + 2, priv->dp_out_buf,
|
||||
priv->dp_out_buf_len);
|
||||
ret = usb_submit_urb(port->write_urb, GFP_ATOMIC);
|
||||
data[0] = DIGI_CMD_SEND_DATA;
|
||||
data[1] = priv->dp_out_buf_len;
|
||||
memcpy(data + 2, priv->dp_out_buf, priv->dp_out_buf_len);
|
||||
|
||||
urb->transfer_buffer_length = priv->dp_out_buf_len + 2;
|
||||
|
||||
ret = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (ret == 0) {
|
||||
priv->dp_write_urb_in_use = 1;
|
||||
priv->dp_out_buf_len = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user