ChangeSet 1.1083.2.5, 2003/08/28 11:05:43-07:00, abbotti@mev.co.uk [PATCH] USB: ftdi_sio - tidy up write bulk callback On Tuesday 19 Aug 2003 21:57, Greg KH wrote: > On Tue, Aug 19, 2003 at 05:14:28PM +0100, Ian Abbott wrote: > > The attached patch (usb-2.4-ftdi_sio-wbcbfix.patch) reinstates > > the port->open_count check in the ftdi_write_bulk_callback > > function, and should be applied after my earlier patch > > 'usb-2.4-ftdi_sio-wbcleanup.patch'. > > So you're just really getting rid of the "serial" pointer check, > right? That's fine, but can you send me just one patch that does > this instead? The attached patch combines the changes, but apart from a tiny reduction in code size, it doesn't achieve anything, but doesn't seem to cause any harm either. I'll leave it to your discretion whether or not to apply it. As I mentioned previously, leaving the port->open_count check in (to only schedule a soft interrupt when the port is open) seems to prevent an oops, but I suppose it just makes the oops less likely to happen rather than eliminate it entirely. drivers/usb/serial/ftdi_sio.c | 21 ++++++--------------- 1 files changed, 6 insertions(+), 15 deletions(-) diff -Nru a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c --- a/drivers/usb/serial/ftdi_sio.c Thu Aug 28 14:49:55 2003 +++ b/drivers/usb/serial/ftdi_sio.c Thu Aug 28 14:49:55 2003 @@ -17,6 +17,9 @@ * See http://ftdi-usb-sio.sourceforge.net for upto date testing info * and extra documentation * + * (19/Aug/2003) Ian Abbott + * Omitted some paranoid checks in write bulk callback that don't matter. + * * (05/Aug/2003) Ian Abbott * Added VID/PID for ID TECH IDT1221U USB to RS-232 adapter. * VID/PID provided by Steve Briggs. @@ -1451,33 +1454,21 @@ static void ftdi_write_bulk_callback (struct urb *urb) { struct usb_serial_port *port = (struct usb_serial_port *)urb->context; - struct usb_serial *serial; - - dbg("%s", __FUNCTION__); if (port_paranoia_check (port, __FUNCTION__)) return; + dbg("%s - port %d", __FUNCTION__, port->number); + if (urb->status) { dbg("nonzero write bulk status received: %d", urb->status); return; } - serial = get_usb_serial (port, __FUNCTION__); - if (!serial) { - dbg("%s - bad serial pointer, exiting", __FUNCTION__); - return; - } - - /* Have to check for validity of queueing up the tasks */ - dbg("%s - port->open_count = %d", __FUNCTION__, port->open_count); - if (port->open_count > 0){ queue_task(&port->tqueue, &tq_immediate); mark_bh(IMMEDIATE_BH); - } - - return; + } } /* ftdi_write_bulk_callback */