提交 5e8588c8 编写于 作者: G Geert Uytterhoeven

pinctrl: sh-pfc: Validate fixed-size field widths at build time

Add a build-time check, to ensure the register and field widths in
descriptors for config registers with fixed-width fields are sane.
This helps catching bugs early.
Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: NSimon Horman <horms+renesas@verge.net.au>
上级 0e6e448b
...@@ -126,7 +126,8 @@ struct pinmux_cfg_reg { ...@@ -126,7 +126,8 @@ struct pinmux_cfg_reg {
* one for each possible combination of the register field bit values. * one for each possible combination of the register field bit values.
*/ */
#define PINMUX_CFG_REG(name, r, r_width, f_width) \ #define PINMUX_CFG_REG(name, r, r_width, f_width) \
.reg = r, .reg_width = r_width, .field_width = f_width, \ .reg = r, .reg_width = r_width, \
.field_width = f_width + BUILD_BUG_ON_ZERO(r_width % f_width), \
.enum_ids = (const u16 [(r_width / f_width) * (1 << f_width)]) .enum_ids = (const u16 [(r_width / f_width) * (1 << f_width)])
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册