]> git.baikalelectronics.ru Git - kernel.git/commit
regmap: debugfs: Don't sleep while atomic for fast_io regmaps
authorDouglas Anderson <dianders@chromium.org>
Wed, 15 Jul 2020 23:46:15 +0000 (16:46 -0700)
committerMark Brown <broonie@kernel.org>
Thu, 16 Jul 2020 19:41:58 +0000 (20:41 +0100)
commitb47d5d21e8ee770e108dcb1eaef456dac23003b2
tree65171a1cbbd6433e9ad87033ca03534242eefcd2
parent7e0d7934b6bc5e967422b21c20886781d5f571df
regmap: debugfs: Don't sleep while atomic for fast_io regmaps

If a regmap has "fast_io" set then its lock function uses a spinlock.
That doesn't work so well with the functions:
* regmap_cache_only_write_file()
* regmap_cache_bypass_write_file()

Both of the above functions have the pattern:
1. Lock the regmap.
2. Call:
   debugfs_write_file_bool()
     copy_from_user()
       __might_fault()
         __might_sleep()

Let's reorder things a bit so that we do all of our sleepable
functions before we grab the lock.

Fixes: 15c9be8e3142 ("regmap: debugfs: Allow writes to cache state settings")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20200715164611.1.I35b3533e8a80efde0cec1cc70f71e1e74b2fa0da@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap-debugfs.c