linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 6/6] pinctrl: sh-pfc: Validate pins/marks in pin group at build time
Date: Thu, 13 Dec 2018 17:28:55 +0100	[thread overview]
Message-ID: <20181213162855.14190-7-geert+renesas@glider.be> (raw)
In-Reply-To: <20181213162855.14190-1-geert+renesas@glider.be>

Add a build-time check, to ensure the number of pins and pin marks in a
pin group matches.  This helps catching bugs early.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 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 78dc342d7b390e02..a2c5d530aaa1c0b3 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -41,7 +41,8 @@ struct sh_pfc_pin {
 		.name = #alias,				\
 		.pins = n##_pins,			\
 		.mux = n##_mux,				\
-		.nr_pins = ARRAY_SIZE(n##_pins),	\
+		.nr_pins = ARRAY_SIZE(n##_pins) +	\
+		BUILD_BUG_ON_ZERO(!(sizeof(n##_pins) == sizeof(n##_mux))), \
 	}
 #define SH_PFC_PIN_GROUP(n)	SH_PFC_PIN_GROUP_ALIAS(n, n)
 
-- 
2.17.1


  parent reply	other threads:[~2018-12-13 16:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 16:28 [PATCH 0/6] pinctrl: sh-pfc: Fix number of pins/marks mismatches Geert Uytterhoeven
2018-12-13 16:28 ` [PATCH 1/6] pinctrl: sh-pfc: r8a7740: Add missing REF125CK pin to gether_gmii group Geert Uytterhoeven
2018-12-16 10:33   ` Simon Horman
2018-12-13 16:28 ` [PATCH 2/6] pinctrl: sh-pfc: r8a7740: Add missing LCD0 marks to lcd0_data24_1 group Geert Uytterhoeven
2018-12-16 10:33   ` Simon Horman
2018-12-13 16:28 ` [PATCH 3/6] pinctrl: sh-pfc: r8a7791: Remove bogus ctrl marks from qspi_data4_b group Geert Uytterhoeven
2018-12-16 10:34   ` Simon Horman
2018-12-13 16:28 ` [PATCH 4/6] pinctrl: sh-pfc: r8a7791: Remove bogus marks from vin1_b_data18 group Geert Uytterhoeven
2018-12-16 10:45   ` Simon Horman
2018-12-13 16:28 ` [PATCH 5/6] pinctrl: sh-pfc: sh73a0: Add missing TO pin to tpu4_to3 group Geert Uytterhoeven
2018-12-16 11:00   ` Simon Horman
2018-12-13 16:28 ` Geert Uytterhoeven [this message]
2018-12-16 11:03   ` [PATCH 6/6] pinctrl: sh-pfc: Validate pins/marks in pin group at build time Simon Horman
2018-12-18  8:16   ` 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=20181213162855.14190-7-geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --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).