On Thu, Apr 18, 2002, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I have now seen for the second time a BUG() at usb.h:1074
>       usb_dec_dev_use() called by
>       uhci_free_qh() called by
>       uhci_free_pending_qhs() called by
>       uhci_interrupt() called by handle_IRQ_event().
> 
> Since it is not easily reproducible, I have not attempted
> to trace what happens.
> 
> [Versions of the sddr09 driver for 2.4.19pre4 and 2.5.8
> are now on ftp.linux.org. Comments are welcome.]

It's because of this ill conceived code:

/**
 * usb_dec_dev_use - drop a reference to a device
 * @dev: the device no longer being referenced
 *
 * Each live reference to a device should be refcounted.
 *
 * Drivers for USB interfaces should normally release such references in
 * their disconnect() methods, and record them in probe().
 *
 * Note that driver disconnect() methods must guarantee that when they
 * return, all of their outstanding references to the device (and its
 * interfaces) are cleaned up.  That means that all pending URBs from
 * this driver must have completed, and that no more copies of the device
 * handle are saved in driver records (including other kernel threads).
 */
static inline void usb_dec_dev_use (struct usb_device *dev)
{
        if (atomic_dec_and_test (&dev->refcnt)) {
                /* May only go to zero when usbcore finishes
                 * usb_disconnect() processing:  khubd or HCDs.
                 *
                 * If you hit this BUG() it's likely a problem
                 * with some driver's disconnect() routine.
                 */
                BUG ();
        }
}

This totally defeats the purpose of what reference counting is used for,
which is so we don't have to synchronize across different parts of the
code. Reference counting makes it easier and now it looks like in 2.5
that we want to make things more complicated. We've reduced reference
counting solely to find bugs.

JE


_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to