From: Per Forlin <per.forlin@linaro.org>
To: linaro-dev@lists.linaro.org,
Akinobu Mita <akinobu.mita@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-mmc@vger.kernel.org
Cc: Chris Ball <cjb@laptop.org>, Randy Dunlap <rdunlap@xenotime.net>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Per Forlin <per.forlin@linaro.org>
Subject: [PATCH v3 2/3] mmc: add module param to set fault injection attributes
Date: Wed, 14 Sep 2011 14:10:17 +0200 [thread overview]
Message-ID: <1316002218-3408-3-git-send-email-per.forlin@linaro.org> (raw)
In-Reply-To: <1316002218-3408-1-git-send-email-per.forlin@linaro.org>
Replace setup("fail_mmc_request") and faulty "ifdef KERNEL" with
a module_param_cb(). 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: Per Forlin <per.forlin@linaro.org>
---
drivers/mmc/core/debugfs.c | 38 ++++++++++++++++++++------------------
1 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 5acd707..13e44c9 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -20,6 +20,25 @@
#include "core.h"
#include "mmc_ops.h"
+#ifdef CONFIG_FAIL_MMC_REQUEST
+
+static DECLARE_FAULT_ATTR(fail_default_attr);
+static int fail_mmc_request_param_set(const char *val,
+ const struct kernel_param *kp)
+{
+ if (setup_fault_attr(&fail_default_attr, (char *) val) == 0)
+ return -EINVAL;
+
+ return 0;
+}
+
+static const struct kernel_param_ops fail_mmc_request_param_ops = {
+ .set = fail_mmc_request_param_set
+};
+module_param_cb(fail_request, &fail_mmc_request_param_ops, NULL, 0);
+
+#endif /* CONFIG_FAIL_MMC_REQUEST */
+
/* The debugfs functions are optimized away when CONFIG_DEBUG_FS isn't set. */
static int mmc_ios_show(struct seq_file *s, void *data)
{
@@ -159,23 +178,6 @@ static int mmc_clock_opt_set(void *data, u64 val)
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,
"%llu\n");
@@ -207,7 +209,7 @@ void mmc_add_host_debugfs(struct mmc_host *host)
goto err_node;
#endif
#ifdef CONFIG_FAIL_MMC_REQUEST
- host->fail_mmc_request = fail_mmc_request;
+ host->fail_mmc_request = fail_default_attr;
if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request",
root,
&host->fail_mmc_request)))
--
1.7.4.1
next prev parent reply other threads:[~2011-09-14 12:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-14 12:10 [PATCH v3 0/3] mmc: rectify boot param option for fault injection Per Forlin
2011-09-14 12:10 ` [PATCH v3 1/3] fault-inject: export setup_fault_attr() Per Forlin
2011-09-14 12:10 ` Per Forlin [this message]
2011-09-14 12:10 ` [PATCH v3 3/3] fault-injection: update documentation with the mmc module param Per Forlin
2011-09-19 3:51 ` [PATCH v3 0/3] mmc: rectify boot param option for fault injection Akinobu Mita
2011-09-21 18:57 ` Chris Ball
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1316002218-3408-3-git-send-email-per.forlin@linaro.org \
--to=per.forlin@linaro.org \
--cc=akinobu.mita@gmail.com \
--cc=cjb@laptop.org \
--cc=linaro-dev@lists.linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=rdunlap@xenotime.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®