Hi, On Wed, Sep 08, 2004 at 10:41:09AM -0400, Alan Stern wrote: > On Wed, 8 Sep 2004, Andreas Mohr wrote: > > Also, it unnecessarily calculates hdc->state *twice* before and > > during the IRQ sharing check, so in total it should use > > if (start == USB_STATE_HALT) /* irq sharing? */ > > return IRQ_NONE; > > instead, which now should be quite faster. > > With all due respect, let me point out that you don't know what you're > talking about. > > That unlikely() _really_ does cover an unlikely case -- the case where the > device is turned off. That's what USB_STATE_HALT means. It is indeed > very unlikely for the device to be turned off, since the HC drivers always > leave their devices on unless they encounter an unrecoverable error. ...e.g. triggering USB over-current monitoring by connecting one of my trusty and bulky HDDs.
> I imagine you were misled by the comment to think that it really was > testing for IRQ sharing. But it isn't; the implication behind the comment > is that _if_ the device is off then the IRQ _must_ be shared, since the > device couldn't have generated it. The _real_ test for IRQ sharing occurs > lower down, where it says: > > if (hcd->driver->irq (hcd, r) == IRQ_NONE) > return IRQ_NONE; Right, now it all makes perfect sense. The only work remaining may be to check individual driver IRQ handlers whether they return an IRQ_NONE immediately or not (in sharing case). But given the rather good code in the hcd irq handler, I suspect that they're doing just fine. > As for replacing "hcd->state" by "start" in the body of the unlikely(), > yes, that could be done. Any decent compiler will do it for you, > automatically. The cost of a single extra dereference is minimal in any > case. Sure, I expected this to easily get optimized away by gcc in some or even most cases, but the code itself could still make every (useful) effort to optimize itself. Thanks, Andreas "should go back to his dark little corner" Mohr ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
