• S
    USB: xhci: Remove packed attribute from structures. · 98441973
    Sarah Sharp 提交于
    The packed attribute allows gcc to muck with the alignment of data
    structures, which may lead to byte-wise writes that break atomicity of
    writes.  Packed should only be used when the compile may add undesired
    padding to the structure.  Each element of the structure will be aligned
    by C based on its size and the size of the elements around it.  E.g. a u64
    would be aligned on an 8 byte boundary, the next u32 would be aligned on a
    four byte boundary, etc.
    
    Since most of the xHCI structures contain only u32 bit values, removing
    the packed attribute for them should be harmless.  (A future patch will
    change some of the twin 32-bit address fields to one 64-bit field, but all
    those places have an even number of 32-bit fields before them, so the
    alignment should be correct.)  Add BUILD_BUG_ON statements to check that
    the compiler doesn't add padding to the data structures that have a
    hardware-defined layout.
    
    While we're modifying the registers, change the name of intr_reg to
    xhci_intr_reg to avoid global conflicts.
    Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
    98441973
xhci-dbg.c 14.9 KB