(I'm so sorry!) Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

USB: serial: add generic write control callbacks

Some USB serial devices use device-specific flow control to determine whether write submission may proceed. The generic write path currently provides no way to pause submission based on driver-specific state. It also provides no way for a driver to restore its state if URB submission fails. Add an optional write_ready() callback to struct usb_serial_driver. Call it with port->lock held after confirming that data is queued and a write URB is available. If the callback returns false, stop write processing and leave the data in the FIFO. The driver must call usb_serial_generic_write_start() when writes may proceed again. Add an optional write_rollback() callback for restoring driver-specific state after usb_submit_urb() fails. Call it with port->lock held after restoring the generic transmit accounting, and pass it the length of the prepared transfer. Drivers which do not provide these callbacks retain the existing generic write behaviour. Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com> Signed-off-by: Johan Hovold <johan@kernel.org>


Author Crescent Hsieh Committer Johan Hovold Date Commit Parent a3ad29ec
+16 -3
2 changed files
+16 -3
2 changed files