summaryrefslogtreecommitdiffstats
path: root/lib/fault-inject.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-07-26 16:09:01 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-26 16:49:46 -0700
commit8307fc257cf3931d87e172bd8663e80c3d1e56a3 (patch)
tree4f265586a0617284be4baec5b5d6990cdea13b31 /lib/fault-inject.c
parent6b16f748a0d4546726bb53cad58525adfd6425e9 (diff)
downloadlinux-8307fc257cf3931d87e172bd8663e80c3d1e56a3.tar.gz
linux-8307fc257cf3931d87e172bd8663e80c3d1e56a3.tar.bz2
linux-8307fc257cf3931d87e172bd8663e80c3d1e56a3.zip
fault-injection: cleanup simple attribute of stacktrace_depth
Minor cosmetic changes for simple attribute of stacktrace_depth: - use min_t() - reduce #ifdef by moving a function - do not use partly capitalized function name Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/fault-inject.c')
-rw-r--r--lib/fault-inject.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index e6430e1ce180..882fd3b6a6ad 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -139,16 +139,6 @@ static int debugfs_ul_set(void *data, u64 val)
return 0;
}
-#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER
-static int debugfs_ul_set_MAX_STACK_TRACE_DEPTH(void *data, u64 val)
-{
- *(unsigned long *)data =
- val < MAX_STACK_TRACE_DEPTH ?
- val : MAX_STACK_TRACE_DEPTH;
- return 0;
-}
-#endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */
-
static int debugfs_ul_get(void *data, u64 *val)
{
*val = *(unsigned long *)data;
@@ -164,16 +154,26 @@ static struct dentry *debugfs_create_ul(const char *name, mode_t mode,
}
#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER
-DEFINE_SIMPLE_ATTRIBUTE(fops_ul_MAX_STACK_TRACE_DEPTH, debugfs_ul_get,
- debugfs_ul_set_MAX_STACK_TRACE_DEPTH, "%llu\n");
-static struct dentry *debugfs_create_ul_MAX_STACK_TRACE_DEPTH(
+static int debugfs_stacktrace_depth_set(void *data, u64 val)
+{
+ *(unsigned long *)data =
+ min_t(unsigned long, val, MAX_STACK_TRACE_DEPTH);
+
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(fops_stacktrace_depth, debugfs_ul_get,
+ debugfs_stacktrace_depth_set, "%llu\n");
+
+static struct dentry *debugfs_create_stacktrace_depth(
const char *name, mode_t mode,
struct dentry *parent, unsigned long *value)
{
return debugfs_create_file(name, mode, parent, value,
- &fops_ul_MAX_STACK_TRACE_DEPTH);
+ &fops_stacktrace_depth);
}
+
#endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */
static int debugfs_atomic_t_set(void *data, u64 val)
@@ -281,7 +281,7 @@ int init_fault_attr_dentries(struct fault_attr *attr, const char *name)
#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER
attr->dentries.stacktrace_depth_file =
- debugfs_create_ul_MAX_STACK_TRACE_DEPTH(
+ debugfs_create_stacktrace_depth(
"stacktrace-depth", mode, dir, &attr->stacktrace_depth);
attr->dentries.require_start_file =