Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278974
b: refs/heads/master
c: c99f895
h: refs/heads/master
v: v3
  • Loading branch information
Luciano Coelho committed Dec 15, 2011
1 parent d0ed053 commit 84b8601
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ef1870673dc3b66d8daec2b1fd1048992440e0e5
refs/heads/master: c99f895a231b2dfeedd27e4d218a1b2d22cf4d02
16 changes: 13 additions & 3 deletions trunk/drivers/net/wireless/wl12xx/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,19 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
{
struct wl1271 *wl = file->private_data;
int res = 0;
char buf[1024];
ssize_t ret;
char *buf;

#define DRIVER_STATE_BUF_LEN 1024

buf = kmalloc(DRIVER_STATE_BUF_LEN, GFP_KERNEL);
if (!buf)
return -ENOMEM;

mutex_lock(&wl->mutex);

#define DRIVER_STATE_PRINT(x, fmt) \
(res += scnprintf(buf + res, sizeof(buf) - res,\
(res += scnprintf(buf + res, DRIVER_STATE_BUF_LEN - res,\
#x " = " fmt "\n", wl->x))

#define DRIVER_STATE_PRINT_LONG(x) DRIVER_STATE_PRINT(x, "%ld")
Expand Down Expand Up @@ -373,10 +380,13 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
#undef DRIVER_STATE_PRINT_LHEX
#undef DRIVER_STATE_PRINT_STR
#undef DRIVER_STATE_PRINT
#undef DRIVER_STATE_BUF_LEN

mutex_unlock(&wl->mutex);

return simple_read_from_buffer(user_buf, count, ppos, buf, res);
ret = simple_read_from_buffer(user_buf, count, ppos, buf, res);
kfree(buf);
return ret;
}

static const struct file_operations driver_state_ops = {
Expand Down

0 comments on commit 84b8601

Please sign in to comment.