2012-07-31 04:43:13 +07:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
2012-12-14 06:32:52 +07:00
|
|
|
#include <linux/of.h>
|
2012-07-31 04:43:13 +07:00
|
|
|
|
|
|
|
#include "notifier-error-inject.h"
|
|
|
|
|
|
|
|
static int priority;
|
|
|
|
module_param(priority, int, 0);
|
2012-12-14 06:32:52 +07:00
|
|
|
MODULE_PARM_DESC(priority, "specify OF reconfig notifier priority");
|
2012-07-31 04:43:13 +07:00
|
|
|
|
|
|
|
static struct notifier_err_inject reconfig_err_inject = {
|
|
|
|
.actions = {
|
2012-12-14 06:32:52 +07:00
|
|
|
{ NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_ATTACH_NODE) },
|
|
|
|
{ NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_DETACH_NODE) },
|
|
|
|
{ NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_ADD_PROPERTY) },
|
|
|
|
{ NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_REMOVE_PROPERTY) },
|
|
|
|
{ NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_UPDATE_PROPERTY) },
|
2012-07-31 04:43:13 +07:00
|
|
|
{}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct dentry *dir;
|
|
|
|
|
|
|
|
static int err_inject_init(void)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
2012-12-14 06:32:52 +07:00
|
|
|
dir = notifier_err_inject_init("OF-reconfig",
|
2012-07-31 04:43:13 +07:00
|
|
|
notifier_err_inject_dir, &reconfig_err_inject, priority);
|
|
|
|
if (IS_ERR(dir))
|
|
|
|
return PTR_ERR(dir);
|
|
|
|
|
2012-12-14 06:32:52 +07:00
|
|
|
err = of_reconfig_notifier_register(&reconfig_err_inject.nb);
|
2012-07-31 04:43:13 +07:00
|
|
|
if (err)
|
|
|
|
debugfs_remove_recursive(dir);
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void err_inject_exit(void)
|
|
|
|
{
|
2012-12-14 06:32:52 +07:00
|
|
|
of_reconfig_notifier_unregister(&reconfig_err_inject.nb);
|
2012-07-31 04:43:13 +07:00
|
|
|
debugfs_remove_recursive(dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(err_inject_init);
|
|
|
|
module_exit(err_inject_exit);
|
|
|
|
|
2012-12-14 06:32:52 +07:00
|
|
|
MODULE_DESCRIPTION("OF reconfig notifier error injection module");
|
2012-07-31 04:43:13 +07:00
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_AUTHOR("Akinobu Mita <akinobu.mita@gmail.com>");
|