Re: [linux-usb-devel] [PATCH] USB: consolidate error values from EHCI, UHCI and OHCI _suspend()

From: David Brownell
Date: Tue Sep 19 2006 - 14:11:36 EST


On Tuesday 19 September 2006 3:43 am, Jiri Kosina wrote:

> (by the way, EHCI and OHCI seem to have broken (read: missing) locking
> when accessing the hcd->state. Should I fix it by per-hcd spinlock, or
> does the patch already exist somewhere?)

They should only ever access it while holding their internal spinlocks;
which are held during most driver operations, easy to miss. And except
for hardware faults, the HCD state changes only when usbcore pushes an
HCD through driver model state transitions like probe(), suspend(), and
their inverses. I see some dodgey code in the OHCI IRQ handler, but
even that shouldn't make trouble.

Admittedly the usbcore access to that field is a bit problematic, since
it doesn't handle the hardware faulting cases very cleanly. For those
cases, other problems are more severe ... like basic cleanup of all the
pending transactions, and removal of the usb devices, didn't work the
last time I tripped over such cases.


Eventually we want hcd->state to vanish, but until it does it sure seems
like a problem if usbcore can't rely on all HCDs to treat it the same.

- Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/