Skip to content

Commit 2b0f61e

Browse files
committed
Merge remote-tracking branch 'regmap/for-5.8' into regmap-linus
2 parents 11ba468 + 299632e commit 2b0f61e

File tree

3 files changed

+31
-25
lines changed

3 files changed

+31
-25
lines changed

drivers/base/regmap/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# subsystems should select the appropriate symbols.
55

66
config REGMAP
7-
default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SCCB || REGMAP_I3C)
7+
default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SCCB || REGMAP_I3C)
88
select IRQ_DOMAIN if REGMAP_IRQ
99
bool
1010

drivers/base/regmap/regmap-debugfs.c

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -463,37 +463,39 @@ static ssize_t regmap_cache_only_write_file(struct file *file,
463463
{
464464
struct regmap *map = container_of(file->private_data,
465465
struct regmap, cache_only);
466-
ssize_t result;
467-
bool was_enabled, require_sync = false;
466+
bool new_val, require_sync = false;
468467
int err;
469468

470-
map->lock(map->lock_arg);
469+
err = kstrtobool_from_user(user_buf, count, &new_val);
470+
/* Ignore malforned data like debugfs_write_file_bool() */
471+
if (err)
472+
return count;
471473

472-
was_enabled = map->cache_only;
474+
err = debugfs_file_get(file->f_path.dentry);
475+
if (err)
476+
return err;
473477

474-
result = debugfs_write_file_bool(file, user_buf, count, ppos);
475-
if (result < 0) {
476-
map->unlock(map->lock_arg);
477-
return result;
478-
}
478+
map->lock(map->lock_arg);
479479

480-
if (map->cache_only && !was_enabled) {
480+
if (new_val && !map->cache_only) {
481481
dev_warn(map->dev, "debugfs cache_only=Y forced\n");
482482
add_taint(TAINT_USER, LOCKDEP_STILL_OK);
483-
} else if (!map->cache_only && was_enabled) {
483+
} else if (!new_val && map->cache_only) {
484484
dev_warn(map->dev, "debugfs cache_only=N forced: syncing cache\n");
485485
require_sync = true;
486486
}
487+
map->cache_only = new_val;
487488

488489
map->unlock(map->lock_arg);
490+
debugfs_file_put(file->f_path.dentry);
489491

490492
if (require_sync) {
491493
err = regcache_sync(map);
492494
if (err)
493495
dev_err(map->dev, "Failed to sync cache %d\n", err);
494496
}
495497

496-
return result;
498+
return count;
497499
}
498500

499501
static const struct file_operations regmap_cache_only_fops = {
@@ -508,28 +510,32 @@ static ssize_t regmap_cache_bypass_write_file(struct file *file,
508510
{
509511
struct regmap *map = container_of(file->private_data,
510512
struct regmap, cache_bypass);
511-
ssize_t result;
512-
bool was_enabled;
513+
bool new_val;
514+
int err;
513515

514-
map->lock(map->lock_arg);
516+
err = kstrtobool_from_user(user_buf, count, &new_val);
517+
/* Ignore malforned data like debugfs_write_file_bool() */
518+
if (err)
519+
return count;
515520

516-
was_enabled = map->cache_bypass;
521+
err = debugfs_file_get(file->f_path.dentry);
522+
if (err)
523+
return err;
517524

518-
result = debugfs_write_file_bool(file, user_buf, count, ppos);
519-
if (result < 0)
520-
goto out;
525+
map->lock(map->lock_arg);
521526

522-
if (map->cache_bypass && !was_enabled) {
527+
if (new_val && !map->cache_bypass) {
523528
dev_warn(map->dev, "debugfs cache_bypass=Y forced\n");
524529
add_taint(TAINT_USER, LOCKDEP_STILL_OK);
525-
} else if (!map->cache_bypass && was_enabled) {
530+
} else if (!new_val && map->cache_bypass) {
526531
dev_warn(map->dev, "debugfs cache_bypass=N forced\n");
527532
}
533+
map->cache_bypass = new_val;
528534

529-
out:
530535
map->unlock(map->lock_arg);
536+
debugfs_file_put(file->f_path.dentry);
531537

532-
return result;
538+
return count;
533539
}
534540

535541
static const struct file_operations regmap_cache_bypass_fops = {

drivers/base/regmap/regmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data)
13641364

13651365
/* If the user didn't specify a name match any */
13661366
if (data)
1367-
return (*r)->name == data;
1367+
return !strcmp((*r)->name, data);
13681368
else
13691369
return 1;
13701370
}

0 commit comments

Comments
 (0)