summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorXiubo Li <Li.Xiubo@freescale.com>2014-04-11 02:24:42 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:36:12 (GMT)
commit2837afbc45893c37e0ae28d653209da6937fa952 (patch)
tree780bb2991fd0add92c293a945a00f64e28fd3dce /drivers/base
parentd2a4798b5737926ee839ae6e70a59811601071e0 (diff)
downloadlinux-fsl-qoriq-2837afbc45893c37e0ae28d653209da6937fa952.tar.xz
regmap: mmio: add regmap_mmio_{regsize, count}_check.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org> --- This patch is pulled back from upstream: commit 41b0c2c976a8758a2b7f5b14cbc5d1a7436932cc Change-Id: I8446ffd9118e759cb68784dd0ee59e9382c698ec Reviewed-on: http://git.am.freescale.net:8181/19672 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap-mmio.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 98745dd..3eddd76 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -30,6 +30,16 @@ struct regmap_mmio_context {
struct clk *clk;
};
+static inline void regmap_mmio_regsize_check(size_t reg_size)
+{
+ BUG_ON(reg_size != 4);
+}
+
+static inline void regmap_mmio_count_check(size_t count)
+{
+ BUG_ON(count < 4);
+}
+
static int regmap_mmio_gather_write(void *context,
const void *reg, size_t reg_size,
const void *val, size_t val_size)
@@ -38,7 +48,7 @@ static int regmap_mmio_gather_write(void *context,
u32 offset;
int ret;
- BUG_ON(reg_size != 4);
+ regmap_mmio_regsize_check(reg_size);
if (ctx->clk) {
ret = clk_enable(ctx->clk);
@@ -81,7 +91,7 @@ static int regmap_mmio_gather_write(void *context,
static int regmap_mmio_write(void *context, const void *data, size_t count)
{
- BUG_ON(count < 4);
+ regmap_mmio_count_check(count);
return regmap_mmio_gather_write(context, data, 4, data + 4, count - 4);
}
@@ -94,7 +104,7 @@ static int regmap_mmio_read(void *context,
u32 offset;
int ret;
- BUG_ON(reg_size != 4);
+ regmap_mmio_regsize_check(reg_size);
if (ctx->clk) {
ret = clk_enable(ctx->clk);