int usb_serial_generic_resume(struct usb_serial *serial) { struct usb_serial_port *port; int i, c = 0, r; for (i = 0; i < serial->num_ports; i++) { port = serial->port[i]; if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) continue; if (port->bulk_in_size) { r = usb_serial_generic_submit_read_urbs(port, GFP_NOIO); if (r < 0) c++; } if (port->bulk_out_size) { r = usb_serial_generic_write_start(port); if (r < 0) c++; } } return c ? -EIO : 0; }
void usb_serial_generic_unthrottle(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; int was_throttled; spin_lock_irq(&port->lock); was_throttled = port->throttled; port->throttled = port->throttle_req = 0; spin_unlock_irq(&port->lock); if (was_throttled) usb_serial_generic_submit_read_urbs(port, GFP_KERNEL); }
int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port) { int result = 0; unsigned long flags; spin_lock_irqsave(&port->lock, flags); port->throttled = 0; port->throttle_req = 0; spin_unlock_irqrestore(&port->lock, flags); if (port->bulk_in_size) result = usb_serial_generic_submit_read_urbs(port, GFP_KERNEL); return result; }
void usb_serial_generic_unthrottle(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; int was_throttled; dbg("%s - port %d", __func__, port->number); /* Clear the throttle flags */ spin_lock_irq(&port->lock); was_throttled = port->throttled; port->throttled = port->throttle_req = 0; spin_unlock_irq(&port->lock); if (was_throttled) usb_serial_generic_submit_read_urbs(port, GFP_KERNEL); }
int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port) { int result = 0; unsigned long flags; /* clear the throttle flags */ spin_lock_irqsave(&port->lock, flags); port->throttled = 0; port->throttle_req = 0; spin_unlock_irqrestore(&port->lock, flags); /* if we have a bulk endpoint, start reading from it */ if (port->bulk_in_size) result = usb_serial_generic_submit_read_urbs(port, GFP_KERNEL); return result; }