diff options
author | Per Forlin <per.forlin@linaro.org> | 2011-07-01 12:55:25 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-07-20 17:21:11 -0400 |
commit | 54f3caf5bcb732c9ac48308b7b43eb9aaa7ed8ca (patch) | |
tree | 2081dbc58803d06c51a467253dac3253aa60b9e7 /drivers/mmc/card | |
parent | 58c7ccbf9109abcc6b7ed2f76c21ebee244d31a8 (diff) |
mmc: mmc_test: add debugfs file to list all tests
Add a debugfs file "testlist" to print all available tests.
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Tested-by: Sourav Poddar<sourav.poddar@ti.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r-- | drivers/mmc/card/mmc_test.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index 233cdfae92f4..e8508e99aed5 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c | |||
@@ -2445,6 +2445,32 @@ static const struct file_operations mmc_test_fops_test = { | |||
2445 | .release = single_release, | 2445 | .release = single_release, |
2446 | }; | 2446 | }; |
2447 | 2447 | ||
2448 | static int mtf_testlist_show(struct seq_file *sf, void *data) | ||
2449 | { | ||
2450 | int i; | ||
2451 | |||
2452 | mutex_lock(&mmc_test_lock); | ||
2453 | |||
2454 | for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++) | ||
2455 | seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name); | ||
2456 | |||
2457 | mutex_unlock(&mmc_test_lock); | ||
2458 | |||
2459 | return 0; | ||
2460 | } | ||
2461 | |||
2462 | static int mtf_testlist_open(struct inode *inode, struct file *file) | ||
2463 | { | ||
2464 | return single_open(file, mtf_testlist_show, inode->i_private); | ||
2465 | } | ||
2466 | |||
2467 | static const struct file_operations mmc_test_fops_testlist = { | ||
2468 | .open = mtf_testlist_open, | ||
2469 | .read = seq_read, | ||
2470 | .llseek = seq_lseek, | ||
2471 | .release = single_release, | ||
2472 | }; | ||
2473 | |||
2448 | static void mmc_test_free_file_test(struct mmc_card *card) | 2474 | static void mmc_test_free_file_test(struct mmc_card *card) |
2449 | { | 2475 | { |
2450 | struct mmc_test_dbgfs_file *df, *dfs; | 2476 | struct mmc_test_dbgfs_file *df, *dfs; |
@@ -2476,7 +2502,18 @@ static int mmc_test_register_file_test(struct mmc_card *card) | |||
2476 | 2502 | ||
2477 | if (IS_ERR_OR_NULL(file)) { | 2503 | if (IS_ERR_OR_NULL(file)) { |
2478 | dev_err(&card->dev, | 2504 | dev_err(&card->dev, |
2479 | "Can't create file. Perhaps debugfs is disabled.\n"); | 2505 | "Can't create test. Perhaps debugfs is disabled.\n"); |
2506 | ret = -ENODEV; | ||
2507 | goto err; | ||
2508 | } | ||
2509 | |||
2510 | if (card->debugfs_root) | ||
2511 | file = debugfs_create_file("testlist", S_IRUGO, | ||
2512 | card->debugfs_root, card, &mmc_test_fops_testlist); | ||
2513 | |||
2514 | if (IS_ERR_OR_NULL(file)) { | ||
2515 | dev_err(&card->dev, | ||
2516 | "Can't create testlist. Perhaps debugfs is disabled.\n"); | ||
2480 | ret = -ENODEV; | 2517 | ret = -ENODEV; |
2481 | goto err; | 2518 | goto err; |
2482 | } | 2519 | } |