linux/lib/842/842_debugfs.h
Greg Kroah-Hartman 352bce2ee1 lib: 842: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Haren Myneni <haren@us.ibm.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20190612153440.GA21006@kroah.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-03 16:57:17 +02:00

51 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __842_DEBUGFS_H__
#define __842_DEBUGFS_H__
#include <linux/debugfs.h>
static bool sw842_template_counts;
module_param_named(template_counts, sw842_template_counts, bool, 0444);
static atomic_t template_count[OPS_MAX], template_repeat_count,
template_zeros_count, template_short_data_count, template_end_count;
static struct dentry *sw842_debugfs_root;
static int __init sw842_debugfs_create(void)
{
umode_t m = S_IRUGO | S_IWUSR;
int i;
if (!debugfs_initialized())
return -ENODEV;
sw842_debugfs_root = debugfs_create_dir(MODULE_NAME, NULL);
for (i = 0; i < ARRAY_SIZE(template_count); i++) {
char name[32];
snprintf(name, 32, "template_%02x", i);
debugfs_create_atomic_t(name, m, sw842_debugfs_root,
&template_count[i]);
}
debugfs_create_atomic_t("template_repeat", m, sw842_debugfs_root,
&template_repeat_count);
debugfs_create_atomic_t("template_zeros", m, sw842_debugfs_root,
&template_zeros_count);
debugfs_create_atomic_t("template_short_data", m, sw842_debugfs_root,
&template_short_data_count);
debugfs_create_atomic_t("template_end", m, sw842_debugfs_root,
&template_end_count);
return 0;
}
static void __exit sw842_debugfs_remove(void)
{
debugfs_remove_recursive(sw842_debugfs_root);
}
#endif