...
Sort of related, I have been meaning to eliminate the
pointless __aligned(1) tags on rmnet structures defined
in <linux/if_rmnet.h>. It wouldn't hurt to use __packed,
though I think they're all 4 or 8 bytes naturally anyway.
Perhaps marking them __aligned(4) would help identify
potential unaligned accesses?
Don't use __packed (etc) unless the data might be misaligned.
If the architecture doesn't support misaligned memory
accesses then the compiler has to generate code that
does byte accesses and shifts.
__aligned(4) is mostly useful for structures that have
to have an 8-byte field on a 4-byte boundary.
(As happens in the x86 compat32 code.)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)