Release 4.7 drivers/staging/wilc1000/wilc_debugfs.c
/*
* NewportMedia WiFi chipset driver test tools - wilc-debug
* Copyright (c) 2012 NewportMedia Inc.
* Author: SSW <sswd@wilcsemic.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#if defined(WILC_DEBUGFS)
#include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include "wilc_wlan_if.h"
static struct dentry *wilc_dir;
/*
* --------------------------------------------------------------------------------
*/
#define DEBUG BIT(0)
#define INFO BIT(1)
#define WRN BIT(2)
#define ERR BIT(3)
#define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR)
atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);
/*
* --------------------------------------------------------------------------------
*/
static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos)
{
char buf[128];
int res = 0;
/* only allow read from start */
if (*ppos > 0)
return 0;
res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", atomic_read(&WILC_DEBUG_LEVEL));
return simple_read_from_buffer(userbuf, count, ppos, buf, res);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johnny kim | johnny kim | 78 | 98.73% | 1 | 50.00% |
arnd bergmann | arnd bergmann | 1 | 1.27% | 1 | 50.00% |
| Total | 79 | 100.00% | 2 | 100.00% |
static ssize_t wilc_debug_level_write(struct file *filp, const char __user *buf,
size_t count, loff_t *ppos)
{
int flag = 0;
int ret;
ret = kstrtouint_from_user(buf, count, 16, &flag);
if (ret)
return ret;
if (flag > DBG_LEVEL_ALL) {
printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC_DEBUG_LEVEL));
return -EINVAL;
}
atomic_set(&WILC_DEBUG_LEVEL, (int)flag);
if (flag == 0)
printk(KERN_INFO "Debug-level disabled\n");
else
printk(KERN_INFO "Debug-level enabled\n");
return count;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johnny kim | johnny kim | 92 | 81.42% | 1 | 25.00% |
chandra s gorentla | chandra s gorentla | 17 | 15.04% | 1 | 25.00% |
janani ravichandran | janani ravichandran | 2 | 1.77% | 1 | 25.00% |
arnd bergmann | arnd bergmann | 2 | 1.77% | 1 | 25.00% |
| Total | 113 | 100.00% | 4 | 100.00% |
/*
* --------------------------------------------------------------------------------
*/
#define FOPS(_open, _read, _write, _poll) { \
.owner = THIS_MODULE, \
.open = (_open), \
.read = (_read), \
.write = (_write), \
.poll = (_poll), \
}
struct wilc_debugfs_info_t {
const char *name;
int perm;
unsigned int data;
const struct file_operations fops;
};
static struct wilc_debugfs_info_t debugfs_info[] = {
{ "wilc_debug_level", 0666, (DEBUG | ERR), FOPS(NULL, wilc_debug_level_read, wilc_debug_level_write, NULL), },
};
static int __init wilc_debugfs_init(void)
{
int i;
struct dentry *debugfs_files;
struct wilc_debugfs_info_t *info;
wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
if (wilc_dir == ERR_PTR(-ENODEV)) {
/* it's not error. the debugfs is just not being enabled. */
printk("ERR, kernel has built without debugfs support\n");
return 0;
}
if (!wilc_dir) {
printk("ERR, debugfs create dir\n");
return -1;
}
for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) {
info = &debugfs_info[i];
debugfs_files = debugfs_create_file(info->name,
info->perm,
wilc_dir,
&info->data,
&info->fops);
if (!debugfs_files) {
printk("ERR fail to create the debugfs file, %s\n", info->name);
debugfs_remove_recursive(wilc_dir);
return -1;
}
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johnny kim | johnny kim | 145 | 98.64% | 1 | 50.00% |
arnd bergmann | arnd bergmann | 2 | 1.36% | 1 | 50.00% |
| Total | 147 | 100.00% | 2 | 100.00% |
module_init(wilc_debugfs_init);
static void __exit wilc_debugfs_remove(void)
{
debugfs_remove_recursive(wilc_dir);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johnny kim | johnny kim | 12 | 85.71% | 1 | 50.00% |
arnd bergmann | arnd bergmann | 2 | 14.29% | 1 | 50.00% |
| Total | 14 | 100.00% | 2 | 100.00% |
module_exit(wilc_debugfs_remove);
#endif
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
johnny kim | johnny kim | 436 | 88.08% | 1 | 12.50% |
arnd bergmann | arnd bergmann | 23 | 4.65% | 3 | 37.50% |
chandra s gorentla | chandra s gorentla | 17 | 3.43% | 1 | 12.50% |
chris park | chris park | 16 | 3.23% | 1 | 12.50% |
janani ravichandran | janani ravichandran | 2 | 0.40% | 1 | 12.50% |
eva rachel retuya | eva rachel retuya | 1 | 0.20% | 1 | 12.50% |
| Total | 495 | 100.00% | 8 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.