From patchwork Tue Sep 13 21:03:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Per Forlin X-Patchwork-Id: 4053 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 BACA423F44 for ; Tue, 13 Sep 2011 21:04:34 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id A3CCBA183FE for ; Tue, 13 Sep 2011 21:04:34 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so1360744fxe.11 for ; Tue, 13 Sep 2011 14:04:34 -0700 (PDT) Received: by 10.223.49.209 with SMTP id w17mr370913faf.8.1315947871304; Tue, 13 Sep 2011 14:04:31 -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.152.11.8 with SMTP id m8cs22988lab; Tue, 13 Sep 2011 14:04:31 -0700 (PDT) Received: by 10.204.135.3 with SMTP id l3mr1303417bkt.169.1315947870709; Tue, 13 Sep 2011 14:04:30 -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 p7si2069950bke.91.2011.09.13.14.04.29 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Sep 2011 14:04:30 -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 zt19so1061786bkb.37 for ; Tue, 13 Sep 2011 14:04:29 -0700 (PDT) Received: by 10.204.151.17 with SMTP id a17mr1776398bkw.58.1315947869276; Tue, 13 Sep 2011 14:04:29 -0700 (PDT) Received: from localhost.localdomain (c-c37f71d5.029-82-6c756e10.cust.bredbandsbolaget.se [213.113.127.195]) by mx.google.com with ESMTPS id i5sm2260984bkd.0.2011.09.13.14.04.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Sep 2011 14:04:28 -0700 (PDT) From: Per Forlin To: linaro-dev@lists.linaro.org, Akinobu Mita , Linus Walleij , linux-mmc@vger.kernel.org Cc: Chris Ball , Randy Dunlap , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Per Forlin Subject: [PATCH 2/3] mmc: add module param to set fault injection attributes Date: Tue, 13 Sep 2011 23:03:29 +0200 Message-Id: <1315947810-22714-3-git-send-email-per.forlin@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1315947810-22714-1-git-send-email-per.forlin@linaro.org> References: <1315947810-22714-1-git-send-email-per.forlin@linaro.org> Replace setup("fail_mmc_request") and faulty "ifdef KERNEL" with a simple module_param(). The module param mmc_core.fail_request may be used to set the fault injection attributes during boot time or module load time. Signed-off-by: Per Forlin --- drivers/mmc/core/debugfs.c | 29 +++++++++++------------------ 1 files changed, 11 insertions(+), 18 deletions(-) diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 5acd707..bb72ba2 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -20,6 +20,14 @@ #include "core.h" #include "mmc_ops.h" +#ifdef CONFIG_FAIL_MMC_REQUEST + +static DECLARE_FAULT_ATTR(fail_default_attr); +static char *fail_request; +module_param(fail_request, charp, 0); + +#endif /* CONFIG_FAIL_MMC_REQUEST */ + /* The debugfs functions are optimized away when CONFIG_DEBUG_FS isn't set. */ static int mmc_ios_show(struct seq_file *s, void *data) { @@ -159,23 +167,6 @@ static int mmc_clock_opt_set(void *data, u64 val) return 0; } -#ifdef CONFIG_FAIL_MMC_REQUEST - -static DECLARE_FAULT_ATTR(fail_mmc_request); - -#ifdef KERNEL -/* - * Internal function. Pass the boot param fail_mmc_request to - * the setup fault injection attributes routine. - */ -static int __init setup_fail_mmc_request(char *str) -{ - return setup_fault_attr(&fail_mmc_request, str); -} -__setup("fail_mmc_request=", setup_fail_mmc_request); -#endif /* KERNEL */ -#endif /* CONFIG_FAIL_MMC_REQUEST */ - DEFINE_SIMPLE_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set, "%llu\n"); @@ -207,7 +198,9 @@ void mmc_add_host_debugfs(struct mmc_host *host) goto err_node; #endif #ifdef CONFIG_FAIL_MMC_REQUEST - host->fail_mmc_request = fail_mmc_request; + if (fail_request) + setup_fault_attr(&fail_default_attr, fail_request); + host->fail_mmc_request = fail_default_attr; if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request", root, &host->fail_mmc_request)))