init: use type alignment for kernel parameters
authorJohan Hovold <johan@kernel.org>
Mon, 23 Nov 2020 10:23:16 +0000 (11:23 +0100)
committerJessica Yu <jeyu@kernel.org>
Tue, 1 Dec 2020 09:46:27 +0000 (10:46 +0100)
commit147ad605dc12c515c97136899ccb5c70e6c674e1
tree11d052f977f46490f8e353612bf3ef17b4b5e4f7
parent2aec389e19150ed3bf67ab708f2435563f76050f
init: use type alignment for kernel parameters

Specify type alignment for kernel parameters instead of sizeof(long).

The alignment attribute is used to prevent gcc from increasing the
alignment of objects with static extent as an optimisation, something
which would mess up the __setup array stride.

Using __alignof__(struct obs_kernel_param) rather than sizeof(long) is
preferred since it better indicates why it is there and doesn't break
should the type size or alignment change.

Note that on m68k the alignment of struct obs_kernel_param is actually
two and that adding a 1- or 2-byte field to the 12-byte struct would
cause a breakage with the current 4-byte alignment.

Link: https://lore.kernel.org/lkml/20201103175711.10731-1-johan@kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
include/linux/init.h