aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2012-06-20 11:03:41 -0400
committerPaul Mundt <lethal@linux-sh.org>2012-06-20 11:03:41 -0400
commit06d5631f56460917af3d9417ef63811cf0cad9ce (patch)
treea25eee33f3198c4ba75c79b51a3bc85fd10a5f50 /drivers/sh
parent9f65b2b60c42c1e2d885acede4443b53f141c987 (diff)
sh: pfc: Verify pin type encoding size at build time.
The encoding is tightly packed, and future changes (such as pinconf-generic support) can easily lead to a situation where we violate the encoding constraints and trample data bit/reg bits. This plugs in some sanity checks by way of a BUILD_BUG_ON() to blow up if we fail to fit. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/sh')
-rw-r--r--drivers/sh/pfc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c
index 8a9ae09603d6..ce4579ebd602 100644
--- a/drivers/sh/pfc.c
+++ b/drivers/sh/pfc.c
@@ -549,6 +549,11 @@ int register_sh_pfc(struct sh_pfc *pfc)
549 int (*initroutine)(struct sh_pfc *) = NULL; 549 int (*initroutine)(struct sh_pfc *) = NULL;
550 int ret; 550 int ret;
551 551
552 /*
553 * Ensure that the type encoding fits
554 */
555 BUILD_BUG_ON(PINMUX_FLAG_TYPE > ((1 << PINMUX_FLAG_DBIT_SHIFT) - 1));
556
552 if (sh_pfc) 557 if (sh_pfc)
553 return -EBUSY; 558 return -EBUSY;
554 559