static int ch341_reset_resume(struct usb_interface *intf) { struct usb_device *dev = interface_to_usbdev(intf); struct usb_serial *serial = NULL; struct ch341_private *priv; serial = usb_get_intfdata(intf); priv = usb_get_serial_port_data(serial->port[0]); /*reconfigure ch341 serial port after bus-reset*/ ch341_configure(dev, priv); usb_serial_resume(intf); return 0; }
/*=========================================================================== METHOD: GobiResume (Free Method) DESCRIPTION: Restart URBs killed during usb_serial_suspend Fixes 2 bugs in 2.6.23 kernel 1. pSerial->type->resume was NULL and unchecked, caused crash. 2. set_to_generic_if_null was not run for resume. PARAMETERS: pIntf [ I ] - Pointer to interface RETURN VALUE: int - 0 for success negative errno for failure ===========================================================================*/ int GobiResume( struct usb_interface * pIntf ) { struct usb_serial * pSerial = usb_get_intfdata( pIntf ); struct usb_serial_port * pPort; int portIndex, errors, nResult; if (pSerial == NULL) { DBG( "no pSerial\n" ); return -ENOMEM; } if (pSerial->type == NULL) { DBG( "no pSerial->type\n" ); return ENOMEM; } if (pSerial->type->resume == NULL) { // Expected behaviour in 2.6.23, in later kernels this was handled // by the usb-serial driver and usb_serial_generic_resume errors = 0; for (portIndex = 0; portIndex < pSerial->num_ports; portIndex++) { pPort = pSerial->port[portIndex]; if (pPort->open_count > 0 && pPort->read_urb != NULL) { nResult = usb_submit_urb( pPort->read_urb, GFP_NOIO ); if (nResult < 0) { // Return first error we see DBG( "error %d\n", nResult ); return nResult; } } } // Success return 0; } // Execution would only reach this point if user has // patched version of usb-serial driver. return usb_serial_resume( pIntf ); }
/* --SSD_RIL */ int usb_serial_reset_resume(struct usb_interface *intf) { pr_info("%s intf %p\n", __func__, intf); return usb_serial_resume(intf); }