Back to home page

LXR

 
 

    


0001 #include <linux/kernel.h>
0002 #include <linux/module.h>
0003 #include <linux/of.h>
0004 
0005 #include "notifier-error-inject.h"
0006 
0007 static int priority;
0008 module_param(priority, int, 0);
0009 MODULE_PARM_DESC(priority, "specify OF reconfig notifier priority");
0010 
0011 static struct notifier_err_inject reconfig_err_inject = {
0012     .actions = {
0013         { NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_ATTACH_NODE) },
0014         { NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_DETACH_NODE) },
0015         { NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_ADD_PROPERTY) },
0016         { NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_REMOVE_PROPERTY) },
0017         { NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_UPDATE_PROPERTY) },
0018         {}
0019     }
0020 };
0021 
0022 static struct dentry *dir;
0023 
0024 static int err_inject_init(void)
0025 {
0026     int err;
0027 
0028     dir = notifier_err_inject_init("OF-reconfig",
0029         notifier_err_inject_dir, &reconfig_err_inject, priority);
0030     if (IS_ERR(dir))
0031         return PTR_ERR(dir);
0032 
0033     err = of_reconfig_notifier_register(&reconfig_err_inject.nb);
0034     if (err)
0035         debugfs_remove_recursive(dir);
0036 
0037     return err;
0038 }
0039 
0040 static void err_inject_exit(void)
0041 {
0042     of_reconfig_notifier_unregister(&reconfig_err_inject.nb);
0043     debugfs_remove_recursive(dir);
0044 }
0045 
0046 module_init(err_inject_init);
0047 module_exit(err_inject_exit);
0048 
0049 MODULE_DESCRIPTION("OF reconfig notifier error injection module");
0050 MODULE_LICENSE("GPL");
0051 MODULE_AUTHOR("Akinobu Mita <akinobu.mita@gmail.com>");