From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Eric Anholt <eric@anholt.net>, David Airlie <airlied@linux.ie>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH] drm/vc4: Add a debugfs entry to disable/enable the load tracker
Date: Fri, 30 Nov 2018 11:04:41 +0100 [thread overview]
Message-ID: <20181130110441.6d765c3e@bbrezillon> (raw)
In-Reply-To: <20181130095658.31062-1-paul.kocialkowski@bootlin.com>
Hi Paul,
On Fri, 30 Nov 2018 10:56:58 +0100
Paul Kocialkowski <paul.kocialkowski@bootlin.com> wrote:
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index 7195a0bcceb3..0ee75c71d8d8 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -46,6 +46,56 @@
> #define DRIVER_MINOR 0
> #define DRIVER_PATCHLEVEL 0
>
> +static int vc4_debugfs_load_tracker_get(struct seq_file *m, void *data)
> +{
> + struct drm_device *dev = m->private;
> + struct vc4_dev *vc4 = to_vc4_dev(dev);
> +
> + if (vc4->load_tracker_enabled)
> + seq_printf(m, "enabled\n");
> + else
> + seq_printf(m, "disabled\n");
> +
> + return 0;
> +}
> +
> +static ssize_t vc4_debugfs_load_tracker_set(struct file *file,
> + const char __user *ubuf,
> + size_t len, loff_t *offp)
> +{
> + struct seq_file *m = file->private_data;
> + struct drm_device *dev = m->private;
> + struct vc4_dev *vc4 = to_vc4_dev(dev);
> + char buf[32] = {};
> +
> + if (len >= sizeof(buf))
> + return -EINVAL;
> +
> + if (copy_from_user(buf, ubuf, len))
> + return -EFAULT;
> +
> + if (!strncasecmp(buf, "enable", 6))
> + vc4->load_tracker_enabled = true;
> + else if (!strncasecmp(buf, "disable", 7))
> + vc4->load_tracker_enabled = false;
> + else
> + return -EINVAL;
> +
> + return len;
> +}
> +
> +static int vc4_debugfs_load_tracker_open(struct inode *inode, struct file *file)
> +{
> + return single_open(file, vc4_debugfs_load_tracker_get, inode->i_private);
> +}
> +
> +const struct file_operations vc4_debugfs_load_tracker_fops = {
> + .owner = THIS_MODULE,
> + .open = vc4_debugfs_load_tracker_open,
> + .read = seq_read,
> + .write = vc4_debugfs_load_tracker_set,
> +};
> +
I'd put this code directly in vc4_debugfs.c so you can make
vc4_debugfs_load_tracker_fops static and you don't need the extern ...
definition in vc4_drv.h. But maybe you have a good reason to do that.
Regards,
Boris
next prev parent reply other threads:[~2018-11-30 10:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-30 9:56 [PATCH] drm/vc4: Add a debugfs entry to disable/enable the load tracker Paul Kocialkowski
2018-11-30 10:04 ` Boris Brezillon [this message]
2018-11-30 10:21 ` Paul Kocialkowski
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=20181130110441.6d765c3e@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric@anholt.net \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@bootlin.com \
--cc=paul.kocialkowski@bootlin.com \
--cc=thomas.petazzoni@bootlin.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