Commit fffe418b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'regmap-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap

Pull regmap updates from Mark Brown:
 "Other than a few cleanups the changes here are all in the KUnit tests,
  Richard Fitzgerald sent some bug fixes during the v6.9 cycle and while
  adding test coverage for the issues fixed did some fairly substantial
  improvements, both cleaning up the framework and building out the
  coverage"

* tag 'regmap-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: Reorder fields in 'struct regmap_config' to save some memory
  regmap: kunit: Fix an NULL vs IS_ERR() check
  regmap: spi: Add missing MODULE_DESCRIPTION()
  regmap: Drop capitalisation in MODULE_DESCRIPTION()
  regmap: kunit: Add test cases for regmap_read_bypassed()
  regmap: kunit: Add cache-drop test with multiple cache blocks
  regmap: kunit: Replace a kmalloc/kfree() pair with KUnit-managed alloc
  regmap: kunit: Use a KUnit action to call regmap_exit()
  regmap: kunit: Add more cache-sync tests
  regmap: kunit: Add more cache-drop tests
  regmap: kunit: Run non-sparse cache tests at non-zero register addresses
  regmap: kunit: Run sparse cache tests at non-zero register addresses
  regmap: kunit: Introduce struct for test case parameters
  regmap: kunit: Create a struct device for the regmap
  regmap: kunit: Fix warnings of implicit casts to __le16 and __be16
  regmap: maple: Remove second semicolon
