Commit 34f50508 authored by Per Forlin's avatar Per Forlin Committed by Chris Ball

mmc: add module param to set fault injection attributes

Replace setup("fail_mmc_request") and faulty "ifdef KERNEL" with
a simple module_param(). The module param mmc_core.fail_request
may be used to set the fault injection attributes during boot time
or module load time.
Signed-off-by: default avatarPer Forlin <per.forlin@linaro.org>
Reviewed-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 6cba00ea
...@@ -20,6 +20,14 @@ ...@@ -20,6 +20,14 @@
#include "core.h" #include "core.h"
#include "mmc_ops.h" #include "mmc_ops.h"
#ifdef CONFIG_FAIL_MMC_REQUEST
static DECLARE_FAULT_ATTR(fail_default_attr);
static char *fail_request;
module_param(fail_request, charp, 0);
#endif /* CONFIG_FAIL_MMC_REQUEST */
/* The debugfs functions are optimized away when CONFIG_DEBUG_FS isn't set. */ /* The debugfs functions are optimized away when CONFIG_DEBUG_FS isn't set. */
static int mmc_ios_show(struct seq_file *s, void *data) static int mmc_ios_show(struct seq_file *s, void *data)
{ {
...@@ -168,23 +176,6 @@ static int mmc_clock_opt_set(void *data, u64 val) ...@@ -168,23 +176,6 @@ static int mmc_clock_opt_set(void *data, u64 val)
return 0; return 0;
} }
#ifdef CONFIG_FAIL_MMC_REQUEST
static DECLARE_FAULT_ATTR(fail_mmc_request);
#ifdef KERNEL
/*
* 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);
#endif /* KERNEL */
#endif /* CONFIG_FAIL_MMC_REQUEST */
DEFINE_SIMPLE_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set, DEFINE_SIMPLE_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set,
"%llu\n"); "%llu\n");
...@@ -216,7 +207,9 @@ void mmc_add_host_debugfs(struct mmc_host *host) ...@@ -216,7 +207,9 @@ void mmc_add_host_debugfs(struct mmc_host *host)
goto err_node; goto err_node;
#endif #endif
#ifdef CONFIG_FAIL_MMC_REQUEST #ifdef CONFIG_FAIL_MMC_REQUEST
host->fail_mmc_request = fail_mmc_request; if (fail_request)
setup_fault_attr(&fail_default_attr, fail_request);
host->fail_mmc_request = fail_default_attr;
if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request", if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request",
root, root,
&host->fail_mmc_request))) &host->fail_mmc_request)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment