Line data Source code
1 :
2 : struct device;
3 :
4 : void *ldv_dev_get_drvdata(const struct device *dev);
5 : int ldv_dev_set_drvdata(struct device *dev, void *data);
6 :
7 : struct spi_master;
8 : struct device;
9 : struct spi_master *ldv_spi_alloc_master(struct device *host, unsigned size);
10 :
11 : #include <linux/ldv/err.h>
12 :
13 : #include <linux/types.h>
14 : void *ldv_kzalloc(size_t size, gfp_t flags);
15 :
16 : struct clk;
17 :
18 : extern void ldv_clk_disable(struct clk *clk);
19 : extern int ldv_clk_enable(void);
20 :
21 : #include <linux/ldv/common.h>
22 : #include <linux/ldv/irq.h>
23 : #include <verifier/common.h>
24 : #include <verifier/nondet.h>
25 : #include <verifier/memory.h>
26 : #include <verifier/thread.h>
27 :
28 :
29 :
30 : struct ldv_struct_bus_pattern_scenario_2 {
31 : struct mmc_driver *arg0;
32 : int signal_pending;
33 : };
34 1 :
35 : struct ldv_struct_insmod_3 {
36 : int signal_pending;
37 : };
38 :
39 : /* EMG Function declarations */
40 : void ldv_bus_pattern_scenario_2(void *);
41 : int ldv_bus_pattern_scenario_probe_2_16(int (*)(struct mmc_card *), struct mmc_card *);
42 : void ldv_bus_pattern_scenario_release_2_2(void (*)(struct mmc_card *), struct mmc_card *);
43 : void ldv_bus_pattern_scenario_resume_2_5(int (*)(struct mmc_card *), struct mmc_card *);
44 : int ldv_bus_pattern_scenario_suspend_2_7(int (*)(struct mmc_card *, pm_message_t ), struct mmc_card *, struct pm_message);
45 : void ldv_dispatch_default_deregister_1_3_4(void);
46 : void ldv_dispatch_default_register_1_3_5(void);
47 : void ldv_dispatch_deregister_4_1(struct mmc_driver *);
48 : void ldv_dispatch_insmod_deregister_6_2(void);
49 : void ldv_dispatch_insmod_register_6_3(void);
50 : void ldv_dispatch_register_5_3(struct mmc_driver *);
51 : int ldv_emg_mmc_register_driver(struct mmc_driver *);
52 : void ldv_emg_mmc_unregister_driver(struct mmc_driver *);
53 : void ldv_insmod_3(void *);
54 : void ldv_insmod_mmc_blk_exit_3_2(void (*)(void));
55 : int ldv_insmod_mmc_blk_init_3_9(int (*)(void));
56 : void ldv_main_6(void *);
57 : void ldv_partially_ordered_scenario_1(void *);
58 : void ldv_partially_ordered_scenario_callback_1_4(int (*)(struct block_device *, struct hd_geometry *), struct block_device *, struct hd_geometry *);
59 : int ldv_partially_ordered_scenario_probe_1_12(int (*)(struct block_device *, unsigned int), struct block_device *, unsigned int);
60 : void ldv_partially_ordered_scenario_release_1_2(int (*)(struct gendisk *, unsigned int), struct gendisk *, unsigned int);
61 : int main(void);
62 :
63 : /* EMG variable declarations */
64 1 : struct ldv_thread ldv_thread_1;
65 1 : struct ldv_thread ldv_thread_2;
66 1 : struct ldv_thread ldv_thread_3;
67 1 : struct ldv_thread ldv_thread_6;
68 :
69 : /* EMG variable initialization */
70 :
71 : /* EMG function definitions */
72 : /* AUX_FUNC ldv_bus_pattern_scenario_2 */
73 : void ldv_bus_pattern_scenario_2(void *arg0) {
74 : /* LDV {"thread": 2, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'bus_pattern_scenario(struct_mmc_driver)'", "function": "ldv_bus_pattern_scenario_2"} */
75 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
76 1 : struct mmc_driver *ldv_2_container_struct_mmc_driver;
77 1 : struct mmc_card *ldv_2_resource_struct_mmc_card_ptr;
78 1 : struct pm_message ldv_2_resource_struct_pm_message;
79 1 : int ldv_2_ret_default;
80 1 : /* Received labels */
81 2 : struct ldv_struct_bus_pattern_scenario_2 *data = (struct ldv_struct_bus_pattern_scenario_2*) arg0;
82 1 :
83 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
84 1 : /* Initialize automaton variables */
85 1 : ldv_2_ret_default = 1;
86 : /* LDV {"action": "REGISTER", "type": "RECEIVE_BEGIN", "comment": "Begin STRUCT_MMC_DRIVER callbacks invocations scenario."} */
87 : /* Assign recieved labels */
88 2 : if (data) {
89 1 : ldv_2_container_struct_mmc_driver = data->arg0;
90 2 : ldv_free(data);
91 : }
92 : /* LDV {"action": "REGISTER", "type": "RECEIVE_END"} */
93 :
94 : /* LDV {"action": "INIT", "type": "CONDITION_BEGIN", "comment": "Allocate memory of common callback parameters."} */
95 5 : ldv_2_resource_struct_mmc_card_ptr = ldv_xmalloc_unknown_size(0);
96 : /* LDV {"action": "INIT", "type": "CONDITION_END"} */
97 :
98 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Try to probe driver."} */
99 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
100 :
101 : /* Jump to a subprocess 'main' initial state */
102 1 : goto ldv_main_2;
103 : /* End of the process */
104 : return;
105 1 :
106 : /* Sbprocess main */
107 : ldv_main_2:
108 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
109 :
110 4 : if (ldv_undef_int()) {
111 : /* LDV {"action": "PROBE", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback probe from mmc_driver."} */
112 : /* LDV {"type": "CALLBACK", "call": "ldv_2_ret_default = ((& mmc_blk_probe))(ldv_2_resource_struct_mmc_card_ptr);", "comment": "probe"} */
113 2 : ldv_2_ret_default = ldv_bus_pattern_scenario_probe_2_16(ldv_2_container_struct_mmc_driver->probe, ldv_2_resource_struct_mmc_card_ptr);
114 : /* Callback post-call */
115 2 : ldv_2_ret_default = ldv_filter_err_code(ldv_2_ret_default);
116 : /* LDV {"action": "PROBE", "type": "CALL_END"} */
117 :
118 4 : if (ldv_undef_int()) {
119 : /* LDV {"action": "PROBE_SUCCESS", "type": "CONDITION_BEGIN", "comment": "Probing has been successfull."} */
120 2 : ldv_assume(ldv_2_ret_default == 0);
121 : /* LDV {"action": "PROBE_SUCCESS", "type": "CONDITION_END"} */
122 :
123 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Driver is probed, call the other callbacks."} */
124 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
125 :
126 : /* Jump to a subprocess 'call' initial state */
127 1 : goto ldv_call_2;
128 : }
129 : else {
130 : /* LDV {"action": "PROBE_FAILED", "type": "CONDITION_BEGIN", "comment": "Probing has failed."} */
131 2 : ldv_assume(ldv_2_ret_default != 0);
132 : /* LDV {"action": "PROBE_FAILED", "type": "CONDITION_END"} */
133 :
134 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Try to probe driver."} */
135 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
136 :
137 : /* Jump to a subprocess 'main' initial state */
138 1 : goto ldv_main_2;
139 : }
140 : }
141 : else {
142 : /* LDV {"action": "FREE", "type": "CONDITION_BEGIN", "comment": "Free memory of common callback parameters."} */
143 2 : ldv_free(ldv_2_resource_struct_mmc_card_ptr);
144 : /* LDV {"action": "FREE", "type": "CONDITION_END"} */
145 :
146 : /* LDV {"action": "DEREGISTER", "type": "RECEIVE_BEGIN", "comment": "Finish STRUCT_MMC_DRIVER callbacks invocations scenario."} */
147 : /* Skip a non-replicative signal receiving */
148 : /* LDV {"action": "DEREGISTER", "type": "RECEIVE_END"} */
149 :
150 : /* Exit function at a terminal state */
151 1 : return;
152 : }
153 : /* End of the subprocess 'main' */
154 : return;
155 1 :
156 : /* Sbprocess call */
157 : ldv_call_2:
158 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
159 :
160 2 : switch (ldv_undef_int()) {
161 3 : case 1: {
162 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "comment": "Call callback 'callback' of a process 'bus_pattern_scenario' of an interface category 'struct_mmc_driver'"} */
163 : /* Skip callback without implementations */
164 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
165 :
166 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Driver is probed, call the other callbacks."} */
167 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
168 :
169 : /* Jump to a subprocess 'call' initial state */
170 1 : goto ldv_call_2;
171 1 : break;
172 : }
173 3 : case 2: {
174 : /* LDV {"action": "SUSPEND", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback suspend from STRUCT_MMC_DRIVER."} */
175 3 : if (ldv_2_container_struct_mmc_driver->suspend) {
176 : /* LDV {"type": "CALLBACK", "call": "ldv_2_ret_default = (ldv_2_container_struct_mmc_driver->suspend)(ldv_2_resource_struct_mmc_card_ptr, ldv_2_resource_struct_pm_message);", "comment": "suspend"} */
177 2 : ldv_2_ret_default = ldv_bus_pattern_scenario_suspend_2_7(ldv_2_container_struct_mmc_driver->suspend, ldv_2_resource_struct_mmc_card_ptr, ldv_2_resource_struct_pm_message);
178 : }
179 : /* Callback post-call */
180 4 : ldv_2_ret_default = ldv_filter_err_code(ldv_2_ret_default);
181 : /* LDV {"action": "SUSPEND", "type": "CALL_END"} */
182 :
183 4 : if (ldv_undef_int()) {
184 : /* LDV {"action": "SUSPEND_SUCCESS", "type": "CONDITION_BEGIN", "comment": "Suspending has been successfull."} */
185 2 : ldv_assume(ldv_2_ret_default == 0);
186 : /* LDV {"action": "SUSPEND_SUCCESS", "type": "CONDITION_END"} */
187 :
188 : /* LDV {"action": "RESUME", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback resume from STRUCT_MMC_DRIVER."} */
189 3 : if (ldv_2_container_struct_mmc_driver->resume) {
190 : /* LDV {"type": "CALLBACK", "call": "(ldv_2_container_struct_mmc_driver->resume)(ldv_2_resource_struct_mmc_card_ptr);", "comment": "resume"} */
191 2 : ldv_bus_pattern_scenario_resume_2_5(ldv_2_container_struct_mmc_driver->resume, ldv_2_resource_struct_mmc_card_ptr);
192 : }
193 : /* LDV {"action": "RESUME", "type": "CALL_END"} */
194 :
195 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Driver is probed, call the other callbacks."} */
196 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
197 :
198 : /* Jump to a subprocess 'call' initial state */
199 2 : goto ldv_call_2;
200 : }
201 : else {
202 : /* LDV {"action": "SUSPEND_FAILED", "type": "CONDITION_BEGIN", "comment": "Suspending has failed."} */
203 2 : ldv_assume(ldv_2_ret_default != 0);
204 : /* LDV {"action": "SUSPEND_FAILED", "type": "CONDITION_END"} */
205 :
206 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Driver is probed, call the other callbacks."} */
207 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
208 :
209 : /* Jump to a subprocess 'call' initial state */
210 1 : goto ldv_call_2;
211 : /* Jump to a subprocess 'call' initial state */
212 : goto ldv_call_2;
213 : }
214 1 : break;
215 : }
216 3 : case 3: {
217 : /* LDV {"action": "RELEASE", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback remove from mmc_driver."} */
218 : /* LDV {"type": "CALLBACK", "call": "((& mmc_blk_remove))(ldv_2_resource_struct_mmc_card_ptr);", "comment": "release"} */
219 2 : ldv_bus_pattern_scenario_release_2_2(ldv_2_container_struct_mmc_driver->remove, ldv_2_resource_struct_mmc_card_ptr);
220 : /* LDV {"action": "RELEASE", "type": "CALL_END"} */
221 :
222 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Try to probe driver."} */
223 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
224 :
225 : /* Jump to a subprocess 'main' initial state */
226 1 : goto ldv_main_2;
227 1 : break;
228 : }
229 2 : default: ldv_stop();
230 1 : }
231 0 : /* End of the subprocess 'call' */
232 0 : return;
233 : /* LDV {"comment": "End of control function based on process 'bus_pattern_scenario(struct_mmc_driver)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_bus_pattern_scenario_2"} */
234 : }
235 :
236 : /* AUX_FUNC_CALLBACK ldv_bus_pattern_scenario_probe_2_16 */
237 : int ldv_bus_pattern_scenario_probe_2_16(int (*arg0)(struct mmc_card *), struct mmc_card *arg1) {
238 6 : return ((& mmc_blk_probe))(arg1);
239 1 : }
240 :
241 : /* AUX_FUNC_CALLBACK ldv_bus_pattern_scenario_release_2_2 */
242 : void ldv_bus_pattern_scenario_release_2_2(void (*arg0)(struct mmc_card *), struct mmc_card *arg1) {
243 3 : ((& mmc_blk_remove))(arg1);
244 1 : }
245 :
246 : /* AUX_FUNC_CALLBACK ldv_bus_pattern_scenario_resume_2_5 */
247 : void ldv_bus_pattern_scenario_resume_2_5(int (*arg0)(struct mmc_card *), struct mmc_card *arg1) {
248 3 : (*arg0)(arg1);
249 1 : }
250 :
251 : /* AUX_FUNC_CALLBACK ldv_bus_pattern_scenario_suspend_2_7 */
252 : int ldv_bus_pattern_scenario_suspend_2_7(int (*arg0)(struct mmc_card *, pm_message_t ), struct mmc_card *arg1, struct pm_message arg2) {
253 2 : return (*arg0)(arg1, arg2);
254 : }
255 1 :
256 : /* AUX_FUNC ldv_dispatch_default_deregister_1_3_4 */
257 : void ldv_dispatch_default_deregister_1_3_4() {
258 : struct ldv_struct_insmod_3 *cf_arg_1;
259 : /* Skip thread join call */
260 1 : return;
261 : }
262 :
263 : /* AUX_FUNC ldv_dispatch_default_register_1_3_5 */
264 : void ldv_dispatch_default_register_1_3_5() {
265 : struct ldv_struct_insmod_3 *cf_arg_1;
266 4 : cf_arg_1 = ldv_xmalloc(sizeof(struct ldv_struct_insmod_3));
267 3 : ldv_partially_ordered_scenario_1(cf_arg_1);
268 1 : return;
269 : }
270 :
271 : /* AUX_FUNC ldv_dispatch_deregister_4_1 */
272 : void ldv_dispatch_deregister_4_1(struct mmc_driver *arg0) {
273 : struct ldv_struct_bus_pattern_scenario_2 *cf_arg_2;
274 : /* Skip thread join call */
275 2 : return;
276 : }
277 :
278 : /* AUX_FUNC ldv_dispatch_insmod_deregister_6_2 */
279 : void ldv_dispatch_insmod_deregister_6_2() {
280 : struct ldv_struct_insmod_3 *cf_arg_3;
281 : /* Skip thread join call */
282 1 : return;
283 : }
284 :
285 : /* AUX_FUNC ldv_dispatch_insmod_register_6_3 */
286 : void ldv_dispatch_insmod_register_6_3() {
287 : struct ldv_struct_insmod_3 *cf_arg_3;
288 4 : cf_arg_3 = ldv_xmalloc(sizeof(struct ldv_struct_insmod_3));
289 4 : ldv_insmod_3(cf_arg_3);
290 1 : return;
291 : }
292 :
293 : /* AUX_FUNC ldv_dispatch_register_5_3 */
294 : void ldv_dispatch_register_5_3(struct mmc_driver *arg0) {
295 : struct ldv_struct_bus_pattern_scenario_2 *cf_arg_2;
296 4 : cf_arg_2 = ldv_xmalloc(sizeof(struct ldv_struct_bus_pattern_scenario_2));
297 2 : cf_arg_2->arg0 = arg0;
298 2 : ldv_bus_pattern_scenario_2(cf_arg_2);
299 1 : return;
300 : }
301 :
302 : /* AUX_FUNC ldv_emg_mmc_register_driver */
303 : int ldv_emg_mmc_register_driver(struct mmc_driver *arg0) {
304 : /* LDV {"comment": "Control function 'mmc_register_driver'", "type": "CONTROL_FUNCTION_BEGIN", "function": "ldv_emg_mmc_register_driver"} */
305 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
306 1 : struct mmc_driver *ldv_5_struct_mmc_driver_struct_mmc_driver;
307 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
308 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
309 :
310 4 : if (ldv_undef_int()) {
311 : /* LDV {"action": "ASSIGN", "type": "CONDITION_BEGIN", "comment": "Get 'struct_mmc_driver' callbacks to register."} */
312 1 : ldv_5_struct_mmc_driver_struct_mmc_driver = arg0;
313 : /* LDV {"action": "ASSIGN", "type": "CONDITION_END"} */
314 :
315 : /* LDV {"action": "REGISTER", "type": "DISPATCH_BEGIN", "comment": "Register STRUCT_MMC_DRIVER callbacks."} */
316 2 : ldv_dispatch_register_5_3(ldv_5_struct_mmc_driver_struct_mmc_driver);
317 : /* LDV {"action": "REGISTER", "type": "DISPATCH_END"} */
318 :
319 : /* LDV {"action": "FAIL", "type": "CONDITION_BEGIN", "comment": "Fail registration of 'struct_mmc_driver' callbacks."} */
320 3 : return ldv_undef_int_negative();
321 : /* LDV {"action": "FAIL", "type": "CONDITION_END"} */
322 :
323 : /* Exit function at a terminal state */
324 : }
325 : else {
326 : /* LDV {"action": "SUCCESS", "type": "CONDITION_BEGIN", "comment": "Registration of 'struct_mmc_driver' callbacks has been successful."} */
327 1 : return 0;
328 : /* LDV {"action": "SUCCESS", "type": "CONDITION_END"} */
329 :
330 : /* Exit function at a terminal state */
331 : }
332 : /* End of the process */
333 : /* LDV {"comment": "End of control function based on process 'mmc_register_driver'", "type": "CONTROL_FUNCTION_END", "function": "ldv_emg_mmc_register_driver"} */
334 : }
335 :
336 : /* AUX_FUNC ldv_emg_mmc_unregister_driver */
337 : void ldv_emg_mmc_unregister_driver(struct mmc_driver *arg0) {
338 : /* LDV {"comment": "Control function 'mmc_unregister_driver'", "type": "CONTROL_FUNCTION_BEGIN", "function": "ldv_emg_mmc_unregister_driver"} */
339 2 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
340 : struct mmc_driver *ldv_4_struct_mmc_driver_struct_mmc_driver;
341 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
342 : /* LDV {"action": "ASSIGN", "type": "CONDITION_BEGIN", "comment": "Get 'struct_mmc_driver' callbacks to deregister."} */
343 2 : ldv_4_struct_mmc_driver_struct_mmc_driver = arg0;
344 : /* LDV {"action": "ASSIGN", "type": "CONDITION_END"} */
345 :
346 : /* LDV {"action": "DEREGISTER", "type": "DISPATCH_BEGIN", "comment": "Deregister STRUCT_MMC_DRIVER callbacks."} */
347 4 : ldv_dispatch_deregister_4_1(ldv_4_struct_mmc_driver_struct_mmc_driver);
348 : /* LDV {"action": "DEREGISTER", "type": "DISPATCH_END"} */
349 :
350 : /* Exit function at a terminal state */
351 2 : return;
352 : /* End of the process */
353 : return;
354 : /* LDV {"comment": "End of control function based on process 'mmc_unregister_driver'", "type": "CONTROL_FUNCTION_END", "function": "ldv_emg_mmc_unregister_driver"} */
355 : }
356 :
357 : /* AUX_FUNC ldv_insmod_3 */
358 : void ldv_insmod_3(void *arg0) {
359 : /* LDV {"thread": 3, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'insmod(artificial)'", "function": "ldv_insmod_3"} */
360 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
361 1 : void (*ldv_3_mmc_blk_exit_default)(void);
362 1 : int (*ldv_3_mmc_blk_init_default)(void);
363 1 : int ldv_3_ret_default;
364 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
365 : /* LDV {"action": "INSMOD_REGISTER", "type": "RECEIVE_BEGIN", "comment": "Trigger module initialization."} */
366 2 : ldv_free(arg0);
367 : /* LDV {"action": "INSMOD_REGISTER", "type": "RECEIVE_END"} */
368 :
369 : /* LDV {"action": "MMC_BLK_INIT", "type": "CALL_BEGIN", "callback": true, "comment": "Initialize the module after insmod with 'mmc_blk_init' function. Invoke callback mmc_blk_init from ARTIFICIAL."} */
370 : /* LDV {"type": "CALLBACK", "call": "ldv_3_ret_default = (mmc_blk_init)();", "comment": "mmc_blk_init"} */
371 2 : ldv_3_ret_default = ldv_insmod_mmc_blk_init_3_9(ldv_3_mmc_blk_init_default);
372 : /* Callback post-call */
373 2 : ldv_3_ret_default = ldv_post_init(ldv_3_ret_default);
374 : /* LDV {"action": "MMC_BLK_INIT", "type": "CALL_END"} */
375 :
376 4 : if (ldv_undef_int()) {
377 : /* LDV {"action": "INIT_FAILED", "type": "CONDITION_BEGIN", "comment": "Failed to initialize the module."} */
378 2 : ldv_assume(ldv_3_ret_default != 0);
379 : /* LDV {"action": "INIT_FAILED", "type": "CONDITION_END"} */
380 :
381 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_BEGIN", "comment": "Trigger module exit."} */
382 : /* Skip a non-replicative signal receiving */
383 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_END"} */
384 :
385 : /* Exit function at a terminal state */
386 1 : return;
387 : }
388 : else {
389 : /* LDV {"action": "INIT_SUCCESS", "type": "CONDITION_BEGIN", "comment": "Module has been initialized."} */
390 2 : ldv_assume(ldv_3_ret_default == 0);
391 : /* LDV {"action": "INIT_SUCCESS", "type": "CONDITION_END"} */
392 :
393 4 : if (ldv_undef_int()) {
394 : /* LDV {"action": "DEFAULT_REGISTER_1", "type": "DISPATCH_BEGIN", "comment": "Register 'STRUCT_BLOCK_DEVICE_OPERATIONS' callbacks with unknown registration function."} */
395 2 : ldv_dispatch_default_register_1_3_5();
396 : /* LDV {"action": "DEFAULT_REGISTER_1", "type": "DISPATCH_END"} */
397 :
398 : /* LDV {"action": "DEFAULT_DEREGISTER_1", "type": "DISPATCH_BEGIN", "comment": "Deregister 'STRUCT_BLOCK_DEVICE_OPERATIONS' callbacks with unknown deregistration function."} */
399 2 : ldv_dispatch_default_deregister_1_3_4();
400 : /* LDV {"action": "DEFAULT_DEREGISTER_1", "type": "DISPATCH_END"} */
401 :
402 : }
403 : else {
404 : /* LDV {"action": "NONE", "type": "CONDITION_BEGIN", "comment": "Skip default callbacks registrations and deregistrations."} */
405 : /* LDV {"action": "NONE", "type": "CONDITION_END"} */
406 :
407 : }
408 : /* LDV {"action": "MMC_BLK_EXIT", "type": "CALL_BEGIN", "callback": true, "comment": "Exit the module before its unloading with 'mmc_blk_exit' function. Invoke callback mmc_blk_exit from ARTIFICIAL."} */
409 : /* LDV {"type": "CALLBACK", "call": "(mmc_blk_exit)();", "comment": "mmc_blk_exit"} */
410 4 : ldv_insmod_mmc_blk_exit_3_2(ldv_3_mmc_blk_exit_default);
411 : /* LDV {"action": "MMC_BLK_EXIT", "type": "CALL_END"} */
412 :
413 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_BEGIN", "comment": "Trigger module exit."} */
414 : /* Skip a non-replicative signal receiving */
415 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_END"} */
416 :
417 : /* Exit function at a terminal state */
418 1 : return;
419 : }
420 : /* End of the process */
421 : return;
422 : /* LDV {"comment": "End of control function based on process 'insmod(artificial)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_insmod_3"} */
423 : }
424 :
425 : /* AUX_FUNC_CALLBACK ldv_insmod_mmc_blk_exit_3_2 */
426 : void ldv_insmod_mmc_blk_exit_3_2(void (*arg0)(void)) {
427 4 : (mmc_blk_exit)();
428 2 : }
429 :
430 : /* AUX_FUNC_CALLBACK ldv_insmod_mmc_blk_init_3_9 */
431 : int ldv_insmod_mmc_blk_init_3_9(int (*arg0)(void)) {
432 4 : return (mmc_blk_init)();
433 1 : }
434 :
435 : /* AUX_FUNC ldv_main_6 */
436 : void ldv_main_6(void *arg0) {
437 : /* LDV {"thread": 6, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'main(main)'", "function": "ldv_main_6"} */
438 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
439 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
440 : /* LDV {"action": "INIT", "type": "CONDITION_BEGIN", "comment": "Initialize rule models."} */
441 1 : ldv_initialize();
442 : /* LDV {"action": "INIT", "type": "CONDITION_END"} */
443 :
444 : /* LDV {"action": "INSMOD_REGISTER", "type": "DISPATCH_BEGIN", "comment": "Start environment model scenarios."} */
445 2 : ldv_dispatch_insmod_register_6_3();
446 : /* LDV {"action": "INSMOD_REGISTER", "type": "DISPATCH_END"} */
447 :
448 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "DISPATCH_BEGIN", "comment": "Stop environment model scenarios."} */
449 2 : ldv_dispatch_insmod_deregister_6_2();
450 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "DISPATCH_END"} */
451 :
452 : /* LDV {"action": "FINAL", "type": "CONDITION_BEGIN", "comment": "Check rule model state at the exit."} */
453 1 : ldv_check_final_state();
454 1 : ldv_stop();
455 : /* LDV {"action": "FINAL", "type": "CONDITION_END"} */
456 :
457 : /* Exit function at a terminal state */
458 0 : return;
459 : /* End of the process */
460 : return;
461 : /* LDV {"comment": "End of control function based on process 'main(main)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_main_6"} */
462 : }
463 :
464 : /* AUX_FUNC ldv_partially_ordered_scenario_1 */
465 : void ldv_partially_ordered_scenario_1(void *arg0) {
466 : /* LDV {"thread": 1, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'partially_ordered_scenario(struct_block_device_operations)'", "function": "ldv_partially_ordered_scenario_1"} */
467 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
468 1 : int (*ldv_1_callback_getgeo)(struct block_device *, struct hd_geometry *);
469 1 : struct block_device_operations *ldv_1_container_struct_block_device_operations;
470 1 : unsigned int ldv_1_ldv_param_12_1_default;
471 1 : unsigned int ldv_1_ldv_param_2_1_default;
472 1 : struct block_device *ldv_1_resource_struct_block_device_ptr;
473 1 : struct gendisk *ldv_1_resource_struct_gendisk_ptr;
474 1 : struct hd_geometry *ldv_1_resource_struct_hd_geometry_ptr;
475 1 : int ldv_1_ret_default;
476 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
477 1 : /* Initialize automaton variables */
478 2 : ldv_1_ret_default = 1;
479 1 : /* LDV {"action": "DEFAULT_REGISTER_1", "type": "RECEIVE_BEGIN", "comment": "Begin STRUCT_BLOCK_DEVICE_OPERATIONS callbacks invocations scenario."} */
480 3 : ldv_free(arg0);
481 1 : /* LDV {"action": "DEFAULT_REGISTER_1", "type": "RECEIVE_END"} */
482 :
483 : /* LDV {"action": "DEFAULT_ALLOC_1", "type": "CONDITION_BEGIN", "comment": "Allocate memory after default registration."} */
484 3 : ldv_1_container_struct_block_device_operations = ldv_xmalloc_unknown_size(0);
485 : /* LDV {"action": "DEFAULT_ALLOC_1", "type": "CONDITION_END"} */
486 :
487 : /* LDV {"action": "INIT", "type": "CONDITION_BEGIN", "comment": "Alloc memory for common callback arguments."} */
488 3 : ldv_1_resource_struct_block_device_ptr = ldv_xmalloc_unknown_size(0);
489 3 : ldv_1_resource_struct_gendisk_ptr = ldv_xmalloc_unknown_size(0);
490 3 : ldv_1_resource_struct_hd_geometry_ptr = ldv_xmalloc_unknown_size(0);
491 : /* LDV {"action": "INIT", "type": "CONDITION_END"} */
492 :
493 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Start with an initialization callback."} */
494 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
495 :
496 : /* Jump to a subprocess 'main' initial state */
497 1 : goto ldv_main_1;
498 : /* End of the process */
499 : return;
500 1 :
501 : /* Sbprocess main */
502 : ldv_main_1:
503 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
504 :
505 4 : if (ldv_undef_int()) {
506 : /* LDV {"action": "PRE_CALL_12", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
507 : /* LDV {"action": "PRE_CALL_12", "type": "CONDITION_END"} */
508 :
509 : /* LDV {"action": "PROBE", "type": "CALL_BEGIN", "callback": true, "comment": "Call an initialization callback. Invoke callback open from block_device_operations."} */
510 : /* LDV {"type": "CALLBACK", "call": "ldv_1_ret_default = ((& mmc_blk_open))(ldv_1_resource_struct_block_device_ptr, ldv_1_ldv_param_12_1_default);", "comment": "probe"} */
511 2 : ldv_1_ret_default = ldv_partially_ordered_scenario_probe_1_12(ldv_1_container_struct_block_device_operations->open, ldv_1_resource_struct_block_device_ptr, ldv_1_ldv_param_12_1_default);
512 : /* Callback post-call */
513 2 : ldv_1_ret_default = ldv_filter_err_code(ldv_1_ret_default);
514 : /* LDV {"action": "PROBE", "type": "CALL_END"} */
515 :
516 : /* LDV {"action": "POST_CALL_12", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
517 : /* LDV {"action": "POST_CALL_12", "type": "CONDITION_END"} */
518 :
519 4 : if (ldv_undef_int()) {
520 : /* LDV {"action": "Y_RET", "type": "CONDITION_BEGIN", "comment": "Initialization has been successful."} */
521 2 : ldv_assume(ldv_1_ret_default == 0);
522 : /* LDV {"action": "Y_RET", "type": "CONDITION_END"} */
523 :
524 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Initializations are done, proceed to the other callbacks."} */
525 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
526 :
527 : /* Jump to a subprocess 'call' initial state */
528 1 : goto ldv_call_1;
529 : }
530 : else {
531 : /* LDV {"action": "N_RET", "type": "CONDITION_BEGIN", "comment": "Initialization has failed."} */
532 2 : ldv_assume(ldv_1_ret_default != 0);
533 : /* LDV {"action": "N_RET", "type": "CONDITION_END"} */
534 :
535 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Start with an initialization callback."} */
536 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
537 :
538 : /* Jump to a subprocess 'main' initial state */
539 1 : goto ldv_main_1;
540 : }
541 : }
542 : else {
543 : /* LDV {"action": "FREE", "type": "CONDITION_BEGIN", "comment": "Free memory for common callback arguments."} */
544 2 : ldv_free(ldv_1_resource_struct_block_device_ptr);
545 2 : ldv_free(ldv_1_resource_struct_gendisk_ptr);
546 2 : ldv_free(ldv_1_resource_struct_hd_geometry_ptr);
547 : /* LDV {"action": "FREE", "type": "CONDITION_END"} */
548 :
549 : /* LDV {"action": "DEFAULT_FREE_1", "type": "CONDITION_BEGIN", "comment": "Free memory before default deregistration."} */
550 2 : ldv_free(ldv_1_container_struct_block_device_operations);
551 : /* LDV {"action": "DEFAULT_FREE_1", "type": "CONDITION_END"} */
552 :
553 : /* LDV {"action": "DEFAULT_DEREGISTER_1", "type": "RECEIVE_BEGIN", "comment": "Finish STRUCT_BLOCK_DEVICE_OPERATIONS callbacks invocations scenario."} */
554 : /* Skip a non-replicative signal receiving */
555 : /* LDV {"action": "DEFAULT_DEREGISTER_1", "type": "RECEIVE_END"} */
556 :
557 : /* Exit function at a terminal state */
558 1 : return;
559 : }
560 : /* End of the subprocess 'main' */
561 : return;
562 1 :
563 : /* Sbprocess call */
564 : ldv_call_1:
565 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
566 :
567 4 : if (ldv_undef_int()) {
568 : /* LDV {"action": "PRE_CALL_2", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
569 : /* LDV {"action": "PRE_CALL_2", "type": "CONDITION_END"} */
570 :
571 : /* LDV {"action": "RELEASE", "type": "CALL_BEGIN", "callback": true, "comment": "Do uninitializations before deregistration. Invoke callback release from block_device_operations."} */
572 : /* LDV {"type": "CALLBACK", "call": "((& mmc_blk_release))(ldv_1_resource_struct_gendisk_ptr, ldv_1_ldv_param_2_1_default);", "comment": "release"} */
573 2 : ldv_partially_ordered_scenario_release_1_2(ldv_1_container_struct_block_device_operations->release, ldv_1_resource_struct_gendisk_ptr, ldv_1_ldv_param_2_1_default);
574 : /* LDV {"action": "RELEASE", "type": "CALL_END"} */
575 :
576 : /* LDV {"action": "POST_CALL_2", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
577 : /* LDV {"action": "POST_CALL_2", "type": "CONDITION_END"} */
578 :
579 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Start with an initialization callback."} */
580 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
581 :
582 : /* Jump to a subprocess 'main' initial state */
583 1 : goto ldv_main_1;
584 : }
585 : else {
586 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Call any random callback. Invoke callback getgeo from block_device_operations."} */
587 : /* LDV {"type": "CALLBACK", "call": "((& mmc_blk_getgeo))(ldv_1_resource_struct_block_device_ptr, ldv_1_resource_struct_hd_geometry_ptr);", "comment": "callback"} */
588 2 : ldv_partially_ordered_scenario_callback_1_4(ldv_1_callback_getgeo, ldv_1_resource_struct_block_device_ptr, ldv_1_resource_struct_hd_geometry_ptr);
589 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
590 :
591 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Initializations are done, proceed to the other callbacks."} */
592 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
593 :
594 : /* Jump to a subprocess 'call' initial state */
595 1 : goto ldv_call_1;
596 : }
597 : /* End of the subprocess 'call' */
598 : return;
599 : /* LDV {"comment": "End of control function based on process 'partially_ordered_scenario(struct_block_device_operations)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_partially_ordered_scenario_1"} */
600 : }
601 :
602 : /* AUX_FUNC_CALLBACK ldv_partially_ordered_scenario_callback_1_4 */
603 : void ldv_partially_ordered_scenario_callback_1_4(int (*arg0)(struct block_device *, struct hd_geometry *), struct block_device *arg1, struct hd_geometry *arg2) {
604 2 : ((& mmc_blk_getgeo))(arg1, arg2);
605 1 : }
606 :
607 : /* AUX_FUNC_CALLBACK ldv_partially_ordered_scenario_probe_1_12 */
608 : int ldv_partially_ordered_scenario_probe_1_12(int (*arg0)(struct block_device *, unsigned int), struct block_device *arg1, unsigned int arg2) {
609 4 : return ((& mmc_blk_open))(arg1, arg2);
610 : }
611 :
612 1 : /* AUX_FUNC_CALLBACK ldv_partially_ordered_scenario_release_1_2 */
613 : void ldv_partially_ordered_scenario_release_1_2(int (*arg0)(struct gendisk *, unsigned int), struct gendisk *arg1, unsigned int arg2) {
614 2 : ((& mmc_blk_release))(arg1, arg2);
615 1 : }
616 :
617 : /* AUX_FUNC main */
618 : int main() {
619 1 : ldv_main_6(0);
620 0 : return 0;
621 : }
622 :
623 :
624 : /* AUX_FUNC ERR_PTR */
625 : static inline void *ERR_PTR (long int error)
626 : {
627 4 :
628 12 : return ldv_err_ptr(error);
629 : }
630 :
631 : /* AUX_FUNC PTR_ERR */
632 : static inline long int PTR_ERR (void const *ptr)
633 : {
634 2 :
635 6 : return ldv_ptr_err(ptr);
636 : }
637 :
638 : /* AUX_FUNC IS_ERR */
639 : static inline long int IS_ERR (void const *ptr)
640 : {
641 3 :
642 9 : return ldv_is_err(ptr);
643 : }
644 :
645 : /* AUX_FUNC IS_ERR_OR_NULL */
646 : static inline long int IS_ERR_OR_NULL (void const *ptr)
647 : {
648 :
649 : return ldv_is_err_or_null(ptr);
650 : }
651 :
652 : /* AUX_FUNC kzalloc */
653 : static inline void *kzalloc (size_t size, gfp_t flags)
654 : {
655 1 :
656 3 : return ldv_kzalloc(size, flags);
657 : }
658 :
659 : /* AUX_FUNC ldv_dev_get_drvdata_6 */
660 : void *ldv_dev_get_drvdata_6 (struct device const *dev)
661 : {
662 1 :
663 3 : return ldv_dev_get_drvdata(dev);
664 : }
665 :
666 : /* AUX_FUNC ldv_mmc_register_driver_7 */
667 : int ldv_mmc_register_driver_7 (struct mmc_driver *ldv_func_arg1)
668 : {
669 1 :
670 : /* LDV {"type": "KERNEL_MODEL", "comment": "Perform the model code of the function 'mmc_register_driver'"} */
671 4 : return ldv_emg_mmc_register_driver(ldv_func_arg1);
672 : }
673 :
674 : /* AUX_FUNC ldv_mmc_unregister_driver_8 */
675 : void ldv_mmc_unregister_driver_8 (struct mmc_driver *ldv_func_arg1)
676 : {
677 :
678 : /* LDV {"type": "KERNEL_MODEL", "comment": "Perform the model code of the function 'mmc_unregister_driver'"} */
679 4 : ldv_emg_mmc_unregister_driver(ldv_func_arg1);
680 2 : }
|