regmap: kunit: Create a struct device for the regmap
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Mon, 8 Apr 2024 14:45:51 +0000 (15:45 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 8 Apr 2024 15:38:07 +0000 (16:38 +0100)
commit7b7982f14315e0f6910e13b22ed38a47144a83ec
treee46d807b829373e76c90254d19957d6eaadcfad7
parent866f70211bf43927ca44d8e98b5266926fd51315
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: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://msgid.link/r/20240408144600.230848-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/internal.h
drivers/base/regmap/regmap-kunit.c
drivers/base/regmap/regmap-ram.c
drivers/base/regmap/regmap-raw-ram.c