Re: [PATCH] drm/vc4: Add a debugfs entry to disable/enable the load tracker

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, 2018-11-30 at 11:04 +0100, Boris Brezillon wrote:
> Hi Paul,
> 
> On Fri, 30 Nov 2018 10:56:58 +0100
> Paul Kocialkowski <paul.kocialkowski@xxxxxxxxxxx> 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.

You're right, it would be better that way. There is indeed no particular
constraint for having this in vc4_drv.

Cheers,

Paul

-- 
Paul Kocialkowski, Bootlin (formerly Free Electrons)
Embedded Linux and kernel engineering
https://bootlin.com

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux