intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: sourab gupta <sourab.gupta@intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Dhingra, Swati" <swati.dhingra@intel.com>
Subject: Re: [RFC 2/3] drm: Register drmfs filesystem from drm init
Date: Fri, 02 Dec 2016 14:02:44 +0530	[thread overview]
Message-ID: <1480667564.12046.21.camel@sourab-desktop> (raw)
In-Reply-To: <20161202075734.urao4dmv3g3h254k@phenom.ffwll.local>

On Thu, 2016-12-01 at 23:57 -0800, Daniel Vetter wrote:
> On Thu, Dec 01, 2016 at 01:44:16PM +0530, swati.dhingra@intel.com wrote:
> > From: Swati Dhingra <swati.dhingra@intel.com>
> > 
> > During drm module initialization, drm_core_init initializes the drmfs
> > filesystem and register this with kernel. A driver specific directory is created
> > inside drmfs root, and dentry of this directory is saved for subsequent use
> > by the driver (e.g. i915). The driver can then create files/directories inside
> > this root directory directly.
> > In case of i915 driver, the top directory is created at '/sys/kernel/drm/i915'.
> > 
> > Signed-off-by: Sourab Gupta <sourab.gupta@intel.com>
> > Signed-off-by: Swati Dhingra <swati.dhingra@intel.com>
> > ---
> >  drivers/gpu/drm/drm_drv.c | 22 ++++++++++++++++++++++
> >  include/drm/drm_drv.h     |  3 +++
> >  2 files changed, 25 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > index 84fcfcb..ead360bd 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -688,6 +688,14 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
> >  {
> >  	int ret;
> >  
> > +#ifdef CONFIG_DRMFS
> > +	dev->driver->drmfs_root = drmfs_create_dir(dev->driver->name, NULL);
> > +	if (IS_ERR(dev->driver->drmfs_root)) {
> > +		DRM_ERROR("Failed to get drmfs root dentry\n");
> > +		return PTR_ERR(dev->driver->drmfs_root);
> > +	}
> > +#endif
> 
> Don't do #ifdef in the code, instead provide dummy static inline functions
> that do nothing in headers when a feature is disabled. For an example see
> CONFIG_DRM_FBDEV_EMULATION in drm_fb_helper.[hc].
> 
Sorry, Will take take of this going forward.

> Also, drmfs here is seriously lacking documentation. E.g. where are we
> supposed to put different things related to rendering, modesetting, and
> all these issues? You need to add a section in drm-uabi.rst, write
> kernel-doc + overview sections for all of this and pull it in.
> -Daniel
> 
Ok. Will work on adding requisite documentation for drmfs.

Thanks,
Sourab

> > +
> >  	mutex_lock(&drm_global_mutex);
> >  
> >  	ret = drm_minor_register(dev, DRM_MINOR_CONTROL);
> > @@ -758,6 +766,9 @@ void drm_dev_unregister(struct drm_device *dev)
> >  	drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
> >  	drm_minor_unregister(dev, DRM_MINOR_RENDER);
> >  	drm_minor_unregister(dev, DRM_MINOR_CONTROL);
> > +#ifdef CONFIG_DRMFS
> > +	drmfs_remove(dev->driver->drmfs_root);
> > +#endif
> >  }
> >  EXPORT_SYMBOL(drm_dev_unregister);
> >  
> > @@ -825,6 +836,9 @@ static void drm_core_exit(void)
> >  {
> >  	unregister_chrdev(DRM_MAJOR, "drm");
> >  	debugfs_remove(drm_debugfs_root);
> > +#ifdef CONFIG_DRMFS
> > +	drmfs_fini();
> > +#endif
> >  	drm_sysfs_destroy();
> >  	idr_destroy(&drm_minors_idr);
> >  	drm_connector_ida_destroy();
> > @@ -845,6 +859,14 @@ static int __init drm_core_init(void)
> >  		goto error;
> >  	}
> >  
> > +#ifdef CONFIG_DRMFS
> > +	ret = drmfs_init();
> > +	if (ret < 0) {
> > +		DRM_ERROR("Cannot create DRM FS: %d\n", ret);
> > +		goto error;
> > +	}
> > +#endif
> > +
> >  	drm_debugfs_root = debugfs_create_dir("dri", NULL);
> >  	if (!drm_debugfs_root) {
> >  		ret = -ENOMEM;
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index aad8bba..34804de 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -403,6 +403,9 @@ struct drm_driver {
> >  
> >  	/* List of devices hanging off this driver with stealth attach. */
> >  	struct list_head legacy_dev_list;
> > +
> > +	/* drmfs parent directory dentry for this driver */
> > +	struct dentry *drmfs_root;
> >  };
> >  
> >  extern __printf(6, 7)
> > -- 
> > 2.7.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-12-02  8:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01  8:14 [RFC 0/3] Introduce drmfs pseudo filesystem for drm subsystem swati.dhingra
2016-12-01  8:14 ` [RFC 1/3] fs: Introduce drmfs pseudo filesystem interfaces swati.dhingra
2016-12-02  7:53   ` Daniel Vetter
2016-12-02  8:27     ` sourab gupta
2016-12-02 22:40   ` Matt Roper
2016-12-03  0:53     ` sourab gupta
2016-12-03  9:25       ` Chris Wilson
2016-12-01  8:14 ` [RFC 2/3] drm: Register drmfs filesystem from drm init swati.dhingra
2016-12-02  7:57   ` Daniel Vetter
2016-12-02  8:32     ` sourab gupta [this message]
2016-12-01  8:14 ` [RFC 3/3] drm/i915: Creating guc log file in drmfs instead of debugfs swati.dhingra
2016-12-01  8:45 ` ✓ Fi.CI.BAT: success for Introduce drmfs pseudo filesystem for drm subsystem (rev2) Patchwork
2016-12-02  7:52 ` [RFC 0/3] Introduce drmfs pseudo filesystem for drm subsystem Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2016-12-01  7:02 swati.dhingra
2016-12-01  7:02 ` [RFC 2/3] drm: Register drmfs filesystem from drm init swati.dhingra
2016-12-01  8:15   ` Chris Wilson
2016-12-01  8:41     ` sourab gupta

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=1480667564.12046.21.camel@sourab-desktop \
    --to=sourab.gupta@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=swati.dhingra@intel.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).