diff options
| author | Mark Brown <broonie@kernel.org> | 2026-07-14 11:21:38 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-07-14 11:21:38 +0100 |
| commit | 8979c222ebebb34066a2cf390c7746f69d4ebea7 (patch) | |
| tree | 2cdc30f0f16b18f7dda27c9daa9d751b196f9ecf | |
| parent | ef9f1a1f36d593ac5f1fc3b7c49b404c85a16076 (diff) | |
| parent | a7d168db6bb7a5be2616a4828f491e412fe57a6d (diff) | |
| download | linux-next-8979c222ebebb34066a2cf390c7746f69d4ebea7.tar.gz linux-next-8979c222ebebb34066a2cf390c7746f69d4ebea7.zip | |
Merge remote-tracking branch 'regmap/for-7.3' into regmap-next
| -rw-r--r-- | drivers/base/regmap/internal.h | 2 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache-flat.c | 4 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache-maple.c | 8 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache-rbtree.c | 8 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache.c | 24 | ||||
| -rw-r--r-- | drivers/base/regmap/regmap-irq.c | 22 | ||||
| -rw-r--r-- | include/linux/regmap.h | 2 |
7 files changed, 45 insertions, 25 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index 55273a6178f8..a6e4689000af 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h @@ -189,7 +189,7 @@ struct regcache_ops { const char *name; enum regcache_type type; int (*init)(struct regmap *map); - int (*exit)(struct regmap *map); + void (*exit)(struct regmap *map); int (*populate)(struct regmap *map); #ifdef CONFIG_DEBUG_FS void (*debugfs_init)(struct regmap *map); diff --git a/drivers/base/regmap/regcache-flat.c b/drivers/base/regmap/regcache-flat.c index 025e6749bb24..be8497fd240c 100644 --- a/drivers/base/regmap/regcache-flat.c +++ b/drivers/base/regmap/regcache-flat.c @@ -53,7 +53,7 @@ err_free: return -ENOMEM; } -static int regcache_flat_exit(struct regmap *map) +static void regcache_flat_exit(struct regmap *map) { struct regcache_flat_data *cache = map->cache; @@ -62,8 +62,6 @@ static int regcache_flat_exit(struct regmap *map) kfree(cache); map->cache = NULL; - - return 0; } static int regcache_flat_populate(struct regmap *map) diff --git a/drivers/base/regmap/regcache-maple.c b/drivers/base/regmap/regcache-maple.c index 49ba7282e4b8..e46fe5c32b7f 100644 --- a/drivers/base/regmap/regcache-maple.c +++ b/drivers/base/regmap/regcache-maple.c @@ -112,7 +112,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min, unsigned long *entry, *lower, *upper; /* initialized to work around false-positive -Wuninitialized warning */ unsigned long lower_index = 0, lower_last = 0; - unsigned long upper_index, upper_last; + unsigned long upper_index = 0, upper_last = 0; int ret = 0; lower = NULL; @@ -307,7 +307,7 @@ static int regcache_maple_init(struct regmap *map) return 0; } -static int regcache_maple_exit(struct regmap *map) +static void regcache_maple_exit(struct regmap *map) { struct maple_tree *mt = map->cache; MA_STATE(mas, mt, 0, UINT_MAX); @@ -315,7 +315,7 @@ static int regcache_maple_exit(struct regmap *map) /* if we've already been called then just return */ if (!mt) - return 0; + return; mas_lock(&mas); mas_for_each(&mas, entry, UINT_MAX) @@ -325,8 +325,6 @@ static int regcache_maple_exit(struct regmap *map) kfree(mt); map->cache = NULL; - - return 0; } static int regcache_maple_insert_block(struct regmap *map, int first, diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index a69e8b4c359b..520d5f8ba3cd 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c @@ -16,7 +16,7 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg, unsigned int value); -static int regcache_rbtree_exit(struct regmap *map); +static void regcache_rbtree_exit(struct regmap *map); struct regcache_rbtree_node { /* block of adjacent registers */ @@ -196,7 +196,7 @@ static int regcache_rbtree_init(struct regmap *map) return 0; } -static int regcache_rbtree_exit(struct regmap *map) +static void regcache_rbtree_exit(struct regmap *map) { struct rb_node *next; struct regcache_rbtree_ctx *rbtree_ctx; @@ -205,7 +205,7 @@ static int regcache_rbtree_exit(struct regmap *map) /* if we've already been called then just return */ rbtree_ctx = map->cache; if (!rbtree_ctx) - return 0; + return; /* free up the rbtree */ next = rb_first(&rbtree_ctx->root); @@ -221,8 +221,6 @@ static int regcache_rbtree_exit(struct regmap *map) /* release the resources */ kfree(map->cache); map->cache = NULL; - - return 0; } static int regcache_rbtree_populate(struct regmap *map) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index aa8f2efed779..96cdae25b9c4 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -401,7 +401,8 @@ static int rbtree_all(const void *key, const struct rb_node *node) */ int regcache_sync(struct regmap *map) { - int ret = 0; + int sync_ret = 0; + int selector_ret = 0; unsigned int i; const char *name; bool bypass; @@ -426,21 +427,21 @@ int regcache_sync(struct regmap *map) /* Apply any patch first */ map->cache_bypass = true; for (i = 0; i < map->patch_regs; i++) { - ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def); - if (ret != 0) { + sync_ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def); + if (sync_ret != 0) { dev_err(map->dev, "Failed to write %x = %x: %d\n", - map->patch[i].reg, map->patch[i].def, ret); + map->patch[i].reg, map->patch[i].def, sync_ret); goto out; } } map->cache_bypass = false; if (map->cache_ops->sync) - ret = map->cache_ops->sync(map, 0, map->max_register); + sync_ret = map->cache_ops->sync(map, 0, map->max_register); else - ret = regcache_default_sync(map, 0, map->max_register); + sync_ret = regcache_default_sync(map, 0, map->max_register); - if (ret == 0) + if (sync_ret == 0) map->cache_dirty = false; out: @@ -462,10 +463,11 @@ out: if (regcache_read(map, this->selector_reg, &i) != 0) continue; - ret = _regmap_write(map, this->selector_reg, i); - if (ret != 0) { + selector_ret = _regmap_write(map, this->selector_reg, i); + if (selector_ret != 0) { + map->cache_dirty = true; dev_err(map->dev, "Failed to write %x = %x: %d\n", - this->selector_reg, i, ret); + this->selector_reg, i, selector_ret); break; } } @@ -476,7 +478,7 @@ out: trace_regcache_sync(map, name, "stop"); - return ret; + return sync_ret ? sync_ret : selector_ret; } EXPORT_SYMBOL_GPL(regcache_sync); diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 07234d415b51..99b55b1053ee 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -296,6 +296,26 @@ static int regmap_irq_set_wake(struct irq_data *data, unsigned int on) return 0; } +static int regmap_irq_reqres(struct irq_data *data) +{ + struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); + irq_hw_number_t hwirq = irqd_to_hwirq(data); + + if (d->chip->irq_reqres) + return d->chip->irq_reqres(d->chip->irq_drv_data, hwirq); + + return 0; +} + +static void regmap_irq_relres(struct irq_data *data) +{ + struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); + irq_hw_number_t hwirq = irqd_to_hwirq(data); + + if (d->chip->irq_relres) + d->chip->irq_relres(d->chip->irq_drv_data, hwirq); +} + static const struct irq_chip regmap_irq_chip = { .irq_bus_lock = regmap_irq_lock, .irq_bus_sync_unlock = regmap_irq_sync_unlock, @@ -303,6 +323,8 @@ static const struct irq_chip regmap_irq_chip = { .irq_enable = regmap_irq_enable, .irq_set_type = regmap_irq_set_type, .irq_set_wake = regmap_irq_set_wake, + .irq_request_resources = regmap_irq_reqres, + .irq_release_resources = regmap_irq_relres, }; static inline int read_sub_irq_data(struct regmap_irq_chip_data *data, diff --git a/include/linux/regmap.h b/include/linux/regmap.h index df44cb30f53b..370baa19db87 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1770,6 +1770,8 @@ struct regmap_irq_chip { void *irq_drv_data); unsigned int (*get_irq_reg)(struct regmap_irq_chip_data *data, unsigned int base, int index); + int (*irq_reqres)(void *irq_drv_data, irq_hw_number_t hwirq); + void (*irq_relres)(void *irq_drv_data, irq_hw_number_t hwirq); void *irq_drv_data; }; |
