RE: [PATCH 31/68] uas: Pack iu struct definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Of Hans de Goede
> 
> The iu struct definitions are usb packet definitions, so no alignment should
> happen. Notice that assuming 32 bit alignment this does not make any
> difference at all.
> 
> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
> ---
>  include/linux/usb/uas.h | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/usb/uas.h b/include/linux/usb/uas.h
> index 772b66b..3fc8e8b 100644
> --- a/include/linux/usb/uas.h
> +++ b/include/linux/usb/uas.h
> @@ -9,7 +9,7 @@ struct iu {
>  	__u8 iu_id;
>  	__u8 rsvd1;
>  	__be16 tag;
> -};
> +} __attribute__((__packed__));

Won't this cause the compiler to generate multiple byte accesses
for the 'tag' field in systems that don't support misaligned
accesses.

I'd have thought that 'packed' should only be specified on structures
that are likely to be misaligned in memory.
The memory for usb packets should probably be 4 byte aligned (at least)
for dma efficiency.
(Unless they contain ethernet frames when you want 4n+2 alignment).

	David



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux