From: Simon Horman <horms@verge.net.au>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Linus Walleij <linus.walleij@linaro.org>,
linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH v2 01/10] pinctrl: sh-pfc: Validate fixed-size field widths at build time
Date: Mon, 28 Jan 2019 13:27:52 +0100 [thread overview]
Message-ID: <20190128122752.duimvrycnspdrko4@verge.net.au> (raw)
In-Reply-To: <20190125165305.8567-2-geert+renesas@glider.be>
On Fri, Jan 25, 2019 at 05:52:56PM +0100, Geert Uytterhoeven wrote:
> 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: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v2:
> - Convert from run-time to build-time check.
Nice :)
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
> ---
> drivers/pinctrl/sh-pfc/sh_pfc.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
> index 46d477ff510921f3..56016cb76769c97b 100644
> --- a/drivers/pinctrl/sh-pfc/sh_pfc.h
> +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
> @@ -126,7 +126,8 @@ struct pinmux_cfg_reg {
> * one for each possible combination of the register field bit values.
> */
> #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)])
>
> /*
> --
> 2.17.1
>
next prev parent reply other threads:[~2019-01-28 12:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 16:52 [PATCH v2 00/10] pinctrl: sh-pfc: Validation and compile-testing Geert Uytterhoeven
2019-01-25 16:52 ` [PATCH v2 01/10] pinctrl: sh-pfc: Validate fixed-size field widths at build time Geert Uytterhoeven
2019-01-28 12:27 ` Simon Horman [this message]
2019-01-25 16:52 ` [PATCH v2 02/10] pinctrl: sh-pfc: Validate pinmux tables at runtime when debugging Geert Uytterhoeven
2019-02-15 8:17 ` Simon Horman
2019-02-15 8:43 ` Geert Uytterhoeven
2019-01-25 16:52 ` [PATCH v2 03/10 PARTIAL] pinctrl: sh-pfc: Absorb enum IDs in PINMUX_CFG_REG() macro Geert Uytterhoeven
2019-01-25 16:52 ` [PATCH v2 04/10 PARTIAL] pinctrl: sh-pfc: Absorb enum IDs in PINMUX_CFG_REG_VAR() macro Geert Uytterhoeven
2019-01-25 16:53 ` [PATCH v2 05/10 PARTIAL] pinctrl: sh-pfc: Absorb enum IDs in PINMUX_DATA_REG() macro Geert Uytterhoeven
2019-01-25 16:53 ` [PATCH v2 06/10] pinctrl: sh-pfc: Validate enum IDs for regs with fixed-width fields Geert Uytterhoeven
2019-01-25 16:53 ` [PATCH v2 07/10] pinctrl: sh-pfc: Validate enum IDs for regs with variable-width fields Geert Uytterhoeven
2019-01-25 16:53 ` [PATCH v2 08/10] pinctrl: sh-pfc: Introduce PINCTRL_SH_FUNC_GPIO helper symbol Geert Uytterhoeven
2019-01-25 16:53 ` [PATCH v2 09/10] pinctrl: sh-pfc: Add missing #include <linux/errno.h> Geert Uytterhoeven
2019-01-25 16:53 ` [PATCH v2 10/10] pinctrl: sh-pfc: Allow compile-testing of all drivers Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190128122752.duimvrycnspdrko4@verge.net.au \
--to=horms@verge.net.au \
--cc=geert+renesas@glider.be \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).