From patchwork Sat Jun 18 20:55:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Per Forlin X-Patchwork-Id: 2046 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DDD2823F43 for ; Sat, 18 Jun 2011 20:56:51 +0000 (UTC) Received: from mail-vx0-f180.google.com (mail-vx0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id A5990A1867E for ; Sat, 18 Jun 2011 20:56:51 +0000 (UTC) Received: by mail-vx0-f180.google.com with SMTP id 7so1410301vxd.11 for ; Sat, 18 Jun 2011 13:56:51 -0700 (PDT) Received: by 10.52.75.4 with SMTP id y4mr446653vdv.167.1308430611445; Sat, 18 Jun 2011 13:56:51 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.52.183.130 with SMTP id em2cs35009vdc; Sat, 18 Jun 2011 13:56:51 -0700 (PDT) Received: by 10.204.133.27 with SMTP id d27mr2764106bkt.69.1308430610557; Sat, 18 Jun 2011 13:56:50 -0700 (PDT) Received: from mail-bw0-f50.google.com (mail-bw0-f50.google.com [209.85.214.50]) by mx.google.com with ESMTPS id y13si11429305bkd.37.2011.06.18.13.56.49 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 18 Jun 2011 13:56:50 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.214.50 is neither permitted nor denied by best guess record for domain of per.forlin@linaro.org) client-ip=209.85.214.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.214.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-bw0-f50.google.com with SMTP id 2so3810709bwz.37 for ; Sat, 18 Jun 2011 13:56:49 -0700 (PDT) Received: by 10.204.76.83 with SMTP id b19mr2711765bkk.126.1308430609431; Sat, 18 Jun 2011 13:56:49 -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 n3sm3064448bka.16.2011.06.18.13.56.47 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 18 Jun 2011 13:56:48 -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, Venkatraman S Cc: Chris Ball , Per Forlin Subject: [PATCH v5 05/12] mmc: mmc_test: add debugfs file to list all tests Date: Sat, 18 Jun 2011 22:55:19 +0200 Message-Id: <1308430526-9412-6-git-send-email-per.forlin@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1308430526-9412-1-git-send-email-per.forlin@linaro.org> References: <1308430526-9412-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 | 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; }