On Thu, Dec 12, 2002 at 06:06:31PM -0500, Johannes Erdfelt wrote:
> 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.

The driver does not.

I also tried to call up(&driver->serialize); just before the reset, and it
does not help.

So the problem is probably somewhere else...

Greetings,
Oliver
-- 
Oh my, the stars!
       me, first time I stared at the night sky with my new contact lenses

Attachment: msg09984/pgp00000.pgp
Description: PGP signature

Reply via email to