diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2020-02-11 21:18:55 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2020-02-22 04:25:42 +0300 |
commit | 30332eeefec8f83afcea00c360f99ef64b87f220 (patch) | |
tree | f1d07f6fe23cb002d66933b9cc35e3c626d03db6 /fs/debugfs | |
parent | 9e00df7156e45e42c695ffc596b4bf1328d00516 (diff) | |
download | linux-30332eeefec8f83afcea00c360f99ef64b87f220.tar.xz |
debugfs: regset32: Add Runtime PM support
Hardware registers of devices under control of power management cannot
be accessed at all times. If such a device is suspended, register
accesses may lead to undefined behavior, like reading bogus values, or
causing exceptions or system lock-ups.
Extend struct debugfs_regset32 with an optional field to let device
drivers specify the device the registers in the set belong to. This
allows debugfs_show_regset32() to make sure the device is resumed while
its registers are being read.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'fs/debugfs')
-rw-r--r-- | fs/debugfs/file.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 634b09d18b77..204734f8d1c6 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -18,6 +18,7 @@ #include <linux/slab.h> #include <linux/atomic.h> #include <linux/device.h> +#include <linux/pm_runtime.h> #include <linux/poll.h> #include <linux/security.h> @@ -1060,7 +1061,14 @@ static int debugfs_show_regset32(struct seq_file *s, void *data) { struct debugfs_regset32 *regset = s->private; + if (regset->dev) + pm_runtime_get_sync(regset->dev); + debugfs_print_regs32(s, regset->regs, regset->nregs, regset->base, ""); + + if (regset->dev) + pm_runtime_put(regset->dev); + return 0; } |