* [PATCH v3 0/3] mmc: rectify boot param option for fault injection
@ 2011-09-14 12:10 Per Forlin
2011-09-14 12:10 ` [PATCH v3 1/3] fault-inject: export setup_fault_attr() Per Forlin
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Per Forlin @ 2011-09-14 12:10 UTC (permalink / raw)
To: linaro-dev, Akinobu Mita, Linus Walleij, linux-mmc
Cc: Chris Ball, Randy Dunlap, linux-doc, linux-kernel, Per Forlin
Akinobu Mita reported that the boot option for mmc fault injection is never
compiled in due to a fauly "ifdef KERNEL" that is never set.
A correct ifdef would be "ifndef MODULE". This patch set adds a
module_param_cb() and thereby no ifndef MODULE is needed.
Using a module_param makes it possible to pass default fault attributes for
external modules too.
This patch set is for 3.2
Change log:
v2 - use module_param_cb() to set default fault attributes
- fix spelling of documentation in patch #3
v3 - remove unused variable and return error if invalid boot param.
Per Forlin (3):
fault-inject: export setup_fault_attr()
mmc: add module param to set fault injection attributes
fault-injection: update documentation with the mmc module param
Documentation/fault-injection/fault-injection.txt | 2 +-
drivers/mmc/core/debugfs.c | 38 +++++++++++----------
lib/fault-inject.c | 3 +-
3 files changed, 23 insertions(+), 20 deletions(-)
--
1.7.4.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/3] fault-inject: export setup_fault_attr()
2011-09-14 12:10 [PATCH v3 0/3] mmc: rectify boot param option for fault injection Per Forlin
@ 2011-09-14 12:10 ` Per Forlin
2011-09-14 12:10 ` [PATCH v3 2/3] mmc: add module param to set fault injection attributes Per Forlin
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Per Forlin @ 2011-09-14 12:10 UTC (permalink / raw)
To: linaro-dev, Akinobu Mita, Linus Walleij, linux-mmc
Cc: Chris Ball, Randy Dunlap, linux-doc, linux-kernel, Per Forlin
mmc_core module needs to use setup_fault_attr() in order
to set fault injection attributes during module load time.
Signed-off-by: Per Forlin <per.forlin@linaro.org>
---
lib/fault-inject.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index 328d433..4f75540 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -14,7 +14,7 @@
* setup_fault_attr() is a helper function for various __setup handlers, so it
* returns 0 on error, because that is what __setup handlers do.
*/
-int __init setup_fault_attr(struct fault_attr *attr, char *str)
+int setup_fault_attr(struct fault_attr *attr, char *str)
{
unsigned long probability;
unsigned long interval;
@@ -36,6 +36,7 @@ int __init setup_fault_attr(struct fault_attr *attr, char *str)
return 1;
}
+EXPORT_SYMBOL_GPL(setup_fault_attr);
static void fail_dump(struct fault_attr *attr)
{
--
1.7.4.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 2/3] mmc: add module param to set fault injection attributes
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
2011-09-14 12:10 ` [PATCH v3 3/3] fault-injection: update documentation with the mmc module param Per Forlin
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Per Forlin @ 2011-09-14 12:10 UTC (permalink / raw)
To: linaro-dev, Akinobu Mita, Linus Walleij, linux-mmc
Cc: Chris Ball, Randy Dunlap, linux-doc, linux-kernel, Per Forlin
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 3/3] fault-injection: update documentation with the mmc module param
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 ` [PATCH v3 2/3] mmc: add module param to set fault injection attributes Per Forlin
@ 2011-09-14 12:10 ` 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
4 siblings, 0 replies; 6+ messages in thread
From: Per Forlin @ 2011-09-14 12:10 UTC (permalink / raw)
To: linaro-dev, Akinobu Mita, Linus Walleij, linux-mmc
Cc: Chris Ball, Randy Dunlap, linux-doc, linux-kernel, Per Forlin
Signed-off-by: Per Forlin <per.forlin@linaro.org>
---
Documentation/fault-injection/fault-injection.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.txt
index 70f924e..ba4be8b 100644
--- a/Documentation/fault-injection/fault-injection.txt
+++ b/Documentation/fault-injection/fault-injection.txt
@@ -121,7 +121,7 @@ use the boot option:
failslab=
fail_page_alloc=
fail_make_request=
- fail_mmc_request=<interval>,<probability>,<space>,<times>
+ mmc_core.fail_request=<interval>,<probability>,<space>,<times>
How to add new fault injection capability
-----------------------------------------
--
1.7.4.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/3] mmc: rectify boot param option for fault injection
2011-09-14 12:10 [PATCH v3 0/3] mmc: rectify boot param option for fault injection Per Forlin
` (2 preceding siblings ...)
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 ` Akinobu Mita
2011-09-21 18:57 ` Chris Ball
4 siblings, 0 replies; 6+ messages in thread
From: Akinobu Mita @ 2011-09-19 3:51 UTC (permalink / raw)
To: Per Forlin
Cc: linaro-dev, Linus Walleij, linux-mmc, Chris Ball, Randy Dunlap,
linux-doc, linux-kernel
2011/9/14 Per Forlin <per.forlin@linaro.org>:
> Akinobu Mita reported that the boot option for mmc fault injection is never
> compiled in due to a fauly "ifdef KERNEL" that is never set.
> A correct ifdef would be "ifndef MODULE". This patch set adds a
> module_param_cb() and thereby no ifndef MODULE is needed.
> Using a module_param makes it possible to pass default fault attributes for
> external modules too.
All patches look good to me.
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/3] mmc: rectify boot param option for fault injection
2011-09-14 12:10 [PATCH v3 0/3] mmc: rectify boot param option for fault injection Per Forlin
` (3 preceding siblings ...)
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
4 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2011-09-21 18:57 UTC (permalink / raw)
To: Per Forlin
Cc: linaro-dev, Akinobu Mita, Linus Walleij, linux-mmc, Randy Dunlap,
linux-doc, linux-kernel
Hi Per,
On Wed, Sep 14 2011, Per Forlin wrote:
> Akinobu Mita reported that the boot option for mmc fault injection is never
> compiled in due to a fauly "ifdef KERNEL" that is never set.
> A correct ifdef would be "ifndef MODULE". This patch set adds a
> module_param_cb() and thereby no ifndef MODULE is needed.
> Using a module_param makes it possible to pass default fault attributes for
> external modules too.
Thanks, all merged to mmc-next for 3.2 with Akinobu-san's Reviewed-by.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-09-21 18:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v3 2/3] mmc: add module param to set fault injection attributes Per Forlin
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome