Linux Audio

Check our new training course

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