On Thu, Sep 24, 2009 at 09:02:17PM +0200, Oliver Neukum wrote: > Am Donnerstag, 24. September 2009 17:19:11 schrieb Johan Hovold: > > On Thu, Sep 24, 2009 at 03:21:25PM +0200, Oliver Neukum wrote: > > Agree on open, but is such a flag for cancelling the tasklets always > > necessary? > > Yes :-) > > > --- a/drivers/usb/serial/ftdi_sio.c > > +++ b/drivers/usb/serial/ftdi_sio.c > > @@ -1787,12 +1787,12 @@ static void ftdi_close(struct usb_serial_port > > *port) > > > > dbg("%s", __func__); > > > > + /* shutdown our bulk read */ > > + usb_kill_urb(port->read_urb); > > And here's the window that screws things up. If you hit that window > the read_urb isn't submitted, usb_kill_urb() is a nop, > but after it has run,the tasklet can submit the urb again. > Indeed. :) > > /* cancel any scheduled reading */ > > cancel_delayed_work_sync(&priv->rx_work); > > You can, if you wish to hide what's going on, poison the urb. The > correct sequence is: > > 1. poison the urb > 2. cancel_delayed_work_sync > > 3. unpoison the urb <snip> > Step 1 sets a flag. And this is what we generally want to be doing I assume, rather than adding an explicit state flag? Thanks, Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html