From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] regmap: debugfs: runtime resume a device when reading registers
Date: Wed, 10 Jan 2024 10:53:58 +0100 [thread overview]
Message-ID: <20240110095358.473663-1-alexander.stein@ew.tq-group.com> (raw)
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
next reply other threads:[~2024-01-10 9:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 9:53 Alexander Stein [this message]
2024-01-10 12:23 ` Mark Brown
2024-01-10 12:46 ` Alexander Stein
2024-01-10 13:04 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240110095358.473663-1-alexander.stein@ew.tq-group.com \
--to=alexander.stein@ew.tq-group.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®