On Thu, Dec 12, 2002 at 11:32:07PM +0100, Oliver Neukum 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.
Ups. Thanks a lot. I suspected something like that...
> For 2.4 I suggest that you do the reset by hand. 2.5 will need to seperate
> physical and logical reset.
What do you mean by 'by hand'? Copy most of the reset code into my driver?
Greetings,
Oliver
--
Oh my, the stars!
me, first time I stared at the night sky with my new contact lenses
msg09981/pgp00000.pgp
Description: PGP signature
