]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
pinctrl: sh-pfc: Validate pins/marks in pin groups at build time
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 12 Dec 2018 11:01:45 +0000 (12:01 +0100)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 18 Dec 2018 10:25:56 +0000 (11:25 +0100)
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>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
drivers/pinctrl/sh-pfc/sh_pfc.h

index 78dc342d7b390e025a4ff6281e4ffdf5c5f76347..4892c09b27bb43ea0587734f8d66ba155ce97dfd 100644 (file)
@@ -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)