09c434b8a0047 lib/of-reconfig-notifier-error-inject.c (Thomas Gleixner 2019-05-19 13:08:20 +0100 1) // SPDX-License-Identifier: GPL-2.0-only
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 2) #include <linux/kernel.h>
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 3) #include <linux/module.h>
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 4) #include <linux/of.h>
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 5)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 6) #include "notifier-error-inject.h"
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 7)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 8) static int priority;
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 9) module_param(priority, int, 0);
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 10) MODULE_PARM_DESC(priority, "specify OF reconfig notifier priority");
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 11)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 12) static struct notifier_err_inject reconfig_err_inject = {
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 13) .actions = {
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 14) { NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_ATTACH_NODE) },
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 15) { NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_DETACH_NODE) },
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 16) { NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_ADD_PROPERTY) },
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 17) { NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_REMOVE_PROPERTY) },
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 18) { NOTIFIER_ERR_INJECT_ACTION(OF_RECONFIG_UPDATE_PROPERTY) },
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 19) {}
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 20) }
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 21) };
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 22)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 23) static struct dentry *dir;
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 24)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 25) static int err_inject_init(void)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 26) {
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 27) int err;
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 28)
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 29) dir = notifier_err_inject_init("OF-reconfig",
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 30) notifier_err_inject_dir, &reconfig_err_inject, priority);
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 31) if (IS_ERR(dir))
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 32) return PTR_ERR(dir);
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 33)
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 34) err = of_reconfig_notifier_register(&reconfig_err_inject.nb);
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 35) if (err)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 36) debugfs_remove_recursive(dir);
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 37)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 38) return err;
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 39) }
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 40)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 41) static void err_inject_exit(void)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 42) {
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 43) of_reconfig_notifier_unregister(&reconfig_err_inject.nb);
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 44) debugfs_remove_recursive(dir);
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 45) }
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 46)
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 47) module_init(err_inject_init);
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 48) module_exit(err_inject_exit);
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 49)
d526e85f60fce lib/of-reconfig-notifier-error-inject.c (Benjamin Herrenschmidt 2012-12-14 10:32:52 +1100 50) MODULE_DESCRIPTION("OF reconfig notifier error injection module");
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 51) MODULE_LICENSE("GPL");
08dfb4ddeeeeb lib/pSeries-reconfig-notifier-error-inject.c (Akinobu Mita 2012-07-30 14:43:13 -0700 52) MODULE_AUTHOR("Akinobu Mita <akinobu.mita@gmail.com>");