1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org> 4 * 5 * Dummy test module. 6 * 7 * The module accepts a single argument named "status" and it fails 8 * initialization if the status is set to "invalid". 9 */ 10 11 #include <linux/module.h> 12 #include <linux/init.h> 13 #include <linux/proc_fs.h> 14 #include <linux/kernel.h> 15 16 static char status[20]; 17 module_param_string(status, status, 20, 0444); 18 dummy_init(void)19static int dummy_init(void) 20 { 21 struct proc_dir_entry *proc_dummy; 22 23 if (!strcmp(status, "invalid")) 24 return -EINVAL; 25 26 proc_dummy = proc_mkdir("dummy", 0); 27 return 0; 28 } 29 module_init(dummy_init); 30 dummy_exit(void)31static void dummy_exit(void) 32 { 33 remove_proc_entry("dummy", 0); 34 } 35 module_exit(dummy_exit); 36 37 MODULE_LICENSE("GPL"); 38