mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] mmc: rectify boot param option for fault injection
@ 2011-09-13 21:03 Per Forlin
  2011-09-13 21:03 ` [PATCH 1/3] fault-inject: export setup_fault_attr() Per Forlin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Per Forlin @ 2011-09-13 21:03 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". Akinobu suggested to use
a module param instead.

This patch set is for 3.2

Per Forlin (3):
  fault-inject: export setup_fault_attr()
  mmc: add module param to set fault injection attributes
  fault-injection: update documenation with the mmc module param

 Documentation/fault-injection/fault-injection.txt |    2 +-
 drivers/mmc/core/debugfs.c                        |   29 ++++++++-------------
 lib/fault-inject.c                                |    3 +-
 3 files changed, 14 insertions(+), 20 deletions(-)

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] fault-inject: export setup_fault_attr()
  2011-09-13 21:03 [PATCH 0/3] mmc: rectify boot param option for fault injection Per Forlin
@ 2011-09-13 21:03 ` Per Forlin
  2011-09-13 21:03 ` [PATCH 2/3] mmc: add module param to set fault injection attributes Per Forlin
  2011-09-13 21:03 ` [PATCH 3/3] fault-injection: update documenation with the mmc module param Per Forlin
  2 siblings, 0 replies; 4+ messages in thread
From: Per Forlin @ 2011-09-13 21:03 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] 4+ messages in thread

* [PATCH 2/3] mmc: add module param to set fault injection attributes
  2011-09-13 21:03 [PATCH 0/3] mmc: rectify boot param option for fault injection Per Forlin
  2011-09-13 21:03 ` [PATCH 1/3] fault-inject: export setup_fault_attr() Per Forlin
@ 2011-09-13 21:03 ` Per Forlin
  2011-09-13 21:03 ` [PATCH 3/3] fault-injection: update documenation with the mmc module param Per Forlin
  2 siblings, 0 replies; 4+ messages in thread
From: Per Forlin @ 2011-09-13 21:03 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 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: Per Forlin <per.forlin@linaro.org>
---
 drivers/mmc/core/debugfs.c |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 5acd707..bb72ba2 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -20,6 +20,14 @@
 #include "core.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. */
 static int mmc_ios_show(struct seq_file *s, void *data)
 {
@@ -159,23 +167,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 +198,9 @@ 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;
+	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",
 					     root,
 					     &host->fail_mmc_request)))
-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] fault-injection: update documenation with the mmc module param
  2011-09-13 21:03 [PATCH 0/3] mmc: rectify boot param option for fault injection Per Forlin
  2011-09-13 21:03 ` [PATCH 1/3] fault-inject: export setup_fault_attr() Per Forlin
  2011-09-13 21:03 ` [PATCH 2/3] mmc: add module param to set fault injection attributes Per Forlin
@ 2011-09-13 21:03 ` Per Forlin
  2 siblings, 0 replies; 4+ messages in thread
From: Per Forlin @ 2011-09-13 21:03 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] 4+ messages in thread

end of thread, other threads:[~2011-09-13 21:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-13 21:03 [PATCH 0/3] mmc: rectify boot param option for fault injection Per Forlin
2011-09-13 21:03 ` [PATCH 1/3] fault-inject: export setup_fault_attr() Per Forlin
2011-09-13 21:03 ` [PATCH 2/3] mmc: add module param to set fault injection attributes Per Forlin
2011-09-13 21:03 ` [PATCH 3/3] fault-injection: update documenation with the mmc module param Per Forlin

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®