[Intel-gfx] [RFC 1/3] fs: Introduce drmfs pseudo filesystem interfaces

Chris Wilson chris at chris-wilson.co.uk
Thu Dec 1 08:48:13 UTC 2016


On Thu, Dec 01, 2016 at 02:01:59PM +0530, sourab gupta wrote:
> On Thu, 2016-12-01 at 00:07 -0800, Chris Wilson wrote:
> > On Thu, Dec 01, 2016 at 12:32:31PM +0530, swati.dhingra at intel.com wrote:
> > > +int drmfs_init(void)
> > > +{
> > > +	int retval;
> > > +
> > > +	retval = sysfs_create_mount_point(kernel_kobj, "drm");
> > > +	if (retval)
> > > +		return -EINVAL;
> > > +
> > > +	retval = register_filesystem(&drm_fs_type);
> > > +	if (!retval)
> > > +		drmfs_registered = true;
> > > +
> > > +	return retval;
> > > +}
> > > +EXPORT_SYMBOL(drmfs_init);
> > > +
> > > +int drmfs_fini(void)
> > > +{
> > > +	int retval;
> > > +
> > > +	retval = unregister_filesystem(&drm_fs_type);
> > > +	if (retval)
> > > +		return retval;
> > > +
> > > +	drmfs_registered = false;
> > > +
> > > +	sysfs_remove_mount_point(kernel_kobj, "drm");
> > > +}
> > > +EXPORT_SYMBOL(drmfs_fini);
> > 
> > This needs to act like a singleton for multiple DRM drivers, i.e.
> > add a mutex and use drmfs_registered as a reference count (also then
> > don't call the entrypoint init/fini). Or alternatively (and probably
> > better?), simply do init/fini from the DRM module init.
> > -Chris
> > 
> Hi Chris,
> 
> In the second patch, drmfs_init is called by drm_core_init, which should
> thus be called only once (i.e. during drm module init), and likewise for
> drmfs_fini which is called during drm_core_exit.
> Am I missing something here?

Nope, that was me missing the change from driver registration to core
between chunks.  The only thing missing here then are the __init,
__exit markers, and to make it perfectly clear that this is a distinct
phase move the calls to init/exit into their own patch.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list