OSDN Git Service

firmware: cirrus: cs_dsp: Avoid padding bytes in cs_dsp_coeff_ctl
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Mon, 25 Apr 2022 09:51:59 +0000 (10:51 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 25 Apr 2022 12:59:02 +0000 (13:59 +0100)
commit430c3500995484962bdbccf358201afef8055535
tree38367209c9a46e0c51c7f79b0e59ceda05ad7144
parentcc691ba94cf8d6c586076ed489bb9d385a2650ad
firmware: cirrus: cs_dsp: Avoid padding bytes in cs_dsp_coeff_ctl

Change the order of members in struct cs_dsp_coeff_ctl to avoid
the compiler having to insert alignment padding bytes. On a x86_64
build this saves 16 bytes per control.

- Pointers are collected to the top of the struct (with the exception of
  priv, as noted below), so that they are inherently aligned.
- The set and enable bitflags are placed together so they can be merged.
- priv is placed at the end of the struct - it is for use by the
  client so it is helpful to make it stand out, and since the compiler
  will always pad the struct size to an alignment multiple putting a
  pointer last won't introduce any more padding.
- struct cs_dsp_alg_region is placed at the end, right before priv, for
  the same reasoning as priv.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220425095159.3044527-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/linux/firmware/cirrus/cs_dsp.h