aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/card
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2008-05-24 16:36:31 -0400
committerPierre Ossman <drzeus@drzeus.cx>2008-07-15 08:14:40 -0400
commitfd8c326cadd2f781d5c4d6bcee79bb17b3745bb0 (patch)
tree28b629dbdb91336fafeb665b9fac9736a86fd6c7 /drivers/mmc/card
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/card')
-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 ffadee549a41..371d922d9ee2 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[] = {
743 743
744static struct mutex mmc_test_lock; 744static struct mutex mmc_test_lock;
745 745
746static void mmc_test_run(struct mmc_test_card *test) 746static void mmc_test_run(struct mmc_test_card *test, int testcase)
747{ 747{
748 int i, ret; 748 int i, ret;
749 749
@@ -753,6 +753,9 @@ static void mmc_test_run(struct mmc_test_card *test)
753 mmc_claim_host(test->card->host); 753 mmc_claim_host(test->card->host);
754 754
755 for (i = 0;i < ARRAY_SIZE(mmc_test_cases);i++) { 755 for (i = 0;i < ARRAY_SIZE(mmc_test_cases);i++) {
756 if (testcase && ((i + 1) != testcase))
757 continue;
758
756 printk(KERN_INFO "%s: Test case %d. %s...\n", 759 printk(KERN_INFO "%s: Test case %d. %s...\n",
757 mmc_hostname(test->card->host), i + 1, 760 mmc_hostname(test->card->host), i + 1,
758 mmc_test_cases[i].name); 761 mmc_test_cases[i].name);
@@ -824,9 +827,12 @@ static ssize_t mmc_test_store(struct device *dev,
824{ 827{
825 struct mmc_card *card; 828 struct mmc_card *card;
826 struct mmc_test_card *test; 829 struct mmc_test_card *test;
830 int testcase;
827 831
828 card = container_of(dev, struct mmc_card, dev); 832 card = container_of(dev, struct mmc_card, dev);
829 833
834 testcase = simple_strtol(buf, NULL, 10);
835
830 test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL); 836 test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL);
831 if (!test) 837 if (!test)
832 return -ENOMEM; 838 return -ENOMEM;
@@ -836,7 +842,7 @@ static ssize_t mmc_test_store(struct device *dev,
836 test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL); 842 test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL);
837 if (test->buffer) { 843 if (test->buffer) {
838 mutex_lock(&mmc_test_lock); 844 mutex_lock(&mmc_test_lock);
839 mmc_test_run(test); 845 mmc_test_run(test, testcase);
840 mutex_unlock(&mmc_test_lock); 846 mutex_unlock(&mmc_test_lock);
841 } 847 }
842 848