aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2008-05-24 22:36:31 +0200
committerPierre Ossman <drzeus@drzeus.cx>2008-07-15 14:14:40 +0200
commitfd8c326cadd2f781d5c4d6bcee79bb17b3745bb0 (patch)
tree28b629dbdb91336fafeb665b9fac9736a86fd6c7 /drivers/mmc
parent1e72859e3ae16346d4007024b20d2d4ef387dcc3 (diff)
mmc_test: add test case control
Add the ability to run just a single test case by writing the test case number into the sysfs "test" file. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/card/mmc_test.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index ffadee549a4..371d922d9ee 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -743,7 +743,7 @@ static const struct mmc_test_case mmc_test_cases[] = {
static struct mutex mmc_test_lock;
-static void mmc_test_run(struct mmc_test_card *test)
+static void mmc_test_run(struct mmc_test_card *test, int testcase)
{
int i, ret;
@@ -753,6 +753,9 @@ static void mmc_test_run(struct mmc_test_card *test)
mmc_claim_host(test->card->host);
for (i = 0;i < ARRAY_SIZE(mmc_test_cases);i++) {
+ if (testcase && ((i + 1) != testcase))
+ continue;
+
printk(KERN_INFO "%s: Test case %d. %s...\n",
mmc_hostname(test->card->host), i + 1,
mmc_test_cases[i].name);
@@ -824,9 +827,12 @@ static ssize_t mmc_test_store(struct device *dev,
{
struct mmc_card *card;
struct mmc_test_card *test;
+ int testcase;
card = container_of(dev, struct mmc_card, dev);
+ testcase = simple_strtol(buf, NULL, 10);
+
test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL);
if (!test)
return -ENOMEM;
@@ -836,7 +842,7 @@ static ssize_t mmc_test_store(struct device *dev,
test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL);
if (test->buffer) {
mutex_lock(&mmc_test_lock);
- mmc_test_run(test);
+ mmc_test_run(test, testcase);
mutex_unlock(&mmc_test_lock);
}