]> Git Repo - linux.git/commit
drm: Fix drm_release() and device unplug
authorNoralf Trønnes <[email protected]>
Fri, 8 Feb 2019 14:01:02 +0000 (15:01 +0100)
committerNoralf Trønnes <[email protected]>
Thu, 21 Feb 2019 11:11:32 +0000 (12:11 +0100)
commit1ee57d4d75fbc74bb2ae601c8f334219165ef276
treec1147055afbfad120a467bd7210108743d0fd9ad
parent1fdafbd023793e754aa6ca73c877a375e83b8239
drm: Fix drm_release() and device unplug

If userspace has open fd(s) when drm_dev_unplug() is run, it will result
in drm_dev_unregister() being called twice. First in drm_dev_unplug() and
then later in drm_release() through the call to drm_put_dev().

Since userspace already holds a ref on drm_device through the drm_minor,
it's not necessary to add extra ref counting based on no open file
handles. Instead just drm_dev_put() unconditionally in drm_dev_unplug().

We now have this:
- Userpace holds a ref on drm_device as long as there's open fd(s)
- The driver holds a ref on drm_device as long as it's bound to the
  struct device

When both sides are done with drm_device, it is released.

Signed-off-by: Noralf Trønnes <[email protected]>
Reviewed-by: Oleksandr Andrushchenko <[email protected]>
Reviewed-by: Daniel Vetter <[email protected]>
Reviewed-by: Sean Paul <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/drm_drv.c
drivers/gpu/drm/drm_file.c
This page took 0.057011 seconds and 4 git commands to generate.