Fault inject init can't be a module since core may be a module as well. Call fault inject init function from mmc_init instead.
Signed-off-by: Per Forlin per.forlin@linaro.org --- drivers/mmc/core/core.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index de99ec3..af09384 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -23,8 +23,11 @@ #include <linux/log2.h> #include <linux/regulator/consumer.h> #include <linux/pm_runtime.h> + +#ifdef CONFIG_FAIL_MMC_REQUEST #include <linux/fault-inject.h> #include <linux/random.h> +#endif
#include <linux/mmc/card.h> #include <linux/mmc/host.h> @@ -88,12 +91,20 @@ static void mmc_flush_scheduled_work(void)
static DECLARE_FAULT_ATTR(fail_mmc_request);
+/* + * Internal function. Pass the boot param fail_mmc_request to + * the setup fault injection attributes routine. + */ static int __init setup_fail_mmc_request(char *str) { return setup_fault_attr(&fail_mmc_request, str); } __setup("fail_mmc_request=", setup_fail_mmc_request);
+/* + * Internal function. Inject random data errors. + * If mmc_data is NULL no errors are injected. + */ static void mmc_should_fail_request(struct mmc_host *host, struct mmc_request *mrq) { @@ -122,8 +133,6 @@ static int __init fail_mmc_request_debugfs(void) "fail_mmc_request"); }
-late_initcall(fail_mmc_request_debugfs); - #else /* CONFIG_FAIL_MMC_REQUEST */
static void mmc_should_fail_request(struct mmc_host *host, @@ -131,6 +140,10 @@ static void mmc_should_fail_request(struct mmc_host *host, { }
+static int __init fail_mmc_request_debugfs(void) +{ + return 0; +} #endif /* CONFIG_FAIL_MMC_REQUEST */
@@ -1918,6 +1931,8 @@ static int __init mmc_init(void) if (ret) goto unregister_host_class;
+ fail_mmc_request_debugfs(); + return 0;
unregister_host_class: