Skip to content

Commit

Permalink
wl12xx: add beacon_filtering debugfs file
Browse files Browse the repository at this point in the history
Allow enabling/disabling beacon_filtering by debugfs,
in order to reduce the log size while debugging (beacon
filtering is disabled by default in AP mode, as beacons
are needed for ERP configuration).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information
Eliad Peller authored and Luciano Coelho committed Sep 14, 2011
1 parent 2a5bff0 commit a0a5215
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions drivers/net/wireless/wl12xx/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,47 @@ static const struct file_operations rx_streaming_always_ops = {
.llseek = default_llseek,
};

static ssize_t beacon_filtering_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;
char buf[10];
size_t len;
unsigned long value;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';

ret = kstrtoul(buf, 0, &value);
if (ret < 0) {
wl1271_warning("illegal value for beacon_filtering!");
return -EINVAL;
}

mutex_lock(&wl->mutex);

ret = wl1271_ps_elp_wakeup(wl);
if (ret < 0)
goto out;

ret = wl1271_acx_beacon_filter_opt(wl, !!value);

wl1271_ps_elp_sleep(wl);
out:
mutex_unlock(&wl->mutex);
return count;
}

static const struct file_operations beacon_filtering_ops = {
.write = beacon_filtering_write,
.open = wl1271_open_file_generic,
.llseek = default_llseek,
};

static int wl1271_debugfs_add_files(struct wl1271 *wl,
struct dentry *rootdir)
{
Expand Down Expand Up @@ -767,6 +808,7 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl,
DEBUGFS_ADD(driver_state, rootdir);
DEBUGFS_ADD(dtim_interval, rootdir);
DEBUGFS_ADD(beacon_interval, rootdir);
DEBUGFS_ADD(beacon_filtering, rootdir);

streaming = debugfs_create_dir("rx_streaming", rootdir);
if (!streaming || IS_ERR(streaming))
Expand Down

0 comments on commit a0a5215

Please sign in to comment.