Re: [PATCH 1/7] USB: add urb->ep

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Mon, 30 Jul 2007, David Brownell wrote:

> On Monday 30 July 2007, Alan Stern wrote:
> >                 /* power of two? */
> > -               while (temp > urb->interval)
> > -                       temp >>= 1;
> > -               urb->interval = temp;
> > +               while (max > urb->interval)
> > +                       max >>= 1;
> > +               urb->interval = max;
> 
> #include <linux/log2.h>
> 
> 	if (urb->interval > max)
> 		urb->interval = max
> 	else
> 		urb->interval = ilog2(urb->interval);
> 
> or somesuch?  That previous code is a bit opaque, and the
> loop can often be replaced by a single instruction.

That's a good suggestion.  I'll put it in a "cleanup" patch.

> Related:  consider making urb->interval and its neighbors
> be "u32" or maybe even "u16".

Hmmm... maybe.  It's not clear the space savings would matter much; I 
doubt that terribly many URBs ever get allocated at the same time.  And 
while it's true that the values should never be negative, there's not 
much incentive to change the type to unsigned.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.