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
4# subsystems should select the appropriate symbols.4# subsystems should select the appropriate symbols.
5 5
6config REGMAP6config 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)
8 select IRQ_DOMAIN if REGMAP_IRQ8 select IRQ_DOMAIN if REGMAP_IRQ
9 bool9 bool
10 10
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
463{463{
464 struct regmap *map = container_of(file->private_data,464 struct regmap *map = container_of(file->private_data,
465 struct regmap, cache_only);465 struct regmap, cache_only);
466 ssize_t result;466 bool new_val, require_sync = false;
467 bool was_enabled, require_sync = false;
468 int err;467 int err;
469 468
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;
471 473
472 was_enabled = map->cache_only;474 err = debugfs_file_get(file->f_path.dentry);
475 if (err)
476 return err;
473 477
474 result = debugfs_write_file_bool(file, user_buf, count, ppos);478 map->lock(map->lock_arg);
475 if (result < 0) {
476 map->unlock(map->lock_arg);
477 return result;
478 }
479 479
480 if (map->cache_only && !was_enabled) {480 if (new_val && !map->cache_only) {
481 dev_warn(map->dev, "debugfs cache_only=Y forced\n");481 dev_warn(map->dev, "debugfs cache_only=Y forced\n");
482 add_taint(TAINT_USER, LOCKDEP_STILL_OK);482 add_taint(TAINT_USER, LOCKDEP_STILL_OK);
483 } else if (!map->cache_only && was_enabled) {483 } else if (!new_val && map->cache_only) {
484 dev_warn(map->dev, "debugfs cache_only=N forced: syncing cache\n");484 dev_warn(map->dev, "debugfs cache_only=N forced: syncing cache\n");
485 require_sync = true;485 require_sync = true;
486 }486 }
487 map->cache_only = new_val;
487 488
488 map->unlock(map->lock_arg);489 map->unlock(map->lock_arg);
490 debugfs_file_put(file->f_path.dentry);
489 491
490 if (require_sync) {492 if (require_sync) {
491 err = regcache_sync(map);493 err = regcache_sync(map);
@@ -493,7 +495,7 @@ static ssize_t regmap_cache_only_write_file(struct file *file, · 1 unmodified line
493 dev_err(map->dev, "Failed to sync cache %d\n", err);495 dev_err(map->dev, "Failed to sync cache %d\n", err);
494 }496 }
495 497
496 return result;498 return count;
497}499}
498 500
499static const struct file_operations regmap_cache_only_fops = {501static 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
508{510{
509 struct regmap *map = container_of(file->private_data,511 struct regmap *map = container_of(file->private_data,
510 struct regmap, cache_bypass);512 struct regmap, cache_bypass);
511 ssize_t result;513 bool new_val;
512 bool was_enabled;514 int err;
513 515
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;
515 520
516 was_enabled = map->cache_bypass;521 err = debugfs_file_get(file->f_path.dentry);
522 if (err)
523 return err;
517 524
518 result = debugfs_write_file_bool(file, user_buf, count, ppos);525 map->lock(map->lock_arg);
519 if (result < 0)
520 goto out;
521 526
522 if (map->cache_bypass && !was_enabled) {527 if (new_val && !map->cache_bypass) {
523 dev_warn(map->dev, "debugfs cache_bypass=Y forced\n");528 dev_warn(map->dev, "debugfs cache_bypass=Y forced\n");
524 add_taint(TAINT_USER, LOCKDEP_STILL_OK);529 add_taint(TAINT_USER, LOCKDEP_STILL_OK);
525 } else if (!map->cache_bypass && was_enabled) {530 } else if (!new_val && map->cache_bypass) {
526 dev_warn(map->dev, "debugfs cache_bypass=N forced\n");531 dev_warn(map->dev, "debugfs cache_bypass=N forced\n");
527 }532 }
533 map->cache_bypass = new_val;
528 534
529out:
530 map->unlock(map->lock_arg);535 map->unlock(map->lock_arg);
536 debugfs_file_put(file->f_path.dentry);
531 537
532 return result;538 return count;
533}539}
534 540
535static const struct file_operations regmap_cache_bypass_fops = {541static 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
1364 1364
1365 /* If the user didn't specify a name match any */1365 /* If the user didn't specify a name match any */
1366 if (data)1366 if (data)
1367 return (*r)->name == data;1367 return !strcmp((*r)->name, data);
1368 else1368 else
1369 return 1;1369 return 1;
1370}1370}

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