1 #include <linux/kernel.h>
2 #include <linux/module.h>
5 #include "notifier-error-inject.h"
8 module_param(priority
, int, 0);
9 MODULE_PARM_DESC(priority
, "specify cpu notifier priority");
11 static struct notifier_err_inject cpu_notifier_err_inject
= {
13 { NOTIFIER_ERR_INJECT_ACTION(CPU_UP_PREPARE
) },
14 { NOTIFIER_ERR_INJECT_ACTION(CPU_UP_PREPARE_FROZEN
) },
15 { NOTIFIER_ERR_INJECT_ACTION(CPU_DOWN_PREPARE
) },
16 { NOTIFIER_ERR_INJECT_ACTION(CPU_DOWN_PREPARE_FROZEN
) },
21 static struct dentry
*dir
;
23 static int err_inject_init(void)
27 dir
= notifier_err_inject_init("cpu", notifier_err_inject_dir
,
28 &cpu_notifier_err_inject
, priority
);
32 err
= register_hotcpu_notifier(&cpu_notifier_err_inject
.nb
);
34 debugfs_remove_recursive(dir
);
39 static void err_inject_exit(void)
41 unregister_hotcpu_notifier(&cpu_notifier_err_inject
.nb
);
42 debugfs_remove_recursive(dir
);
45 module_init(err_inject_init
);
46 module_exit(err_inject_exit
);
48 MODULE_DESCRIPTION("CPU notifier error injection module");
49 MODULE_LICENSE("GPL");
50 MODULE_AUTHOR("Akinobu Mita <akinobu.mita@gmail.com>");