mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00

For consistency with other reference counting APIs in the kernel, add drm_gem_object_get() and drm_gem_object_put(), as well as an unlocked variant of the latter, to reference count GEM buffer objects. Compatibility aliases are added to keep existing code working. To help speed up the transition, all the instances of the old functions in the DRM core are already replaced in this commit. The existing semantic patch for the DRM subsystem-wide conversion is extended to account for these new helpers. Reviewed-by: Sean Paul <seanpaul@chromium.org> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170228144643.5668-6-thierry.reding@gmail.com
82 lines
1.6 KiB
Text
82 lines
1.6 KiB
Text
///
|
|
/// Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference() and
|
|
/// drm_*_unreference() helpers.
|
|
///
|
|
// Confidence: High
|
|
// Copyright: (C) 2017 NVIDIA Corporation
|
|
// Options: --no-includes --include-headers
|
|
//
|
|
|
|
virtual patch
|
|
virtual report
|
|
|
|
@depends on patch@
|
|
expression object;
|
|
@@
|
|
|
|
(
|
|
- drm_mode_object_reference(object)
|
|
+ drm_mode_object_get(object)
|
|
|
|
|
- drm_mode_object_unreference(object)
|
|
+ drm_mode_object_put(object)
|
|
|
|
|
- drm_connector_reference(object)
|
|
+ drm_connector_get(object)
|
|
|
|
|
- drm_connector_unreference(object)
|
|
+ drm_connector_put(object)
|
|
|
|
|
- drm_framebuffer_reference(object)
|
|
+ drm_framebuffer_get(object)
|
|
|
|
|
- drm_framebuffer_unreference(object)
|
|
+ drm_framebuffer_put(object)
|
|
|
|
|
- drm_gem_object_reference(object)
|
|
+ drm_gem_object_get(object)
|
|
|
|
|
- drm_gem_object_unreference(object)
|
|
+ drm_gem_object_put(object)
|
|
|
|
|
- __drm_gem_object_unreference(object)
|
|
+ __drm_gem_object_put(object)
|
|
|
|
|
- drm_gem_object_unreference_unlocked(object)
|
|
+ drm_gem_object_put_unlocked(object)
|
|
)
|
|
|
|
@r depends on report@
|
|
expression object;
|
|
position p;
|
|
@@
|
|
|
|
(
|
|
drm_mode_object_unreference@p(object)
|
|
|
|
|
drm_mode_object_reference@p(object)
|
|
|
|
|
drm_connector_unreference@p(object)
|
|
|
|
|
drm_connector_reference@p(object)
|
|
|
|
|
drm_framebuffer_unreference@p(object)
|
|
|
|
|
drm_framebuffer_reference@p(object)
|
|
|
|
|
drm_gem_object_unreference@p(object)
|
|
|
|
|
drm_gem_object_reference@p(object)
|
|
|
|
|
__drm_gem_object_unreference(object)
|
|
|
|
|
drm_gem_object_unreference_unlocked(object)
|
|
)
|
|
|
|
@script:python depends on report@
|
|
object << r.object;
|
|
p << r.p;
|
|
@@
|
|
|
|
msg="WARNING: use get/put helpers to reference and dereference %s" % (object)
|
|
coccilib.report.print_report(p[0], msg)
|