void usb_serial_generic_write_bulk_callback(struct urb *urb) { unsigned long flags; struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s - port %d", __func__, port->number); if (port->serial->type->max_in_flight_urbs) { kfree(urb->transfer_buffer); spin_lock_irqsave(&port->lock, flags); --port->urbs_in_flight; port->tx_bytes_flight -= urb->transfer_buffer_length; if (port->urbs_in_flight < 0) port->urbs_in_flight = 0; spin_unlock_irqrestore(&port->lock, flags); } else { port->write_urb_busy = 0; if (status) kfifo_reset_out(&port->write_fifo); else usb_serial_generic_write_start(port); } if (status) dbg("%s - non-zero urb status: %d", __func__, status); usb_serial_port_softint(port); }
static void sierra_outdat_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; struct sierra_port_private *portdata = usb_get_serial_port_data(port); struct sierra_intf_private *intfdata; int status = urb->status; intfdata = usb_get_serial_data(port->serial); /* free up the transfer buffer, as usb_free_urb() does not do this */ kfree(urb->transfer_buffer); usb_autopm_put_interface_async(port->serial->interface); if (status) dev_dbg(&port->dev, "%s - nonzero write bulk status " "received: %d\n", __func__, status); spin_lock(&portdata->lock); --portdata->outstanding_urbs; spin_unlock(&portdata->lock); spin_lock(&intfdata->susp_lock); --intfdata->in_flight; spin_unlock(&intfdata->susp_lock); usb_serial_port_softint(port); }
void usb_serial_generic_write_bulk_callback(struct urb *urb) { unsigned long flags; struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s - port %d", __func__, port->number); if (port->serial->type->max_in_flight_urbs) { spin_lock_irqsave(&port->lock, flags); --port->urbs_in_flight; port->tx_bytes_flight -= urb->transfer_buffer_length; if (port->urbs_in_flight < 0) port->urbs_in_flight = 0; spin_unlock_irqrestore(&port->lock, flags); } else { /* Handle the case for single urb mode */ port->write_urb_busy = 0; } if (status) { dbg("%s - nonzero write bulk status received: %d", __func__, status); return; } usb_serial_port_softint(port); }
void usb_serial_generic_write_bulk_callback(struct urb *urb) { unsigned long flags; struct usb_serial_port *port = urb->context; int status = urb->status; int i; for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) if (port->write_urbs[i] == urb) break; spin_lock_irqsave(&port->lock, flags); port->tx_bytes -= urb->transfer_buffer_length; set_bit(i, &port->write_urbs_free); spin_unlock_irqrestore(&port->lock, flags); if (status) { dev_dbg(&port->dev, "%s - non-zero urb status: %d\n", __func__, status); spin_lock_irqsave(&port->lock, flags); kfifo_reset_out(&port->write_fifo); spin_unlock_irqrestore(&port->lock, flags); } else { usb_serial_generic_write_start(port); } usb_serial_port_softint(port); }
static void option_outdat_callback(struct urb *urb) { struct usb_serial_port *port; dbg("%s", __FUNCTION__); port = (struct usb_serial_port *) urb->context; usb_serial_port_softint(port); }
/* Outdat handling is common for all devices */ static void usa2x_outdat_callback(struct urb *urb) { struct usb_serial_port *port; struct keyspan_port_private *p_priv; port = urb->context; p_priv = usb_get_serial_port_data(port); dbg("%s - urb %d", __func__, urb == p_priv->out_urbs[1]); usb_serial_port_softint(port); }
void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs) { struct usb_serial_port *port = (struct usb_serial_port *)urb->context; dbg("%s - port %d", __FUNCTION__, port->number); port->write_urb_busy = 0; if (urb->status) { dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); return; } usb_serial_port_softint(port); }
static void hsictty_write_callback(struct urb *urb) { struct usb_serial_port *port; struct hsictty_port_private *portdata; struct hsictty_intf_private *intfdata; int i; port = urb->context; intfdata = usb_get_serial_data(port->serial); portdata = usb_get_serial_port_data(port); if (urb->actual_length <= 0) { hsictty_error ("%s: write failed, write length: %d in channel:%d, endpoint:%d\n", __func__, urb->actual_length, portdata->channel, usb_pipeendpoint(urb->pipe)); } else { hsictty_dbg("%s: write length: %d in channel:%d, endpoint:%d\n", __func__, urb->actual_length, portdata->channel, usb_pipeendpoint(urb->pipe)); } #ifdef BACKUP_DATA_DUMP if (!dumped) backup_log(portdata->channel, 1, urb->transfer_buffer, urb->transfer_buffer_length); #endif usb_serial_port_softint(port); usb_autopm_put_interface_async(port->serial->interface); portdata = usb_get_serial_port_data(port); spin_lock(&intfdata->susp_lock); intfdata->in_flight--; spin_unlock(&intfdata->susp_lock); for (i = 0; i < N_OUT_URB; ++i) { if (portdata->out_urbs[i] == urb) { smp_mb__before_clear_bit(); hsictty_dbg ("%s: urb(%d) freed on channel:%d, endpoint:%d, in_flight:%d, pm use cnt:%d\n", __func__, i, portdata->channel, usb_pipeendpoint(urb->pipe), intfdata->in_flight, atomic_read(&port->serial->interface->dev.power. usage_count)); clear_bit(i, &portdata->out_busy); complete_all(&portdata->tx_notifier); break; } } }
static void ipw_write_bulk_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s", __func__); port->write_urb_busy = 0; if (status) dbg("%s - nonzero write bulk status received: %d", __func__, status); usb_serial_port_softint(port); }
static void omninet_write_bulk_callback (struct urb *urb, struct pt_regs *regs) { /* struct omninet_header *header = (struct omninet_header *) urb->transfer_buffer; */ struct usb_serial_port *port = (struct usb_serial_port *) urb->context; dbg("%s - port %0x\n", __FUNCTION__, port->number); port->write_urb_busy = 0; if (urb->status) { dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); return; } usb_serial_port_softint(port); }
void usb_serial_generic_write_bulk_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s - port %d", __func__, port->number); port->write_urb_busy = 0; if (status) { dbg("%s - nonzero write bulk status received: %d", __func__, status); return; } usb_serial_port_softint(port); }
static void empeg_write_bulk_callback (struct urb *urb) { struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s - port %d", __FUNCTION__, port->number); if (status) { dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, status); return; } usb_serial_port_softint(port); }
static void omninet_write_bulk_callback(struct urb *urb) { /* struct omninet_header *header = (struct omninet_header *) urb->transfer_buffer; */ struct usb_serial_port *port = urb->context; int status = urb->status; set_bit(0, &port->write_urbs_free); if (status) { dev_dbg(&port->dev, "%s - nonzero write bulk status received: %d\n", __func__, status); return; } usb_serial_port_softint(port); }
static void qt2_write_bulk_callback(struct urb *urb) { struct usb_serial_port *port; struct qt2_port_private *port_priv; port = urb->context; port_priv = usb_get_serial_port_data(port); spin_lock(&port_priv->urb_lock); port_priv->urb_in_use = false; usb_serial_port_softint(port); spin_unlock(&port_priv->urb_lock); }
static void qt2_write_bulk_callback(struct urb *urb) { struct usb_serial_port *port; struct qt2_port_private *port_priv; unsigned long flags; port = urb->context; port_priv = usb_get_serial_port_data(port); spin_lock_irqsave(&port_priv->urb_lock, flags); port_priv->urb_in_use = false; usb_serial_port_softint(port); spin_unlock_irqrestore(&port_priv->urb_lock, flags); }
static void omninet_write_bulk_callback(struct urb *urb) { /* struct omninet_header *header = (struct omninet_header *) urb->transfer_buffer; */ struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s - port %0x", __func__, port->number); port->write_urb_busy = 0; if (status) { dbg("%s - nonzero write bulk status received: %d", __func__, status); return; } usb_serial_port_softint(port); }
static void opticon_write_bulk_callback(struct urb *urb) { struct opticon_private *priv = urb->context; int status = urb->status; unsigned long flags; kfree(urb->transfer_buffer); if (status) dbg("%s - nonzero write bulk status received: %d", __func__, status); spin_lock_irqsave(&priv->lock, flags); --priv->outstanding_urbs; spin_unlock_irqrestore(&priv->lock, flags); usb_serial_port_softint(priv->port); }
static void airprime_write_bulk_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; struct airprime_private *priv = usb_get_serial_port_data(port); int status = urb->status; unsigned long flags; dbg("%s - port %d", __FUNCTION__, port->number); /* free up the transfer buffer, as usb_free_urb() does not do this */ kfree (urb->transfer_buffer); if (status) dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, status); spin_lock_irqsave(&priv->lock, flags); --priv->outstanding_urbs; spin_unlock_irqrestore(&priv->lock, flags); usb_serial_port_softint(port); }
static void modem_write_bulk_callback(struct urb *urb) { struct ap_wb *wb = urb->context; int status = urb->status; struct modem_port *modem_port_ptr = wb->instance; struct usb_serial_port *port = modem_port_ptr->port; unsigned long flags; if (port == NULL) return; spin_lock_irqsave(&modem_port_ptr->write_lock, flags); modem_write_done(modem_port_ptr, wb); spin_unlock_irqrestore(&modem_port_ptr->write_lock, flags); if (status) { dev_err(&port->dev, "%s: status non-zero. status = %d\n", __func__, status); return; } usb_serial_port_softint(port); }
static void option_outdat_callback(struct urb *urb) { struct usb_serial_port *port; struct option_port_private *portdata; int i; dbg("%s", __func__); port = urb->context; usb_serial_port_softint(port); portdata = usb_get_serial_port_data(port); for (i = 0; i < N_OUT_URB; ++i) { if (portdata->out_urbs[i] == urb) { smp_mb__before_clear_bit(); clear_bit(i, &portdata->out_busy); break; } } }
static void opticon_write_control_callback(struct urb *urb) { struct opticon_private *priv = urb->context; int status = urb->status; unsigned long flags; /* free up the transfer buffer, as usb_free_urb() does not do this */ kfree(urb->transfer_buffer); /* setup packet may be set if we're using it for writing */ kfree(urb->setup_packet); if (status) dbg("%s - nonzero write bulk status received: %d", __func__, status); spin_lock_irqsave(&priv->lock, flags); --priv->outstanding_urbs; spin_unlock_irqrestore(&priv->lock, flags); usb_serial_port_softint(priv->port); }
static void sierra_outdat_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; struct sierra_port_private *portdata = usb_get_serial_port_data(port); int status = urb->status; unsigned long flags; dev_dbg(&port->dev, "%s - port %d", __func__, port->number); /* free up the transfer buffer, as usb_free_urb() does not do this */ kfree(urb->transfer_buffer); if (status) dev_dbg(&port->dev, "%s - nonzero write bulk status " "received: %d", __func__, status); spin_lock_irqsave(&portdata->lock, flags); --portdata->outstanding_urbs; spin_unlock_irqrestore(&portdata->lock, flags); usb_serial_port_softint(port); }
static void ir_write_bulk_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; int status = urb->status; dbg("%s - port %d", __func__, port->number); port->write_urb_busy = 0; if (status) { dbg("%s - nonzero write bulk status received: %d", __func__, status); return; } usb_serial_debug_data( debug, &port->dev, __func__, urb->actual_length, urb->transfer_buffer); usb_serial_port_softint(port); }
static void garmin_write_bulk_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; if (port) { struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); if (GARMIN_LAYERID_APPL == getLayerId(urb->transfer_buffer)) { if (garmin_data_p->mode == MODE_GARMIN_SERIAL) { gsp_send_ack(garmin_data_p, ((__u8 *)urb->transfer_buffer)[4]); } } usb_serial_port_softint(port); } /* Ignore errors that resulted from garmin_write_bulk with dismiss_ack = 1 */ /* free up the transfer buffer, as usb_free_urb() does not do this */ kfree(urb->transfer_buffer); }
static void cyberjack_write_bulk_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; struct cyberjack_private *priv = usb_get_serial_port_data(port); int status = urb->status; dbg("%s - port %d", __func__, port->number); port->write_urb_busy = 0; if (status) { dbg("%s - nonzero write bulk status received: %d", __func__, status); return; } spin_lock(&priv->lock); if (priv->wrfilled) { int length, blksize, result; dbg("%s - transmitting data (frame n)", __func__); length = ((priv->wrfilled - priv->wrsent) > port->bulk_out_size) ? port->bulk_out_size : (priv->wrfilled - priv->wrsent); memcpy(port->write_urb->transfer_buffer, priv->wrbuf + priv->wrsent, length); priv->wrsent += length; usb_fill_bulk_urb(port->write_urb, port->serial->dev, usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress), port->write_urb->transfer_buffer, length, ((port->serial->type->write_bulk_callback) ? port->serial->type->write_bulk_callback : cyberjack_write_bulk_callback), port); result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __func__, result); priv->wrfilled = 0; priv->wrsent = 0; goto exit; } dbg("%s - priv->wrsent=%d", __func__, priv->wrsent); dbg("%s - priv->wrfilled=%d", __func__, priv->wrfilled); blksize = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3; if (priv->wrsent >= priv->wrfilled || priv->wrsent >= blksize) { dbg("%s - buffer cleaned", __func__); memset(priv->wrbuf, 0, sizeof(priv->wrbuf)); priv->wrfilled = 0; priv->wrsent = 0; } } exit: spin_unlock(&priv->lock); usb_serial_port_softint(port); }
static void cyberjack_write_bulk_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; struct cyberjack_private *priv = usb_get_serial_port_data(port); struct device *dev = &port->dev; int status = urb->status; set_bit(0, &port->write_urbs_free); if (status) { dev_dbg(dev, "%s - nonzero write bulk status received: %d\n", __func__, status); return; } spin_lock(&priv->lock); /* only do something if we have more data to send */ if (priv->wrfilled) { int length, blksize, result; dev_dbg(dev, "%s - transmitting data (frame n)\n", __func__); length = ((priv->wrfilled - priv->wrsent) > port->bulk_out_size) ? port->bulk_out_size : (priv->wrfilled - priv->wrsent); memcpy(port->write_urb->transfer_buffer, priv->wrbuf + priv->wrsent, length); priv->wrsent += length; /* set up our urb */ port->write_urb->transfer_buffer_length = length; /* send the data out the bulk port */ result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { dev_err(dev, "%s - failed submitting write urb, error %d\n", __func__, result); /* Throw away data. No better idea what to do with it. */ priv->wrfilled = 0; priv->wrsent = 0; goto exit; } dev_dbg(dev, "%s - priv->wrsent=%d\n", __func__, priv->wrsent); dev_dbg(dev, "%s - priv->wrfilled=%d\n", __func__, priv->wrfilled); blksize = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3; if (priv->wrsent >= priv->wrfilled || priv->wrsent >= blksize) { dev_dbg(dev, "%s - buffer cleaned\n", __func__); memset(priv->wrbuf, 0, sizeof(priv->wrbuf)); priv->wrfilled = 0; priv->wrsent = 0; } } exit: spin_unlock(&priv->lock); usb_serial_port_softint(port); }