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>
This commit is contained in:
parent
58c7ccbf91
commit
54f3caf5bc
@ -2445,6 +2445,32 @@ static const struct file_operations mmc_test_fops_test = {
|
|||||||
.release = single_release,
|
.release = single_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int mtf_testlist_show(struct seq_file *sf, void *data)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
mutex_lock(&mmc_test_lock);
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++)
|
||||||
|
seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name);
|
||||||
|
|
||||||
|
mutex_unlock(&mmc_test_lock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mtf_testlist_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, mtf_testlist_show, inode->i_private);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations mmc_test_fops_testlist = {
|
||||||
|
.open = mtf_testlist_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = single_release,
|
||||||
|
};
|
||||||
|
|
||||||
static void mmc_test_free_file_test(struct mmc_card *card)
|
static void mmc_test_free_file_test(struct mmc_card *card)
|
||||||
{
|
{
|
||||||
struct mmc_test_dbgfs_file *df, *dfs;
|
struct mmc_test_dbgfs_file *df, *dfs;
|
||||||
@ -2476,7 +2502,18 @@ static int mmc_test_register_file_test(struct mmc_card *card)
|
|||||||
|
|
||||||
if (IS_ERR_OR_NULL(file)) {
|
if (IS_ERR_OR_NULL(file)) {
|
||||||
dev_err(&card->dev,
|
dev_err(&card->dev,
|
||||||
"Can't create file. Perhaps debugfs is disabled.\n");
|
"Can't create test. Perhaps debugfs is disabled.\n");
|
||||||
|
ret = -ENODEV;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (card->debugfs_root)
|
||||||
|
file = debugfs_create_file("testlist", S_IRUGO,
|
||||||
|
card->debugfs_root, card, &mmc_test_fops_testlist);
|
||||||
|
|
||||||
|
if (IS_ERR_OR_NULL(file)) {
|
||||||
|
dev_err(&card->dev,
|
||||||
|
"Can't create testlist. Perhaps debugfs is disabled.\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user