From patchwork Fri Jul 1 16:55:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Per Forlin X-Patchwork-Id: 936792 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p61GwHUk002690 for ; Fri, 1 Jul 2011 16:58:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755954Ab1GAQ4a (ORCPT ); Fri, 1 Jul 2011 12:56:30 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:62813 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757304Ab1GAQ42 (ORCPT ); Fri, 1 Jul 2011 12:56:28 -0400 Received: by mail-bw0-f46.google.com with SMTP id 5so2745132bwd.19 for ; Fri, 01 Jul 2011 09:56:27 -0700 (PDT) Received: by 10.204.38.129 with SMTP id b1mr3219308bke.212.1309539387486; Fri, 01 Jul 2011 09:56:27 -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 l24sm3176525bkw.3.2011.07.01.09.56.25 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 01 Jul 2011 09:56:26 -0700 (PDT) From: Per Forlin To: linaro-dev@lists.linaro.org, Nicolas Pitre , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, Venkatraman S , Linus Walleij , Kyungmin Park , Arnd Bergmann , Sourav Poddar , Chris Ball Cc: Per Forlin Subject: [PATCH v9 04/12] mmc: mmc_test: add debugfs file to list all tests Date: Fri, 1 Jul 2011 18:55:25 +0200 Message-Id: <1309539333-2606-5-git-send-email-per.forlin@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1309539333-2606-1-git-send-email-per.forlin@linaro.org> References: <1309539333-2606-1-git-send-email-per.forlin@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 01 Jul 2011 16:58:30 +0000 (UTC) Add a debugfs file "testlist" to print all available tests Signed-off-by: Per Forlin Acked-by: Kyungmin Park Acked-by: Arnd Bergmann Reviewed-by: Venkatraman S Tested-by: Sourav Poddar Tested-by: Linus Walleij --- 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 233cdfa..e8508e9 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 = { .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,7 +2502,18 @@ static int mmc_test_register_file_test(struct mmc_card *card) if (IS_ERR_OR_NULL(file)) { 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; goto err; }