From patchwork Wed Sep 14 08:46: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: 4057 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 D05A023EFA for ; Wed, 14 Sep 2011 08:47:22 +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 BEECBA1813D for ; Wed, 14 Sep 2011 08:47:22 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so2006249fxe.11 for ; Wed, 14 Sep 2011 01:47:22 -0700 (PDT) Received: by 10.223.74.89 with SMTP id t25mr2140876faj.65.1315990042664; Wed, 14 Sep 2011 01:47:22 -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 m8cs41702lab; Wed, 14 Sep 2011 01:47:22 -0700 (PDT) Received: by 10.204.133.3 with SMTP id d3mr1678037bkt.314.1315990042064; Wed, 14 Sep 2011 01:47:22 -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 zy13si2719239bkb.118.2011.09.14.01.47.20 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Sep 2011 01:47:22 -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 zt19so1498262bkb.37 for ; Wed, 14 Sep 2011 01:47:20 -0700 (PDT) Received: by 10.204.13.77 with SMTP id b13mr1968537bka.251.1315990040714; Wed, 14 Sep 2011 01:47:20 -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 t16sm3139564bkv.11.2011.09.14.01.47.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Sep 2011 01:47:19 -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 v2 2/3] mmc: add module param to set fault injection attributes Date: Wed, 14 Sep 2011 10:46:56 +0200 Message-Id: <1315990017-16912-3-git-send-email-per.forlin@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1315990017-16912-1-git-send-email-per.forlin@linaro.org> References: <1315990017-16912-1-git-send-email-per.forlin@linaro.org> Replace setup("fail_mmc_request") and faulty "ifdef KERNEL" with a module_param_cb(). 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 | 38 ++++++++++++++++++++------------------ 1 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 5acd707..d80e234 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -20,6 +20,25 @@ #include "core.h" #include "mmc_ops.h" +#ifdef CONFIG_FAIL_MMC_REQUEST + +static DECLARE_FAULT_ATTR(fail_default_attr); +static char *fail_request; +static int fail_mmc_request_param_set(const char *val, + const struct kernel_param *kp) +{ + setup_fault_attr(&fail_default_attr, (char *) val); + return 0; +} + +static const struct kernel_param_ops fail_mmc_request_param_ops = { + .set = fail_mmc_request_param_set +}; +module_param_cb(fail_request, &fail_mmc_request_param_ops, + &fail_request, 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 +178,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 +209,7 @@ 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; + host->fail_mmc_request = fail_default_attr; if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request", root, &host->fail_mmc_request)))