parents 101b7a97 9b1fe051
...@@ -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
...@@ -294,7 +294,7 @@ static int regcache_maple_exit(struct regmap *map) ...@@ -294,7 +294,7 @@ static int regcache_maple_exit(struct regmap *map)
{ {
struct maple_tree *mt = map->cache; struct maple_tree *mt = map->cache;
MA_STATE(mas, mt, 0, UINT_MAX); MA_STATE(mas, mt, 0, UINT_MAX);
unsigned int *entry;; unsigned int *entry;
/* if we've already been called then just return */ /* if we've already been called then just return */
if (!mt) if (!mt)
......
...@@ -56,5 +56,5 @@ struct regmap *__devm_regmap_init_i3c(struct i3c_device *i3c, ...@@ -56,5 +56,5 @@ struct regmap *__devm_regmap_init_i3c(struct i3c_device *i3c,
EXPORT_SYMBOL_GPL(__devm_regmap_init_i3c); EXPORT_SYMBOL_GPL(__devm_regmap_init_i3c);
MODULE_AUTHOR("Vitor Soares <vitor.soares@synopsys.com>"); MODULE_AUTHOR("Vitor Soares <vitor.soares@synopsys.com>");
MODULE_DESCRIPTION("Regmap I3C Module"); MODULE_DESCRIPTION("regmap I3C Module");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
This diff is collapsed.
...@@ -117,5 +117,5 @@ struct regmap *__devm_regmap_init_mdio(struct mdio_device *mdio_dev, ...@@ -117,5 +117,5 @@ struct regmap *__devm_regmap_init_mdio(struct mdio_device *mdio_dev,
EXPORT_SYMBOL_GPL(__devm_regmap_init_mdio); EXPORT_SYMBOL_GPL(__devm_regmap_init_mdio);
MODULE_AUTHOR("Sander Vanheule <sander@svanheule.net>"); MODULE_AUTHOR("Sander Vanheule <sander@svanheule.net>");
MODULE_DESCRIPTION("Regmap MDIO Module"); MODULE_DESCRIPTION("regmap MDIO Module");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
...@@ -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;
......
...@@ -97,5 +97,5 @@ struct regmap *__devm_regmap_init_sdw_mbq(struct sdw_slave *sdw, ...@@ -97,5 +97,5 @@ struct regmap *__devm_regmap_init_sdw_mbq(struct sdw_slave *sdw,
} }
EXPORT_SYMBOL_GPL(__devm_regmap_init_sdw_mbq); EXPORT_SYMBOL_GPL(__devm_regmap_init_sdw_mbq);
MODULE_DESCRIPTION("Regmap SoundWire MBQ Module"); MODULE_DESCRIPTION("regmap SoundWire MBQ Module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -98,5 +98,5 @@ struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw, ...@@ -98,5 +98,5 @@ struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw,
} }
EXPORT_SYMBOL_GPL(__devm_regmap_init_sdw); EXPORT_SYMBOL_GPL(__devm_regmap_init_sdw);
MODULE_DESCRIPTION("Regmap SoundWire Module"); MODULE_DESCRIPTION("regmap SoundWire Module");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
...@@ -165,4 +165,5 @@ struct regmap *__devm_regmap_init_spi(struct spi_device *spi, ...@@ -165,4 +165,5 @@ struct regmap *__devm_regmap_init_spi(struct spi_device *spi,
} }
EXPORT_SYMBOL_GPL(__devm_regmap_init_spi); EXPORT_SYMBOL_GPL(__devm_regmap_init_spi);
MODULE_DESCRIPTION("regmap SPI Module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -297,15 +297,6 @@ typedef void (*regmap_unlock)(void *); ...@@ -297,15 +297,6 @@ typedef void (*regmap_unlock)(void *);
* performed on such table (a register is no increment * performed on such table (a register is no increment
* readable if it belongs to one of the ranges specified * readable if it belongs to one of the ranges specified
* by rd_noinc_table). * by rd_noinc_table).
* @disable_locking: This regmap is either protected by external means or
* is guaranteed not to be accessed from multiple threads.
* Don't use any locking mechanisms.
* @lock: Optional lock callback (overrides regmap's default lock
* function, based on spinlock or mutex).
* @unlock: As above for unlocking.
* @lock_arg: this field is passed as the only argument of lock/unlock
* functions (ignored in case regular lock/unlock functions
* are not overridden).
* @reg_read: Optional callback that if filled will be used to perform * @reg_read: Optional callback that if filled will be used to perform
* all the reads from the registers. Should only be provided for * all the reads from the registers. Should only be provided for
* devices whose read operation cannot be represented as a simple * devices whose read operation cannot be represented as a simple
...@@ -323,6 +314,7 @@ typedef void (*regmap_unlock)(void *); ...@@ -323,6 +314,7 @@ typedef void (*regmap_unlock)(void *);
* @write: Same as above for writing. * @write: Same as above for writing.
* @max_raw_read: Max raw read size that can be used on the device. * @max_raw_read: Max raw read size that can be used on the device.
* @max_raw_write: Max raw write size that can be used on the device. * @max_raw_write: Max raw write size that can be used on the device.
* @can_sleep: Optional, specifies whether regmap operations can sleep.
* @fast_io: Register IO is fast. Use a spinlock instead of a mutex * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
* to perform locking. This field is ignored if custom lock/unlock * to perform locking. This field is ignored if custom lock/unlock
* functions are used (see fields lock/unlock of struct regmap_config). * functions are used (see fields lock/unlock of struct regmap_config).
...@@ -331,6 +323,15 @@ typedef void (*regmap_unlock)(void *); ...@@ -331,6 +323,15 @@ typedef void (*regmap_unlock)(void *);
* Use it only for "no-bus" cases. * Use it only for "no-bus" cases.
* @io_port: Support IO port accessors. Makes sense only when MMIO vs. IO port * @io_port: Support IO port accessors. Makes sense only when MMIO vs. IO port
* access can be distinguished. * access can be distinguished.
* @disable_locking: This regmap is either protected by external means or
* is guaranteed not to be accessed from multiple threads.
* Don't use any locking mechanisms.
* @lock: Optional lock callback (overrides regmap's default lock
* function, based on spinlock or mutex).
* @unlock: As above for unlocking.
* @lock_arg: This field is passed as the only argument of lock/unlock
* functions (ignored in case regular lock/unlock functions
* are not overridden).
* @max_register: Optional, specifies the maximum valid register address. * @max_register: Optional, specifies the maximum valid register address.
* @max_register_is_0: Optional, specifies that zero value in @max_register * @max_register_is_0: Optional, specifies that zero value in @max_register
* should be taken into account. This is a workaround to * should be taken into account. This is a workaround to
...@@ -373,6 +374,11 @@ typedef void (*regmap_unlock)(void *); ...@@ -373,6 +374,11 @@ typedef void (*regmap_unlock)(void *);
* @reg_defaults_raw: Power on reset values for registers (for use with * @reg_defaults_raw: Power on reset values for registers (for use with
* register cache support). * register cache support).
* @num_reg_defaults_raw: Number of elements in reg_defaults_raw. * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
* @use_hwlock: Indicate if a hardware spinlock should be used.
* @use_raw_spinlock: Indicate if a raw spinlock should be used.
* @hwlock_id: Specify the hardware spinlock id.
* @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
* HWLOCK_IRQ or 0.
* @reg_format_endian: Endianness for formatted register addresses. If this is * @reg_format_endian: Endianness for formatted register addresses. If this is
* DEFAULT, the @reg_format_endian_default value from the * DEFAULT, the @reg_format_endian_default value from the
* regmap bus is used. * regmap bus is used.
...@@ -382,12 +388,6 @@ typedef void (*regmap_unlock)(void *); ...@@ -382,12 +388,6 @@ typedef void (*regmap_unlock)(void *);
* *
* @ranges: Array of configuration entries for virtual address ranges. * @ranges: Array of configuration entries for virtual address ranges.
* @num_ranges: Number of range configuration entries. * @num_ranges: Number of range configuration entries.
* @use_hwlock: Indicate if a hardware spinlock should be used.
* @use_raw_spinlock: Indicate if a raw spinlock should be used.
* @hwlock_id: Specify the hardware spinlock id.
* @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
* HWLOCK_IRQ or 0.
* @can_sleep: Optional, specifies whether regmap operations can sleep.
*/ */
struct regmap_config { struct regmap_config {
const char *name; const char *name;
...@@ -406,11 +406,6 @@ struct regmap_config { ...@@ -406,11 +406,6 @@ struct regmap_config {
bool (*writeable_noinc_reg)(struct device *dev, unsigned int reg); bool (*writeable_noinc_reg)(struct device *dev, unsigned int reg);
bool (*readable_noinc_reg)(struct device *dev, unsigned int reg); bool (*readable_noinc_reg)(struct device *dev, unsigned int reg);
bool disable_locking;
regmap_lock lock;
regmap_unlock unlock;
void *lock_arg;
int (*reg_read)(void *context, unsigned int reg, unsigned int *val); int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
int (*reg_write)(void *context, unsigned int reg, unsigned int val); int (*reg_write)(void *context, unsigned int reg, unsigned int val);
int (*reg_update_bits)(void *context, unsigned int reg, int (*reg_update_bits)(void *context, unsigned int reg,
...@@ -422,9 +417,16 @@ struct regmap_config { ...@@ -422,9 +417,16 @@ struct regmap_config {
size_t max_raw_read; size_t max_raw_read;
size_t max_raw_write; size_t max_raw_write;
bool can_sleep;
bool fast_io; bool fast_io;
bool io_port; bool io_port;
bool disable_locking;
regmap_lock lock;
regmap_unlock unlock;
void *lock_arg;
unsigned int max_register; unsigned int max_register;
bool max_register_is_0; bool max_register_is_0;
const struct regmap_access_table *wr_table; const struct regmap_access_table *wr_table;
...@@ -448,18 +450,16 @@ struct regmap_config { ...@@ -448,18 +450,16 @@ struct regmap_config {
bool use_relaxed_mmio; bool use_relaxed_mmio;
bool can_multi_write; bool can_multi_write;
enum regmap_endian reg_format_endian;
enum regmap_endian val_format_endian;
const struct regmap_range_cfg *ranges;
unsigned int num_ranges;
bool use_hwlock; bool use_hwlock;
bool use_raw_spinlock; bool use_raw_spinlock;
unsigned int hwlock_id; unsigned int hwlock_id;
unsigned int hwlock_mode; unsigned int hwlock_mode;
bool can_sleep; enum regmap_endian reg_format_endian;
enum regmap_endian val_format_endian;
const struct regmap_range_cfg *ranges;
unsigned int num_ranges;
}; };
/** /**
......
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