Commit 7b7982f1 authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Mark Brown

regmap: kunit: Create a struct device for the regmap

Use kunit_device_register() to create a real struct device for the
regmap instead of leaving it at NULL.

The main reason for this is that it allows context data to be passed
into the readable_reg/writable_reg/volatile_reg functions by attaching
it to the struct device with dev_set_drvdata().

The gen_regmap() and gen_raw_regmap() functions are updated to take a
struct kunit * argument.

A new struct regmap_test_priv has been created to hold the struct device
created by kunit_device_register(). This allows the struct to be
extended in the future to hold more private data for the test suite.
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Link: https://msgid.link/r/20240408144600.230848-3-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 866f7021
...@@ -326,20 +326,22 @@ struct regmap_ram_data { ...@@ -326,20 +326,22 @@ struct regmap_ram_data {
* Create a test register map with data stored in RAM, not intended * Create a test register map with data stored in RAM, not intended
* for practical use. * for practical use.
*/ */
struct regmap *__regmap_init_ram(const struct regmap_config *config, struct regmap *__regmap_init_ram(struct device *dev,
const struct regmap_config *config,
struct regmap_ram_data *data, struct regmap_ram_data *data,
struct lock_class_key *lock_key, struct lock_class_key *lock_key,
const char *lock_name); const char *lock_name);
#define regmap_init_ram(config, data) \ #define regmap_init_ram(dev, config, data) \
__regmap_lockdep_wrapper(__regmap_init_ram, #config, config, data) __regmap_lockdep_wrapper(__regmap_init_ram, #dev, dev, config, data)
struct regmap *__regmap_init_raw_ram(const struct regmap_config *config, struct regmap *__regmap_init_raw_ram(struct device *dev,
const struct regmap_config *config,
struct regmap_ram_data *data, struct regmap_ram_data *data,
struct lock_class_key *lock_key, struct lock_class_key *lock_key,
const char *lock_name); const char *lock_name);
#define regmap_init_raw_ram(config, data) \ #define regmap_init_raw_ram(dev, config, data) \
__regmap_lockdep_wrapper(__regmap_init_raw_ram, #config, config, data) __regmap_lockdep_wrapper(__regmap_init_raw_ram, #dev, dev, config, data)
#endif #endif
...@@ -4,11 +4,16 @@ ...@@ -4,11 +4,16 @@
// //
// Copyright 2023 Arm Ltd // Copyright 2023 Arm Ltd
#include <kunit/device.h>
#include <kunit/test.h> #include <kunit/test.h>
#include "internal.h" #include "internal.h"
#define BLOCK_TEST_SIZE 12 #define BLOCK_TEST_SIZE 12
struct regmap_test_priv {
struct device *dev;
};
static void get_changed_bytes(void *orig, void *new, size_t size) static void get_changed_bytes(void *orig, void *new, size_t size)
{ {
char *o = orig; char *o = orig;
...@@ -66,9 +71,11 @@ static const struct regcache_types sparse_cache_types_list[] = { ...@@ -66,9 +71,11 @@ static const struct regcache_types sparse_cache_types_list[] = {
KUNIT_ARRAY_PARAM(sparse_cache_types, sparse_cache_types_list, case_to_desc); KUNIT_ARRAY_PARAM(sparse_cache_types, sparse_cache_types_list, case_to_desc);
static struct regmap *gen_regmap(struct regmap_config *config, static struct regmap *gen_regmap(struct kunit *test,
struct regmap_config *config,
struct regmap_ram_data **data) struct regmap_ram_data **data)
{ {
struct regmap_test_priv *priv = test->priv;
unsigned int *buf; unsigned int *buf;
struct regmap *ret; struct regmap *ret;
size_t size = (config->max_register + 1) * sizeof(unsigned int); size_t size = (config->max_register + 1) * sizeof(unsigned int);
...@@ -103,7 +110,7 @@ static struct regmap *gen_regmap(struct regmap_config *config, ...@@ -103,7 +110,7 @@ static struct regmap *gen_regmap(struct regmap_config *config,
} }
} }
ret = regmap_init_ram(config, *data); ret = regmap_init_ram(priv->dev, config, *data);
if (IS_ERR(ret)) { if (IS_ERR(ret)) {
kfree(buf); kfree(buf);
kfree(*data); kfree(*data);
...@@ -128,7 +135,7 @@ static void basic_read_write(struct kunit *test) ...@@ -128,7 +135,7 @@ static void basic_read_write(struct kunit *test)
config = test_regmap_config; config = test_regmap_config;
config.cache_type = t->type; config.cache_type = t->type;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -158,7 +165,7 @@ static void bulk_write(struct kunit *test) ...@@ -158,7 +165,7 @@ static void bulk_write(struct kunit *test)
config = test_regmap_config; config = test_regmap_config;
config.cache_type = t->type; config.cache_type = t->type;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -195,7 +202,7 @@ static void bulk_read(struct kunit *test) ...@@ -195,7 +202,7 @@ static void bulk_read(struct kunit *test)
config = test_regmap_config; config = test_regmap_config;
config.cache_type = t->type; config.cache_type = t->type;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -230,7 +237,7 @@ static void write_readonly(struct kunit *test) ...@@ -230,7 +237,7 @@ static void write_readonly(struct kunit *test)
config.num_reg_defaults = BLOCK_TEST_SIZE; config.num_reg_defaults = BLOCK_TEST_SIZE;
config.writeable_reg = reg_5_false; config.writeable_reg = reg_5_false;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -264,7 +271,7 @@ static void read_writeonly(struct kunit *test) ...@@ -264,7 +271,7 @@ static void read_writeonly(struct kunit *test)
config.cache_type = t->type; config.cache_type = t->type;
config.readable_reg = reg_5_false; config.readable_reg = reg_5_false;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -304,7 +311,7 @@ static void reg_defaults(struct kunit *test) ...@@ -304,7 +311,7 @@ static void reg_defaults(struct kunit *test)
config.cache_type = t->type; config.cache_type = t->type;
config.num_reg_defaults = BLOCK_TEST_SIZE; config.num_reg_defaults = BLOCK_TEST_SIZE;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -332,7 +339,7 @@ static void reg_defaults_read_dev(struct kunit *test) ...@@ -332,7 +339,7 @@ static void reg_defaults_read_dev(struct kunit *test)
config.cache_type = t->type; config.cache_type = t->type;
config.num_reg_defaults_raw = BLOCK_TEST_SIZE; config.num_reg_defaults_raw = BLOCK_TEST_SIZE;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -368,7 +375,7 @@ static void register_patch(struct kunit *test) ...@@ -368,7 +375,7 @@ static void register_patch(struct kunit *test)
config.cache_type = t->type; config.cache_type = t->type;
config.num_reg_defaults = BLOCK_TEST_SIZE; config.num_reg_defaults = BLOCK_TEST_SIZE;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -419,7 +426,7 @@ static void stride(struct kunit *test) ...@@ -419,7 +426,7 @@ static void stride(struct kunit *test)
config.reg_stride = 2; config.reg_stride = 2;
config.num_reg_defaults = BLOCK_TEST_SIZE / 2; config.num_reg_defaults = BLOCK_TEST_SIZE / 2;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -495,7 +502,7 @@ static void basic_ranges(struct kunit *test) ...@@ -495,7 +502,7 @@ static void basic_ranges(struct kunit *test)
config.num_ranges = 1; config.num_ranges = 1;
config.max_register = test_range.range_max; config.max_register = test_range.range_max;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -565,7 +572,7 @@ static void stress_insert(struct kunit *test) ...@@ -565,7 +572,7 @@ static void stress_insert(struct kunit *test)
config.cache_type = t->type; config.cache_type = t->type;
config.max_register = 300; config.max_register = 300;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -616,7 +623,7 @@ static void cache_bypass(struct kunit *test) ...@@ -616,7 +623,7 @@ static void cache_bypass(struct kunit *test)
config = test_regmap_config; config = test_regmap_config;
config.cache_type = t->type; config.cache_type = t->type;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -655,7 +662,7 @@ static void cache_sync(struct kunit *test) ...@@ -655,7 +662,7 @@ static void cache_sync(struct kunit *test)
config = test_regmap_config; config = test_regmap_config;
config.cache_type = t->type; config.cache_type = t->type;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -694,7 +701,7 @@ static void cache_sync_defaults(struct kunit *test) ...@@ -694,7 +701,7 @@ static void cache_sync_defaults(struct kunit *test)
config.cache_type = t->type; config.cache_type = t->type;
config.num_reg_defaults = BLOCK_TEST_SIZE; config.num_reg_defaults = BLOCK_TEST_SIZE;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -730,7 +737,7 @@ static void cache_sync_readonly(struct kunit *test) ...@@ -730,7 +737,7 @@ static void cache_sync_readonly(struct kunit *test)
config.cache_type = t->type; config.cache_type = t->type;
config.writeable_reg = reg_5_false; config.writeable_reg = reg_5_false;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -773,7 +780,7 @@ static void cache_sync_patch(struct kunit *test) ...@@ -773,7 +780,7 @@ static void cache_sync_patch(struct kunit *test)
config.cache_type = t->type; config.cache_type = t->type;
config.num_reg_defaults = BLOCK_TEST_SIZE; config.num_reg_defaults = BLOCK_TEST_SIZE;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -832,7 +839,7 @@ static void cache_drop(struct kunit *test) ...@@ -832,7 +839,7 @@ static void cache_drop(struct kunit *test)
config.cache_type = t->type; config.cache_type = t->type;
config.num_reg_defaults = BLOCK_TEST_SIZE; config.num_reg_defaults = BLOCK_TEST_SIZE;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -873,7 +880,7 @@ static void cache_present(struct kunit *test) ...@@ -873,7 +880,7 @@ static void cache_present(struct kunit *test)
config = test_regmap_config; config = test_regmap_config;
config.cache_type = t->type; config.cache_type = t->type;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -917,7 +924,7 @@ static void cache_range_window_reg(struct kunit *test) ...@@ -917,7 +924,7 @@ static void cache_range_window_reg(struct kunit *test)
config.num_ranges = 1; config.num_ranges = 1;
config.max_register = test_range.range_max; config.max_register = test_range.range_max;
map = gen_regmap(&config, &data); map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -997,10 +1004,12 @@ static const struct regmap_config raw_regmap_config = { ...@@ -997,10 +1004,12 @@ static const struct regmap_config raw_regmap_config = {
.val_bits = 16, .val_bits = 16,
}; };
static struct regmap *gen_raw_regmap(struct regmap_config *config, static struct regmap *gen_raw_regmap(struct kunit *test,
struct regmap_config *config,
struct raw_test_types *test_type, struct raw_test_types *test_type,
struct regmap_ram_data **data) struct regmap_ram_data **data)
{ {
struct regmap_test_priv *priv = test->priv;
u16 *buf; u16 *buf;
struct regmap *ret; struct regmap *ret;
size_t size = (config->max_register + 1) * config->reg_bits / 8; size_t size = (config->max_register + 1) * config->reg_bits / 8;
...@@ -1052,7 +1061,7 @@ static struct regmap *gen_raw_regmap(struct regmap_config *config, ...@@ -1052,7 +1061,7 @@ static struct regmap *gen_raw_regmap(struct regmap_config *config,
if (config->cache_type == REGCACHE_NONE) if (config->cache_type == REGCACHE_NONE)
config->num_reg_defaults = 0; config->num_reg_defaults = 0;
ret = regmap_init_raw_ram(config, *data); ret = regmap_init_raw_ram(priv->dev, config, *data);
if (IS_ERR(ret)) { if (IS_ERR(ret)) {
kfree(buf); kfree(buf);
kfree(*data); kfree(*data);
...@@ -1072,7 +1081,7 @@ static void raw_read_defaults_single(struct kunit *test) ...@@ -1072,7 +1081,7 @@ static void raw_read_defaults_single(struct kunit *test)
config = raw_regmap_config; config = raw_regmap_config;
map = gen_raw_regmap(&config, t, &data); map = gen_raw_regmap(test, &config, t, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -1099,7 +1108,7 @@ static void raw_read_defaults(struct kunit *test) ...@@ -1099,7 +1108,7 @@ static void raw_read_defaults(struct kunit *test)
config = raw_regmap_config; config = raw_regmap_config;
map = gen_raw_regmap(&config, t, &data); map = gen_raw_regmap(test, &config, t, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -1109,7 +1118,7 @@ static void raw_read_defaults(struct kunit *test) ...@@ -1109,7 +1118,7 @@ static void raw_read_defaults(struct kunit *test)
KUNIT_ASSERT_TRUE(test, rval != NULL); KUNIT_ASSERT_TRUE(test, rval != NULL);
if (!rval) if (!rval)
return; return;
/* Check that we can read the defaults via the API */ /* Check that we can read the defaults via the API */
KUNIT_EXPECT_EQ(test, 0, regmap_raw_read(map, 0, rval, val_len)); KUNIT_EXPECT_EQ(test, 0, regmap_raw_read(map, 0, rval, val_len));
for (i = 0; i < config.max_register + 1; i++) { for (i = 0; i < config.max_register + 1; i++) {
...@@ -1136,7 +1145,7 @@ static void raw_write_read_single(struct kunit *test) ...@@ -1136,7 +1145,7 @@ static void raw_write_read_single(struct kunit *test)
config = raw_regmap_config; config = raw_regmap_config;
map = gen_raw_regmap(&config, t, &data); map = gen_raw_regmap(test, &config, t, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -1164,7 +1173,7 @@ static void raw_write(struct kunit *test) ...@@ -1164,7 +1173,7 @@ static void raw_write(struct kunit *test)
config = raw_regmap_config; config = raw_regmap_config;
map = gen_raw_regmap(&config, t, &data); map = gen_raw_regmap(test, &config, t, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -1228,7 +1237,7 @@ static void raw_noinc_write(struct kunit *test) ...@@ -1228,7 +1237,7 @@ static void raw_noinc_write(struct kunit *test)
config.writeable_noinc_reg = reg_zero; config.writeable_noinc_reg = reg_zero;
config.readable_noinc_reg = reg_zero; config.readable_noinc_reg = reg_zero;
map = gen_raw_regmap(&config, t, &data); map = gen_raw_regmap(test, &config, t, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -1276,7 +1285,7 @@ static void raw_sync(struct kunit *test) ...@@ -1276,7 +1285,7 @@ static void raw_sync(struct kunit *test)
config = raw_regmap_config; config = raw_regmap_config;
map = gen_raw_regmap(&config, t, &data); map = gen_raw_regmap(test, &config, t, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -1323,7 +1332,7 @@ static void raw_sync(struct kunit *test) ...@@ -1323,7 +1332,7 @@ static void raw_sync(struct kunit *test)
val[2] = cpu_to_be16(val[2]); val[2] = cpu_to_be16(val[2]);
else else
val[2] = cpu_to_le16(val[2]); val[2] = cpu_to_le16(val[2]);
/* The values should not appear in the "hardware" */ /* The values should not appear in the "hardware" */
KUNIT_EXPECT_MEMNEQ(test, &hw_buf[2], &val[0], sizeof(val)); KUNIT_EXPECT_MEMNEQ(test, &hw_buf[2], &val[0], sizeof(val));
...@@ -1356,7 +1365,7 @@ static void raw_ranges(struct kunit *test) ...@@ -1356,7 +1365,7 @@ static void raw_ranges(struct kunit *test)
config.num_ranges = 1; config.num_ranges = 1;
config.max_register = test_range.range_max; config.max_register = test_range.range_max;
map = gen_raw_regmap(&config, t, &data); map = gen_raw_regmap(test, &config, t, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map)); KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map)) if (IS_ERR(map))
return; return;
...@@ -1437,8 +1446,40 @@ static struct kunit_case regmap_test_cases[] = { ...@@ -1437,8 +1446,40 @@ static struct kunit_case regmap_test_cases[] = {
{} {}
}; };
static int regmap_test_init(struct kunit *test)
{
struct regmap_test_priv *priv;
struct device *dev;
priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
test->priv = priv;
dev = kunit_device_register(test, "regmap_test");
priv->dev = get_device(dev);
if (!priv->dev)
return -ENODEV;
dev_set_drvdata(dev, test);
return 0;
}
static void regmap_test_exit(struct kunit *test)
{
struct regmap_test_priv *priv = test->priv;
/* Destroy the dummy struct device */
if (priv && priv->dev)
put_device(priv->dev);
}
static struct kunit_suite regmap_test_suite = { static struct kunit_suite regmap_test_suite = {
.name = "regmap", .name = "regmap",
.init = regmap_test_init,
.exit = regmap_test_exit,
.test_cases = regmap_test_cases, .test_cases = regmap_test_cases,
}; };
kunit_test_suite(regmap_test_suite); kunit_test_suite(regmap_test_suite);
......
...@@ -53,7 +53,8 @@ static const struct regmap_bus regmap_ram = { ...@@ -53,7 +53,8 @@ static const struct regmap_bus regmap_ram = {
.free_context = regmap_ram_free_context, .free_context = regmap_ram_free_context,
}; };
struct regmap *__regmap_init_ram(const struct regmap_config *config, struct regmap *__regmap_init_ram(struct device *dev,
const struct regmap_config *config,
struct regmap_ram_data *data, struct regmap_ram_data *data,
struct lock_class_key *lock_key, struct lock_class_key *lock_key,
const char *lock_name) const char *lock_name)
...@@ -75,7 +76,7 @@ struct regmap *__regmap_init_ram(const struct regmap_config *config, ...@@ -75,7 +76,7 @@ struct regmap *__regmap_init_ram(const struct regmap_config *config,
if (!data->written) if (!data->written)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
map = __regmap_init(NULL, &regmap_ram, data, config, map = __regmap_init(dev, &regmap_ram, data, config,
lock_key, lock_name); lock_key, lock_name);
return map; return map;
......
...@@ -107,7 +107,8 @@ static const struct regmap_bus regmap_raw_ram = { ...@@ -107,7 +107,8 @@ static const struct regmap_bus regmap_raw_ram = {
.free_context = regmap_raw_ram_free_context, .free_context = regmap_raw_ram_free_context,
}; };
struct regmap *__regmap_init_raw_ram(const struct regmap_config *config, struct regmap *__regmap_init_raw_ram(struct device *dev,
const struct regmap_config *config,
struct regmap_ram_data *data, struct regmap_ram_data *data,
struct lock_class_key *lock_key, struct lock_class_key *lock_key,
const char *lock_name) const char *lock_name)
...@@ -134,7 +135,7 @@ struct regmap *__regmap_init_raw_ram(const struct regmap_config *config, ...@@ -134,7 +135,7 @@ struct regmap *__regmap_init_raw_ram(const struct regmap_config *config,
data->reg_endian = config->reg_format_endian; data->reg_endian = config->reg_format_endian;
map = __regmap_init(NULL, &regmap_raw_ram, data, config, map = __regmap_init(dev, &regmap_raw_ram, data, config,
lock_key, lock_name); lock_key, lock_name);
return map; return map;
......
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