summaryrefslogtreecommitdiffstats
path: root/fs/debugfs/file.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2020-02-11 19:18:55 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-17 11:13:06 +0200
commit2a352e42ac5432552b8bd6cbc202039bf9189308 (patch)
tree21ecab512b4ef26ad78f1712cda63b24fd5c3162 /fs/debugfs/file.c
parent8b3a7f0071a42d0b48ef4921f892b7e774c826aa (diff)
downloadlinux-stable-2a352e42ac5432552b8bd6cbc202039bf9189308.tar.gz
linux-stable-2a352e42ac5432552b8bd6cbc202039bf9189308.tar.bz2
linux-stable-2a352e42ac5432552b8bd6cbc202039bf9189308.zip
debugfs: regset32: Add Runtime PM support
commit 30332eeefec8f83afcea00c360f99ef64b87f220 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/debugfs/file.c')
-rw-r--r--fs/debugfs/file.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index a57d080d2ba5..acdc802bfe9a 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 "internal.h"
@@ -1084,7 +1085,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;
}