Commit d0c99ffe authored by Mark Brown's avatar Mark Brown

regmap: Allow reads from write only registers with the flat cache

The flat cache is intended for devices that need the lowest overhead so
doesn't track any sparseness.
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230617-regmap-kunit-read-writeonly-flat-v1-1-efd3ed66dec6@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3e47b887
...@@ -252,9 +252,18 @@ static void read_writeonly(struct kunit *test) ...@@ -252,9 +252,18 @@ static void read_writeonly(struct kunit *test)
for (i = 0; i < BLOCK_TEST_SIZE; i++) for (i = 0; i < BLOCK_TEST_SIZE; i++)
data->read[i] = false; data->read[i] = false;
/* Try to read all the registers, the writeonly one should fail */ /*
for (i = 0; i < BLOCK_TEST_SIZE; i++) * Try to read all the registers, the writeonly one should
KUNIT_EXPECT_EQ(test, i != 5, regmap_read(map, i, &val) == 0); * 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? */ /* Did we trigger a hardware access? */
KUNIT_EXPECT_FALSE(test, data->read[5]); KUNIT_EXPECT_FALSE(test, data->read[5]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment