~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/coccinelle/api/platform_no_drv_owner.cocci

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /// Remove .owner field if calls are used which set it automatically
  3 ///
  4 // Confidence: High
  5 // Copyright: (C) 2014 Wolfram Sang.
  6 
  7 virtual patch
  8 virtual context
  9 virtual org
 10 virtual report
 11 
 12 @match1@
 13 declarer name module_i2c_driver;
 14 declarer name module_platform_driver;
 15 declarer name module_platform_driver_probe;
 16 identifier __driver;
 17 @@
 18 (
 19         module_i2c_driver(__driver);
 20 |
 21         module_platform_driver(__driver);
 22 |
 23         module_platform_driver_probe(__driver, ...);
 24 )
 25 
 26 @fix1 depends on match1 && patch && !context && !org && !report@
 27 identifier match1.__driver;
 28 @@
 29         static struct platform_driver __driver = {
 30                 .driver = {
 31 -                       .owner = THIS_MODULE,
 32                 }
 33         };
 34 
 35 @fix1_i2c depends on match1 && patch && !context && !org && !report@
 36 identifier match1.__driver;
 37 @@
 38         static struct i2c_driver __driver = {
 39                 .driver = {
 40 -                       .owner = THIS_MODULE,
 41                 }
 42         };
 43 
 44 @match2@
 45 identifier __driver;
 46 @@
 47 (
 48         platform_driver_register(&__driver)
 49 |
 50         platform_driver_probe(&__driver, ...)
 51 |
 52         platform_create_bundle(&__driver, ...)
 53 |
 54         i2c_add_driver(&__driver)
 55 )
 56 
 57 @fix2 depends on match2 && patch && !context && !org && !report@
 58 identifier match2.__driver;
 59 @@
 60         static struct platform_driver __driver = {
 61                 .driver = {
 62 -                       .owner = THIS_MODULE,
 63                 }
 64         };
 65 
 66 @fix2_i2c depends on match2 && patch && !context && !org && !report@
 67 identifier match2.__driver;
 68 @@
 69         static struct i2c_driver __driver = {
 70                 .driver = {
 71 -                       .owner = THIS_MODULE,
 72                 }
 73         };
 74 
 75 // ----------------------------------------------------------------------------
 76 
 77 @fix1_context depends on match1 && !patch && (context || org || report)@
 78 identifier match1.__driver;
 79 position j0;
 80 @@
 81 
 82         static struct platform_driver __driver = {
 83                 .driver = {
 84 *                       .owner@j0 = THIS_MODULE,
 85                 }
 86         };
 87 
 88 @fix1_i2c_context depends on match1 && !patch && (context || org || report)@
 89 identifier match1.__driver;
 90 position j0;
 91 @@
 92 
 93         static struct i2c_driver __driver = {
 94                 .driver = {
 95 *                       .owner@j0 = THIS_MODULE,
 96                 }
 97         };
 98 
 99 @fix2_context depends on match2 && !patch && (context || org || report)@
100 identifier match2.__driver;
101 position j0;
102 @@
103 
104         static struct platform_driver __driver = {
105                 .driver = {
106 *                       .owner@j0 = THIS_MODULE,
107                 }
108         };
109 
110 @fix2_i2c_context depends on match2 && !patch && (context || org || report)@
111 identifier match2.__driver;
112 position j0;
113 @@
114 
115         static struct i2c_driver __driver = {
116                 .driver = {
117 *                       .owner@j0 = THIS_MODULE,
118                 }
119         };
120 
121 // ----------------------------------------------------------------------------
122 
123 @script:python fix1_org depends on org@
124 j0 << fix1_context.j0;
125 @@
126 
127 msg = "No need to set .owner here. The core will do it."
128 coccilib.org.print_todo(j0[0], msg)
129 
130 @script:python fix1_i2c_org depends on org@
131 j0 << fix1_i2c_context.j0;
132 @@
133 
134 msg = "No need to set .owner here. The core will do it."
135 coccilib.org.print_todo(j0[0], msg)
136 
137 @script:python fix2_org depends on org@
138 j0 << fix2_context.j0;
139 @@
140 
141 msg = "No need to set .owner here. The core will do it."
142 coccilib.org.print_todo(j0[0], msg)
143 
144 @script:python fix2_i2c_org depends on org@
145 j0 << fix2_i2c_context.j0;
146 @@
147 
148 msg = "No need to set .owner here. The core will do it."
149 coccilib.org.print_todo(j0[0], msg)
150 
151 // ----------------------------------------------------------------------------
152 
153 @script:python fix1_report depends on report@
154 j0 << fix1_context.j0;
155 @@
156 
157 msg = "No need to set .owner here. The core will do it."
158 coccilib.report.print_report(j0[0], msg)
159 
160 @script:python fix1_i2c_report depends on report@
161 j0 << fix1_i2c_context.j0;
162 @@
163 
164 msg = "No need to set .owner here. The core will do it."
165 coccilib.report.print_report(j0[0], msg)
166 
167 @script:python fix2_report depends on report@
168 j0 << fix2_context.j0;
169 @@
170 
171 msg = "No need to set .owner here. The core will do it."
172 coccilib.report.print_report(j0[0], msg)
173 
174 @script:python fix2_i2c_report depends on report@
175 j0 << fix2_i2c_context.j0;
176 @@
177 
178 msg = "No need to set .owner here. The core will do it."
179 coccilib.report.print_report(j0[0], msg)
180 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php