mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] regmap: debugfs: runtime resume a device when reading registers
@ 2024-01-10  9:53 Alexander Stein
  2024-01-10 12:23 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Stein @ 2024-01-10  9:53 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, Rafael J . Wysocki
  Cc: Alexander Stein, linux-kernel

If the registers shall be read from device, runtime resume it in order
to enable a possiblly attached power domain before accessing the device.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/base/regmap/regmap-debugfs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index fb84cda92a753..063ede23173af 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -12,6 +12,7 @@
 #include <linux/uaccess.h>
 #include <linux/device.h>
 #include <linux/list.h>
+#include <linux/pm_runtime.h>
 
 #include "internal.h"
 
@@ -233,6 +234,10 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
 	if (!buf)
 		return -ENOMEM;
 
+	ret = pm_runtime_resume_and_get(map->dev);
+	if (ret)
+		goto out_free;
+
 	regmap_calc_tot_len(map, buf, count);
 
 	/* Work out which register we're starting at */
@@ -277,6 +282,8 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
 	*ppos += buf_pos;
 
 out:
+	pm_runtime_put(map->dev);
+out_free:
 	kfree(buf);
 	return ret;
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-10 13:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-10  9:53 [PATCH 1/1] regmap: debugfs: runtime resume a device when reading registers Alexander Stein
2024-01-10 12:23 ` Mark Brown
2024-01-10 12:46   ` Alexander Stein
2024-01-10 13:04     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®