* [PATCH] regmap: mmio: Add regmap_mmio_regbits_check.
@ 2014-03-28 5:12 Xiubo Li
2014-03-28 11:12 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Xiubo Li @ 2014-03-28 5:12 UTC (permalink / raw)
To: broonie, gregkh; +Cc: linux-kernel, Xiubo Li
Fix the support for 1/2/8 bytes wide register address checking.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
Sorry, this patch has been missed yesterday.
drivers/base/regmap/regmap-mmio.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index ed080a4..de45a1e 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -47,6 +47,21 @@ static inline void regmap_mmio_regsize_check(size_t reg_size)
}
}
+static int regmap_mmio_regbits_check(size_t reg_bits)
+{
+ switch (reg_bits) {
+ case 8:
+ case 16:
+ case 32:
+#ifdef CONFIG_64BIT
+ case 64:
+#endif
+ return 0;
+ default:
+ return -EINVAL;
+ }
+}
+
static inline void regmap_mmio_count_check(size_t count)
{
BUG_ON(count % 2 != 0);
@@ -191,8 +206,9 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev,
int min_stride;
int ret;
- if (config->reg_bits != 32)
- return ERR_PTR(-EINVAL);
+ ret = regmap_mmio_regbits_check(config->reg_bits);
+ if (ret)
+ return ERR_PTR(ret);
if (config->pad_bits)
return ERR_PTR(-EINVAL);
--
1.8.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] regmap: mmio: Add regmap_mmio_regbits_check.
2014-03-28 5:12 [PATCH] regmap: mmio: Add regmap_mmio_regbits_check Xiubo Li
@ 2014-03-28 11:12 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-03-28 11:12 UTC (permalink / raw)
To: Xiubo Li; +Cc: gregkh, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 142 bytes --]
On Fri, Mar 28, 2014 at 01:12:56PM +0800, Xiubo Li wrote:
> Fix the support for 1/2/8 bytes wide register address checking.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-28 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-28 5:12 [PATCH] regmap: mmio: Add regmap_mmio_regbits_check Xiubo Li
2014-03-28 11:12 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.