int hsictty_suspend(struct usb_serial *serial, pm_message_t message) { struct hsictty_intf_private *intfdata = usb_get_serial_data(serial); int b; hsictty_dbg ("%s entered,PM type:(%x:%s), pm cnt:%d, intfdata->in_flight:%d\n", __func__, message.event, (message.event & PM_EVENT_AUTO) ? "auto suspend" : "no auto suspend", atomic_read(&serial->interface->dev.power.usage_count), intfdata->in_flight); if (message.event & PM_EVENT_AUTO) { spin_lock_irq(&intfdata->susp_lock); b = intfdata->in_flight; spin_unlock_irq(&intfdata->susp_lock); if (b) return -EBUSY; } spin_lock_irq(&intfdata->susp_lock); intfdata->suspended = 1; spin_unlock_irq(&intfdata->susp_lock); stop_read_write_urbs(serial); return 0; }
static int option_suspend(struct usb_serial *serial, pm_message_t message) { dbg("%s entered", __func__); stop_read_write_urbs(serial); return 0; }
static int sierra_suspend(struct usb_serial *serial, pm_message_t message) { struct sierra_intf_private *intfdata = usb_get_serial_data(serial); spin_lock_irq(&intfdata->susp_lock); if (PMSG_IS_AUTO(message)) { if (intfdata->in_flight) { spin_unlock_irq(&intfdata->susp_lock); return -EBUSY; } } intfdata->suspended = 1; spin_unlock_irq(&intfdata->susp_lock); stop_read_write_urbs(serial); return 0; }
static void option_shutdown(struct usb_serial *serial) { int i, j; struct usb_serial_port *port; struct option_port_private *portdata; dbg("%s", __func__); stop_read_write_urbs(serial); /* Now free them */ for (i = 0; i < serial->num_ports; ++i) { port = serial->port[i]; portdata = usb_get_serial_port_data(port); for (j = 0; j < N_IN_URB; j++) { if (portdata->in_urbs[j]) { usb_free_urb(portdata->in_urbs[j]); free_page((unsigned long) portdata->in_buffer[j]); portdata->in_urbs[j] = NULL; } } for (j = 0; j < N_OUT_URB; j++) { if (portdata->out_urbs[j]) { usb_free_urb(portdata->out_urbs[j]); kfree(portdata->out_buffer[j]); portdata->out_urbs[j] = NULL; } } } /* Now free per port private data */ for (i = 0; i < serial->num_ports; i++) { port = serial->port[i]; kfree(usb_get_serial_port_data(port)); } }
static void option_disconnect(struct usb_serial *serial) { dbg("%s", __func__); stop_read_write_urbs(serial); }