Skip to content

Commit 372e174

Browse files
committed
Merge remote-tracking branch 'regmap/for-next' into sound/upstream-20250804
2 parents f26e086 + 067aa45 commit 372e174

5 files changed

Lines changed: 28 additions & 24 deletions

File tree

drivers/base/regmap/regmap-debugfs.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,6 @@ static ssize_t regmap_cache_only_write_file(struct file *file,
470470
if (err)
471471
return count;
472472

473-
err = debugfs_file_get(file->f_path.dentry);
474-
if (err)
475-
return err;
476-
477473
map->lock(map->lock_arg);
478474

479475
if (new_val && !map->cache_only) {
@@ -486,7 +482,6 @@ static ssize_t regmap_cache_only_write_file(struct file *file,
486482
map->cache_only = new_val;
487483

488484
map->unlock(map->lock_arg);
489-
debugfs_file_put(file->f_path.dentry);
490485

491486
if (require_sync) {
492487
err = regcache_sync(map);
@@ -517,10 +512,6 @@ static ssize_t regmap_cache_bypass_write_file(struct file *file,
517512
if (err)
518513
return count;
519514

520-
err = debugfs_file_get(file->f_path.dentry);
521-
if (err)
522-
return err;
523-
524515
map->lock(map->lock_arg);
525516

526517
if (new_val && !map->cache_bypass) {
@@ -532,7 +523,6 @@ static ssize_t regmap_cache_bypass_write_file(struct file *file,
532523
map->cache_bypass = new_val;
533524

534525
map->unlock(map->lock_arg);
535-
debugfs_file_put(file->f_path.dentry);
536526

537527
return count;
538528
}

drivers/base/regmap/regmap-irq.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
struct regmap_irq_chip_data {
2323
struct mutex lock;
24+
struct lock_class_key lock_key;
2425
struct irq_chip irq_chip;
2526

2627
struct regmap *map;
@@ -801,7 +802,13 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
801802
goto err_alloc;
802803
}
803804

804-
mutex_init(&d->lock);
805+
/*
806+
* If one regmap-irq is the parent of another then we'll try
807+
* to lock the child with the parent locked, use an explicit
808+
* lock_key so lockdep can figure out what's going on.
809+
*/
810+
lockdep_register_key(&d->lock_key);
811+
mutex_init_with_key(&d->lock, &d->lock_key);
805812

806813
for (i = 0; i < chip->num_irqs; i++)
807814
d->mask_buf_def[chip->irqs[i].reg_offset / map->reg_stride]
@@ -816,7 +823,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
816823
d->mask_buf[i],
817824
chip->irq_drv_data);
818825
if (ret)
819-
goto err_alloc;
826+
goto err_mutex;
820827
}
821828

822829
if (chip->mask_base && !chip->handle_mask_sync) {
@@ -827,7 +834,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
827834
if (ret) {
828835
dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
829836
reg, ret);
830-
goto err_alloc;
837+
goto err_mutex;
831838
}
832839
}
833840

@@ -838,7 +845,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
838845
if (ret) {
839846
dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
840847
reg, ret);
841-
goto err_alloc;
848+
goto err_mutex;
842849
}
843850
}
844851

@@ -855,7 +862,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
855862
if (ret != 0) {
856863
dev_err(map->dev, "Failed to read IRQ status: %d\n",
857864
ret);
858-
goto err_alloc;
865+
goto err_mutex;
859866
}
860867
}
861868

@@ -879,7 +886,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
879886
if (ret != 0) {
880887
dev_err(map->dev, "Failed to ack 0x%x: %d\n",
881888
reg, ret);
882-
goto err_alloc;
889+
goto err_mutex;
883890
}
884891
}
885892
}
@@ -901,7 +908,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
901908
if (ret != 0) {
902909
dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
903910
reg, ret);
904-
goto err_alloc;
911+
goto err_mutex;
905912
}
906913
}
907914
}
@@ -910,15 +917,15 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
910917
if (chip->status_is_level) {
911918
ret = read_irq_data(d);
912919
if (ret < 0)
913-
goto err_alloc;
920+
goto err_mutex;
914921

915922
memcpy(d->prev_status_buf, d->status_buf,
916923
array_size(d->chip->num_regs, sizeof(d->prev_status_buf[0])));
917924
}
918925

