From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Gilad Ben-Yossef <gilad@benyossef.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
Felipe Balbi <balbi@kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Mathias Nyman <mathias.nyman@intel.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Chunfeng Yun <chunfeng.yun@mediatek.com>, Bin Liu <b-liu@ti.com>,
linux-crypto@vger.kernel.org, linux-pm@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] debugfs: regset32: Add Runtime PM support
Date: Mon, 10 Feb 2020 11:01:32 -0800 [thread overview]
Message-ID: <20200210190132.GB1058087@kroah.com> (raw)
In-Reply-To: <20200124132957.15769-2-geert+renesas@glider.be>
On Fri, Jan 24, 2020 at 02:29:56PM +0100, Geert Uytterhoeven wrote:
> 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 locks.
>
> 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>
> ---
> fs/debugfs/file.c | 8 ++++++++
> include/linux/debugfs.h | 1 +
> 2 files changed, 9 insertions(+)
>
> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> index dede25247b81f72a..5e52d68421c678f2 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>
>
> @@ -1057,7 +1058,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;
> }
>
> diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
> index bf9b6cafa4c26a68..5d0783ae09f365ac 100644
> --- a/include/linux/debugfs.h
> +++ b/include/linux/debugfs.h
> @@ -35,6 +35,7 @@ struct debugfs_regset32 {
> const struct debugfs_reg32 *regs;
> int nregs;
> void __iomem *base;
> + struct device *dev; /* Optional device for Runtime PM */
> };
>
> extern struct dentry *arch_debugfs_dir;
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
next prev parent reply other threads:[~2020-02-10 19:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-24 13:29 [PATCH 0/2] Fix debugfs register access while suspended Geert Uytterhoeven
2020-01-24 13:29 ` [PATCH 1/2] debugfs: regset32: Add Runtime PM support Geert Uytterhoeven
2020-01-31 10:13 ` Rafael J. Wysocki
2020-02-10 19:01 ` Greg Kroah-Hartman [this message]
2020-01-24 13:29 ` [PATCH 2/2] crypto: ccree - fix debugfs register access while suspended Geert Uytterhoeven
2020-01-26 13:32 ` Gilad Ben-Yossef
2020-01-31 10:11 ` Rafael J. Wysocki
2020-01-24 16:24 ` [PATCH 0/2] Fix " Niklas Söderlund
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=20200210190132.GB1058087@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=b-liu@ti.com \
--cc=balbi@kernel.org \
--cc=chunfeng.yun@mediatek.com \
--cc=davem@davemloft.net \
--cc=geert+renesas@glider.be \
--cc=gilad@benyossef.com \
--cc=herbert@gondor.apana.org.au \
--cc=jonathanh@nvidia.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=matthias.bgg@gmail.com \
--cc=rafael@kernel.org \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=stern@rowland.harvard.edu \
--cc=thierry.reding@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).