Linux 4.16.11
[linux/fpc-iii.git] / scripts / coccinelle / api / drm-get-put.cocci
blob91fceb8f1fa28a65f5acea5b2a347cf6db4a8225
1 // SPDX-License-Identifier: GPL-2.0
2 ///
3 /// Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference() and
4 /// drm_*_unreference() helpers.
5 ///
6 // Confidence: High
7 // Copyright: (C) 2017 NVIDIA Corporation
8 // Options: --no-includes --include-headers
9 //
11 virtual patch
12 virtual report
14 @depends on patch@
15 expression object;
19 - drm_mode_object_reference(object)
20 + drm_mode_object_get(object)
22 - drm_mode_object_unreference(object)
23 + drm_mode_object_put(object)
25 - drm_connector_reference(object)
26 + drm_connector_get(object)
28 - drm_connector_unreference(object)
29 + drm_connector_put(object)
31 - drm_framebuffer_reference(object)
32 + drm_framebuffer_get(object)
34 - drm_framebuffer_unreference(object)
35 + drm_framebuffer_put(object)
37 - drm_gem_object_reference(object)
38 + drm_gem_object_get(object)
40 - drm_gem_object_unreference(object)
41 + drm_gem_object_put(object)
43 - __drm_gem_object_unreference(object)
44 + __drm_gem_object_put(object)
46 - drm_gem_object_unreference_unlocked(object)
47 + drm_gem_object_put_unlocked(object)
49 - drm_property_reference_blob(object)
50 + drm_property_blob_get(object)
52 - drm_property_unreference_blob(object)
53 + drm_property_blob_put(object)
55 - drm_dev_unref(object)
56 + drm_dev_put(object)
59 @r depends on report@
60 expression object;
61 position p;
65 drm_mode_object_unreference@p(object)
67 drm_mode_object_reference@p(object)
69 drm_connector_unreference@p(object)
71 drm_connector_reference@p(object)
73 drm_framebuffer_unreference@p(object)
75 drm_framebuffer_reference@p(object)
77 drm_gem_object_unreference@p(object)
79 drm_gem_object_reference@p(object)
81 __drm_gem_object_unreference(object)
83 drm_gem_object_unreference_unlocked(object)
85 drm_property_unreference_blob@p(object)
87 drm_property_reference_blob@p(object)
89 drm_dev_unref@p(object)
92 @script:python depends on report@
93 object << r.object;
94 p << r.p;
97 msg="WARNING: use get/put helpers to reference and dereference %s" % (object)
98 coccilib.report.print_report(p[0], msg)