linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regmap: Allow reads from write only registers with the flat cache
@ 2023-06-17 20:11 Mark Brown
  2023-06-19 22:17 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2023-06-17 20:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel

The flat cache is intended for devices that need the lowest overhead so
doesn't track any sparseness.

Signed-off-by: Mark Brown <broonie@kernel.org>
---


Signed-off-by: Mark Brown,,, <broonie@kernel.org>
---
 drivers/base/regmap/regmap-kunit.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c
index 6f444ac0ec49..24257aa9004d 100644
--- a/drivers/base/regmap/regmap-kunit.c
+++ b/drivers/base/regmap/regmap-kunit.c
@@ -252,9 +252,18 @@ static void read_writeonly(struct kunit *test)
 	for (i = 0; i < BLOCK_TEST_SIZE; i++)
 		data->read[i] = false;
 
-	/* Try to read all the registers, the writeonly one should fail */
-	for (i = 0; i < BLOCK_TEST_SIZE; i++)
-		KUNIT_EXPECT_EQ(test, i != 5, regmap_read(map, i, &val) == 0);
+	/*
+	 * Try to read all the registers, the writeonly one should
+	 * fail if we aren't using the flat cache.
+	 */
+	for (i = 0; i < BLOCK_TEST_SIZE; i++) {
+		if (t->type != REGCACHE_FLAT) {
+			KUNIT_EXPECT_EQ(test, i != 5,
+					regmap_read(map, i, &val) == 0);
+		} else {
+			KUNIT_EXPECT_EQ(test, 0, regmap_read(map, i, &val));
+		}
+	}
 
 	/* Did we trigger a hardware access? */
 	KUNIT_EXPECT_FALSE(test, data->read[5]);

---
base-commit: 3e47b8877d6c0f60943b00f3112756ca3b572cd6
change-id: 20230617-regmap-kunit-read-writeonly-flat-d342e0948e82

Best regards,
-- 
Mark Brown,,, <broonie@kernel.org>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regmap: Allow reads from write only registers with the flat cache
  2023-06-17 20:11 [PATCH] regmap: Allow reads from write only registers with the flat cache Mark Brown
@ 2023-06-19 22:17 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2023-06-19 22:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel

On Sat, 17 Jun 2023 21:11:07 +0100, Mark Brown wrote:
> The flat cache is intended for devices that need the lowest overhead so
> doesn't track any sparseness.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[1/1] regmap: Allow reads from write only registers with the flat cache
      commit: d0c99ffe212679b338d12fe283964e6e43ce1501

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-19 22:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-17 20:11 [PATCH] regmap: Allow reads from write only registers with the flat cache Mark Brown
2023-06-19 22:17 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).