drm: add minor-lookup/release helpers
authorDavid Herrmann <dh.herrmann@gmail.com>
Wed, 29 Jan 2014 09:49:19 +0000 (10:49 +0100)
committerSimon Horman <horms+renesas@verge.net.au>
Thu, 11 Dec 2014 01:19:49 +0000 (10:19 +0900)
commit0a3815d64602de784da3a7c9738b3dc78ef9cf93
treedca5ca311e1e5deb176591d3c4d23eec6098a5d8
parentfcd1e713adff6ecf6cc4d0dac10a85c9800e502b
drm: add minor-lookup/release helpers

Instead of accessing drm_minors_idr directly, this adds a small helper to
hide the internals. This will help us later to remove the drm_global_mutex
requirement for minor-lookup.

Furthermore, this also makes sure that minor->dev is always valid and
takes a reference-count to the device as long as the minor is used in an
open-file. This way, "struct file*"->private_data->dev is guaranteed to be
valid (which it has to, as we cannot reset it).

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 1616c525b98deb34b8f4b02eccf0ae3a1310fa27)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
drivers/gpu/drm/drm_fops.c
drivers/gpu/drm/drm_stub.c
include/drm/drmP.h