diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2007-02-22 16:37:53 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-23 15:03:46 -0800 |
commit | 672027a35795ec95f516fdc702ba8900d55a9eef (patch) | |
tree | 76d4a091a53edfef3ff1868ede58dbbb90e086fe /include/linux/usb/ch9.h | |
parent | 822c7ef48b06332168530284781640856621d9f4 (diff) | |
download | kernel_samsung_tuna-672027a35795ec95f516fdc702ba8900d55a9eef.zip kernel_samsung_tuna-672027a35795ec95f516fdc702ba8900d55a9eef.tar.gz kernel_samsung_tuna-672027a35795ec95f516fdc702ba8900d55a9eef.tar.bz2 |
USB: add rationale on why usb descriptor structures have to be packed
Add argumentation in defense of using __attribute__((packed)) in USB
descriptors authored by Dave Brownell. Necessary as in some cases it
seems superfluous.
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb/ch9.h')
-rw-r--r-- | include/linux/usb/ch9.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 245c725..1122a6c 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -1,8 +1,9 @@ /* - * This file holds USB constants and structures that are needed for USB - * device APIs. These are used by the USB device model, which is defined - * in chapter 9 of the USB 2.0 specification. Linux has several APIs in C - * that need these: + * This file holds USB constants and structures that are needed for + * USB device APIs. These are used by the USB device model, which is + * defined in chapter 9 of the USB 2.0 specification and in the + * Wireless USB 1.0 (spread around). Linux has several APIs in C that + * need these: * * - the master/host side Linux-USB kernel driver API; * - the "usbfs" user space API; and @@ -14,6 +15,19 @@ * * There's also "Wireless USB", using low power short range radios for * peripheral interconnection but otherwise building on the USB framework. + * + * Note all descriptors are declared '__attribute__((packed))' so that: + * + * [a] they never get padded, either internally (USB spec writers + * probably handled that) or externally; + * + * [b] so that accessing bigger-than-a-bytes fields will never + * generate bus errors on any platform, even when the location of + * its descriptor inside a bundle isn't "naturally aligned", and + * + * [c] for consistency, removing all doubt even when it appears to + * someone that the two other points are non-issues for that + * particular descriptor type. */ #ifndef __LINUX_USB_CH9_H |