[RFC][PATCH] regmap: Drop CONFIG_64BIT checks from core

From: Marek Vasut
Date: Tue Jun 25 2019 - 19:33:46 EST


Drop the CONFIG_64BIT checks from core regmap code, as it is well
possible to access e.g. an SPI device with 64bit registers from a
32bit CPU. The CONFIG_64BIT checks are still left in place in the
regmap mmio code however.

Signed-off-by: Marek Vasut <marex@xxxxxxx>
Cc: Rafael J. Wysocki <rafael@xxxxxxxxxx>
Cc: Mark Brown <broonie@xxxxxxxxxx>
---
drivers/base/regmap/regcache.c | 4 ----
drivers/base/regmap/regmap.c | 14 --------------
2 files changed, 18 deletions(-)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index a93cafd7be4f..e443d9de3f7e 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -577,14 +577,12 @@ bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
cache[idx] = val;
break;
}
-#ifdef CONFIG_64BIT
case 8: {
u64 *cache = base;

cache[idx] = val;
break;
}
-#endif
default:
BUG();
}
@@ -618,13 +616,11 @@ unsigned int regcache_get_val(struct regmap *map, const void *base,

return cache[idx];
}
-#ifdef CONFIG_64BIT
case 8: {
const u64 *cache = base;

return cache[idx];
}
-#endif
default:
BUG();
}
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 19f57ccfbe1d..7da9dbb98d8a 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -298,7 +298,6 @@ static void regmap_format_32_native(void *buf, unsigned int val,
*(u32 *)buf = val << shift;
}

-#ifdef CONFIG_64BIT
static void regmap_format_64_be(void *buf, unsigned int val, unsigned int shift)
{
__be64 *b = buf;
@@ -318,7 +317,6 @@ static void regmap_format_64_native(void *buf, unsigned int val,
{
*(u64 *)buf = (u64)val << shift;
}
-#endif

static void regmap_parse_inplace_noop(void *buf)
{
@@ -407,7 +405,6 @@ static unsigned int regmap_parse_32_native(const void *buf)
return *(u32 *)buf;
}

-#ifdef CONFIG_64BIT
static unsigned int regmap_parse_64_be(const void *buf)
{
const __be64 *b = buf;
@@ -440,7 +437,6 @@ static unsigned int regmap_parse_64_native(const void *buf)
{
return *(u64 *)buf;
}
-#endif

static void regmap_lock_hwlock(void *__map)
{
@@ -921,7 +917,6 @@ struct regmap *__regmap_init(struct device *dev,
}
break;

-#ifdef CONFIG_64BIT
case 64:
switch (reg_endian) {
case REGMAP_ENDIAN_BIG:
@@ -937,7 +932,6 @@ struct regmap *__regmap_init(struct device *dev,
goto err_hwlock;
}
break;
-#endif

default:
goto err_hwlock;
@@ -998,7 +992,6 @@ struct regmap *__regmap_init(struct device *dev,
goto err_hwlock;
}
break;
-#ifdef CONFIG_64BIT
case 64:
switch (val_endian) {
case REGMAP_ENDIAN_BIG:
@@ -1019,7 +1012,6 @@ struct regmap *__regmap_init(struct device *dev,
goto err_hwlock;
}
break;
-#endif
}

if (map->format.format_write) {
@@ -2081,11 +2073,9 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
case 4:
ival = *(u32 *)(val + (i * val_bytes));
break;
-#ifdef CONFIG_64BIT
case 8:
ival = *(u64 *)(val + (i * val_bytes));
break;
-#endif
default:
ret = -EINVAL;
goto out;
@@ -2809,9 +2799,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
for (i = 0; i < val_count * val_bytes; i += val_bytes)
map->format.parse_inplace(val + i);
} else {
-#ifdef CONFIG_64BIT
u64 *u64 = val;
-#endif
u32 *u32 = val;
u16 *u16 = val;
u8 *u8 = val;
@@ -2827,11 +2815,9 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
goto out;

switch (map->format.val_bytes) {
-#ifdef CONFIG_64BIT
case 8:
u64[i] = ival;
break;
-#endif
case 4:
u32[i] = ival;
break;
--
2.20.1