On Thu, Dec 12, 2002, Oliver Neukum <[EMAIL PROTECTED]> wrote: > Am Donnerstag, 12. Dezember 2002 18:34 schrieb Oliver Kurth: > > Hello! > > > > I am currently trying to write a driver for a wireless usb adapter. There > > already is a driver existing, but it is buggy, the code is messy, and > > so I do not even want to try to fix it. So I thought this is a good > > opportunity to learn writing device drivers. > > > > The driver needs to load a (propritary) firmware to the device. I do > > this in the probe() function, and the first part of it works. After > > downloading, it has to call usb_reset_device() (at least the old > > driver does). When I do this, the driver hangs. > > > > Before the reset, there are a lot of calls to usb_control_msg(), all > > of them work as expected. Then it sleeps for 2 seconds, using > > > > set_current_state(TASK_INTERRUPTIBLE); > > schedule_timeout(2*HZ); > > > > Shortly after that, usb_reset_device() is called, and it hangs. > > > > I haven't set any locks. > > You haven't but usbcore has. > down(&driver->serialize); > private = driver->probe(dev,ifnum,id); > up(&driver->serialize); > This is how probe() is called. > down(&driver->serialize); > driver->disconnect(dev, interface->private_data); > up(&driver->serialize); > And this is how disconnect() is called. The deadlock is obvious. > > For 2.4 I suggest that you do the reset by hand. 2.5 will need to seperate > physical and logical reset.
It doesn't look obvious to me. usb_reset_device() doesn't trigger any probe() or disconnect() processing. That is unless the driver actually does what the comment for usb_reset_device() says and does all of the disconnect() by hand. JE ------------------------------------------------------- This sf.net email is sponsored by: With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel http://hpc.devchannel.org/ _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
