History

Merge tag 'regmap-fix-v5.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into master

Pull regmap fixes from Mark Brown: "A couple of substantial fixes here, one from Doug which fixes the debugfs code for MMIO regmaps (fortunately not the common case) and one from Marc fixing lookups of multiple regmaps for the same device (a very unusual case). There's also a fix for Kconfig to ensure we enable SoundWire properly" * tag 'regmap-fix-v5.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: debugfs: Don't sleep while atomic for fast_io regmaps regmap: add missing dependency on SoundWire regmap: dev_get_regmap_match(): fix string comparison

Linus Torvalds committed 6 years ago

Commit ee436952 parents 60541fb 299632e3 files · +31 −25Browse files

Unified · Split

3 files
  1. drivers/base/regmap/Kconfig +1 −1
  2. drivers/base/regmap/regmap-debugfs.c +29 −23
  3. drivers/base/regmap/regmap.c +1 −1
drivers/base/regmap/Kconfig+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
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+29−23
@@ -463,29 +463,31 @@ static ssize_t regmap_cache_only_write_file(struct file *file, · 462 unmodified lines
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);
@@ -493,7 +495,7 @@ static ssize_t regmap_cache_only_write_file(struct file *file, · 1 unmodified line
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, · 8 unmodified lines
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+1−1
@@ -1364,7 +1364,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data) · 1363 unmodified lines
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 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t