mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: linux-kernel@vger.kernel.org
Cc: Marek Vasut <marex@denx.de>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Mark Brown <broonie@kernel.org>
Subject: [RFC][PATCH] regmap: Drop CONFIG_64BIT checks from core
Date: Wed, 26 Jun 2019 01:31:16 +0200	[thread overview]
Message-ID: <20190625233116.2889-1-marex@denx.de> (raw)

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@denx.de>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
---
 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


             reply	other threads:[~2019-06-25 23:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 23:31 Marek Vasut [this message]
2019-06-26 11:15 ` Mark Brown
2019-06-26 11:20   ` Marek Vasut
2019-06-26 12:05     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190625233116.2889-1-marex@denx.de \
    --to=marex@denx.de \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®