[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240110095358.473663-1-alexander.stein@ew.tq-group.com>
Date: Wed, 10 Jan 2024 10:53:58 +0100
From: Alexander Stein <alexander.stein@...tq-group.com>
To: Mark Brown <broonie@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>
Cc: Alexander Stein <alexander.stein@...tq-group.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] regmap: debugfs: runtime resume a device when reading registers
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@...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
Powered by blists - more mailing lists