aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/wilc1000/wilc_debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/wilc1000/wilc_debugfs.c')
-rw-r--r--drivers/staging/wilc1000/wilc_debugfs.c53
1 files changed, 7 insertions, 46 deletions
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index 27c653a0cdf9..fcbc95d19d8e 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -23,11 +23,12 @@ static struct dentry *wilc_dir;
/*
* --------------------------------------------------------------------------------
*/
+#define DEBUG BIT(0)
+#define INFO BIT(1)
+#define WRN BIT(2)
+#define ERR BIT(3)
-#define DBG_REGION_ALL (GENERIC_DBG | HOSTAPD_DBG | HOSTINF_DBG | CORECONFIG_DBG | CFG80211_DBG | INT_DBG | TX_DBG | RX_DBG | LOCK_DBG | INIT_DBG | BUS_DBG | MEM_DBG)
#define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR)
-atomic_t WILC_REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
-EXPORT_SYMBOL_GPL(WILC_REGION);
atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);
@@ -68,48 +69,9 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char __user *buf,
atomic_set(&WILC_DEBUG_LEVEL, (int)flag);
if (flag == 0)
- printk("Debug-level disabled\n");
+ printk(KERN_INFO "Debug-level disabled\n");
else
- printk("Debug-level enabled\n");
-
- return count;
-}
-
-static ssize_t wilc_debug_region_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 region: %x\n", atomic_read(&WILC_REGION));
-
- return simple_read_from_buffer(userbuf, count, ppos, buf, res);
-}
-
-static ssize_t wilc_debug_region_write(struct file *filp, const char *buf, size_t count, loff_t *ppos)
-{
- char buffer[128] = {};
- int flag;
-
- if (count > sizeof(buffer))
- return -EINVAL;
-
- if (copy_from_user(buffer, buf, count)) {
- return -EFAULT;
- }
-
- flag = buffer[0] - '0';
-
- if (flag > DBG_REGION_ALL) {
- printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC_REGION));
- return -EFAULT;
- }
-
- atomic_set(&WILC_REGION, (int)flag);
- printk("new debug-region is %x\n", atomic_read(&WILC_REGION));
+ printk(KERN_INFO "Debug-level enabled\n");
return count;
}
@@ -130,12 +92,11 @@ struct wilc_debugfs_info_t {
const char *name;
int perm;
unsigned int data;
- struct file_operations fops;
+ 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), },
- { "wilc_debug_region", 0666, (INIT_DBG | GENERIC_DBG | CFG80211_DBG), FOPS(NULL, wilc_debug_region_read, wilc_debug_region_write, NULL), },
};
static int __init wilc_debugfs_init(void)