lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181130110441.6d765c3e@bbrezillon>
Date:   Fri, 30 Nov 2018 11:04:41 +0100
From:   Boris Brezillon <boris.brezillon@...tlin.com>
To:     Paul Kocialkowski <paul.kocialkowski@...tlin.com>
Cc:     dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        Eric Anholt <eric@...olt.net>, David Airlie <airlied@...ux.ie>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH] drm/vc4: Add a debugfs entry to disable/enable the load
 tracker

Hi Paul,

On Fri, 30 Nov 2018 10:56:58 +0100
Paul Kocialkowski <paul.kocialkowski@...tlin.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