919926
ret = regmap_irq_create_domain(fwnode, irq_base, chip, d);
920927
if (ret)
921-
goto err_alloc;
928+
goto err_mutex;
922929

923930
ret = request_threaded_irq(irq, NULL, regmap_irq_thread,
924931
irq_flags | IRQF_ONESHOT,
@@ -935,6 +942,9 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
935942

936943
err_domain:
937944
/* Should really dispose of the domain but... */
945+
err_mutex:
946+
mutex_destroy(&d->lock);
947+
lockdep_unregister_key(&d->lock_key);
938948
err_alloc:
939949
kfree(d->type_buf);
940950
kfree(d->type_buf_def);
@@ -1027,6 +1037,8 @@ void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d)
10271037
kfree(d->config_buf[i]);
10281038
kfree(d->config_buf);
10291039
}
1040+
mutex_destroy(&d->lock);
1041+
lockdep_unregister_key(&d->lock_key);
10301042
kfree(d);
10311043
}
10321044
EXPORT_SYMBOL_GPL(regmap_del_irq_chip);

drivers/base/regmap/regmap-kunit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ static void stride(struct kunit *test)
736736
}
737737
}
738738

739-
static struct regmap_range_cfg test_range = {
739+
static const struct regmap_range_cfg test_range = {
740740
.selector_reg = 1,
741741
.selector_mask = 0xff,
742742

drivers/base/regmap/regmap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,8 @@ struct regmap *__regmap_init(struct device *dev,
11731173
err_map:
11741174
kfree(map);
11751175
err:
1176+
if (bus && bus->free_on_exit)
1177+
kfree(bus);
11761178
return ERR_PTR(ret);
11771179
}
11781180
EXPORT_SYMBOL_GPL(__regmap_init);

include/linux/regmap.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ int regmap_attach_dev(struct device *dev, struct regmap *map,
913913
* @config: Configuration for register map
914914
*
915915
* The return value will be an ERR_PTR() on error or a valid pointer to
916-
* a struct regmap.
916+
* a struct regmap. Implies 'fast_io'.
917917
*/
918918
#define regmap_init_mmio_clk(dev, clk_id, regs, config) \
919919
__regmap_lockdep_wrapper(__regmap_init_mmio_clk, #config, \
@@ -927,7 +927,7 @@ int regmap_attach_dev(struct device *dev, struct regmap *map,
927927
* @config: Configuration for register map
928928
*
929929
* The return value will be an ERR_PTR() on error or a valid pointer to
930-
* a struct regmap.
930+
* a struct regmap. Implies 'fast_io'.
931931
*/
932932
#define regmap_init_mmio(dev, regs, config) \
933933
regmap_init_mmio_clk(dev, NULL, regs, config)
@@ -1138,7 +1138,7 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
11381138
*
11391139
* The return value will be an ERR_PTR() on error or a valid pointer
11401140
* to a struct regmap. The regmap will be automatically freed by the
1141-
* device management code.
1141+
* device management code. Implies 'fast_io'.
11421142
*/
11431143
#define devm_regmap_init_mmio_clk(dev, clk_id, regs, config) \
11441144
__regmap_lockdep_wrapper(__devm_regmap_init_mmio_clk, #config, \
@@ -1153,7 +1153,7 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
11531153
*
11541154
* The return value will be an ERR_PTR() on error or a valid pointer
11551155
* to a struct regmap. The regmap will be automatically freed by the
1156-
* device management code.
1156+
* device management code. Implies 'fast_io'.
11571157
*/
11581158
#define devm_regmap_init_mmio(dev, regs, config) \
11591159
devm_regmap_init_mmio_clk(dev, NULL, regs, config)

0 commit comments

Comments
 (0)