On Wednesday 15 June 2005 3:30 am, Jochen Karrer wrote:
> 
>  le16_to_cpus(&hub->descriptor->wHubCharacteristics); /* This triggers two
> alignment exceptions */
>  if (hub->descriptor->wHubCharacteristics & HUB_CHAR_COMPOUND) { /* This
> works */

This is a good example of a place where <asm/unaligned.h> helps ... 
modulo issues about when GCC discards the "packed" attribute!

On the other hand, the internals of the hub driver would seem to be
a place that missed out on the updates making USB code leave all the
descriptors in USB-standard (little endian) byte order.

A better fix in this case might be to leave the byteorder alone and
just 

        if (...->wHubCharacteristics & cpu_to_le16(HUB_CHAR_COMPOUND)) {
                ...
        }

Feel free to take up the GCC query on GCC lists, but I think this
bit of USB code should just be updated to follow the same policy
as the other USB code:  don't byteswap the in-memory desriptors.

I notice that in "hub.h" that field is declared "__u16" instead of
being "__le16" as it should be ... make that change and "sparse"
will remind you of all the places that need to change.   (Or
maybe it's "sparse -Wbitwise"; have the toplevel makefile do that
for you.)

- Dave



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to