typedef struct dmar_atsr_entry { u16 type; u16 length; u8 flags; u8 reserved; u16 segment; } __attribute__ ((packed)) dmar_atsr_entry_t;
Looking at the original example here, I would still recommend not to use the packed attribute. It forces the compiler to use accesses that would work on unaligned data... for x86 that doesn't matter (and granted, this sounds x86-specific, but it's worth applying the same principles to all code), but for other architectures it may generate very inefficient code (even on ARM where unaligned accesses are okay after you turn on caching, GCC keeps doing this for all packed structures and there's no way to convince it otherwise). In this case, the members are all correctly aligned so there's no need to insert padding, so you can (and therefore should) leave out the packed attribute.