[Intel-gfx] [PATCH v3] drm: Provide a driver hook for drm_dev_release()

Chris Wilson chris at chris-wilson.co.uk
Sat Jan 21 11:12:57 UTC 2017


On Sat, Jan 21, 2017 at 12:02:03PM +0100, Noralf Trønnes wrote:
> 
> Den 21.01.2017 11:58, skrev Chris Wilson:
> >Some state is coupled into the device lifetime outside of the
> >load/unload timeframe and requires teardown during final unreference
> >from drm_dev_release(). For example, dmabufs hold both a device and
> >module reference and may live longer than expected (i.e. the current
> >pattern of the driver tearing down its state and then releasing a
> >reference to the drm device) and yet touch driver private state when
> >destroyed.
> >
> >v2: Export drm_dev_fini() and move the responsible for finalizing the
> >drm_device and freeing it to the release callback. (If no callback is
> >provided, the core will call drm_dev_fini() and kfree(dev) as before.)
> >v3: Remember to add drm_dev_fini() to drm_drv.h
> >
> >Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> >Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> >Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> >---
> >  drivers/gpu/drm/drm_drv.c | 56 +++++++++++++++++++++++++++++++++--------------
> >  include/drm/drm_drv.h     | 11 ++++++++++
> >  2 files changed, 50 insertions(+), 17 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> >index 1b11ab628da7..517718e4f6e4 100644
> >--- a/drivers/gpu/drm/drm_drv.c
> >+++ b/drivers/gpu/drm/drm_drv.c
> >@@ -553,6 +553,39 @@ int drm_dev_init(struct drm_device *dev,
> >  EXPORT_SYMBOL(drm_dev_init);
> >  /**
> >+ * drm_dev_fini - Finalize a dead DRM device
> >+ * @dev: DRM device
> >+ *
> >+ * Finalize a dead DRM device. This is the converse to drm_dev_init() and
> >+ * frees up all state allocated by it. All driver state should be finalized
> >+ * first. Note that this function does not free the @dev, that is left to the
> >+ * caller. drm_dev_fini() should only
> 
> Looks like the end of the sentence is missing.

Ah, started then moved it to the note about ref-count.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list