From patchwork Sat May 7 19:14:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Per Forlin X-Patchwork-Id: 1401 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:51:42 -0000 Delivered-To: patches@linaro.org Received: by 10.224.184.145 with SMTP id ck17cs13853qab; Sat, 7 May 2011 12:15:36 -0700 (PDT) Received: by 10.14.4.32 with SMTP id 32mr2525398eei.141.1304795735518; Sat, 07 May 2011 12:15:35 -0700 (PDT) Received: from mail-ew0-f50.google.com (mail-ew0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id 16si9717040eej.80.2011.05.07.12.15.34 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 07 May 2011 12:15:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of per.forlin@linaro.org) client-ip=209.85.215.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of per.forlin@linaro.org) smtp.mail=per.forlin@linaro.org Received: by mail-ew0-f50.google.com with SMTP id 10so1407884ewy.37 for ; Sat, 07 May 2011 12:15:34 -0700 (PDT) Received: by 10.14.32.13 with SMTP id n13mr2676607eea.21.1304795734504; Sat, 07 May 2011 12:15:34 -0700 (PDT) Received: from localhost.localdomain (c-3c7b71d5.029-82-6c756e10.cust.bredbandsbolaget.se [213.113.123.60]) by mx.google.com with ESMTPS id s62sm2260327eea.24.2011.05.07.12.15.33 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 07 May 2011 12:15:33 -0700 (PDT) From: Per Forlin To: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-dev@lists.linaro.org Cc: Chris Ball , Per Forlin Subject: [PATCH v3 02/12] mmc: mmc_test: add debugfs file to list all tests Date: Sat, 7 May 2011 21:14:56 +0200 Message-Id: <1304795706-27308-3-git-send-email-per.forlin@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1304795706-27308-1-git-send-email-per.forlin@linaro.org> References: <1304795706-27308-1-git-send-email-per.forlin@linaro.org> Add a debugfs file "testlist" to print all available tests Signed-off-by: Per Forlin --- drivers/mmc/card/mmc_test.c | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index abc1a63..c1c3c5a 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c @@ -2447,6 +2447,32 @@ static const struct file_operations mmc_test_fops_test = { .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) { struct mmc_test_dbgfs_file *df, *dfs; @@ -2476,6 +2502,10 @@ static int mmc_test_register_file_test(struct mmc_card *card) file = debugfs_create_file("test", S_IWUSR | S_IRUGO, card->debugfs_root, card, &mmc_test_fops_test); + 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 file. Perhaps debugfs is disabled.\n");