aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/debugfs.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-17 23:48:31 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:07:49 -0500
commit3fbe104cecdb8c812976fdb0cc41be65491b85ee (patch)
tree768ab4fb16f26289f0ad5dc6d413fc5a0cf1eaf5 /drivers/net/wireless/libertas/debugfs.c
parent6e5cc4fb35c45a8f8478d25c4e89e8d9c543056e (diff)
libertas: convert SLEEP_PARAMS to a direct command
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/debugfs.c')
-rw-r--r--drivers/net/wireless/libertas/debugfs.c66
1 files changed, 30 insertions, 36 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index f27815967142..44be3929c027 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -10,6 +10,7 @@
10#include "decl.h" 10#include "decl.h"
11#include "host.h" 11#include "host.h"
12#include "debugfs.h" 12#include "debugfs.h"
13#include "cmd.h"
13 14
14static struct dentry *lbs_dir; 15static struct dentry *lbs_dir;
15static char *szStates[] = { 16static char *szStates[] = {
@@ -103,71 +104,64 @@ static ssize_t lbs_sleepparams_write(struct file *file,
103 loff_t *ppos) 104 loff_t *ppos)
104{ 105{
105 struct lbs_private *priv = file->private_data; 106 struct lbs_private *priv = file->private_data;
106 ssize_t buf_size, res; 107 ssize_t buf_size, ret;
108 struct sleep_params sp;
107 int p1, p2, p3, p4, p5, p6; 109 int p1, p2, p3, p4, p5, p6;
108 unsigned long addr = get_zeroed_page(GFP_KERNEL); 110 unsigned long addr = get_zeroed_page(GFP_KERNEL);
109 char *buf = (char *)addr; 111 char *buf = (char *)addr;
110 112
111 buf_size = min(count, len - 1); 113 buf_size = min(count, len - 1);
112 if (copy_from_user(buf, user_buf, buf_size)) { 114 if (copy_from_user(buf, user_buf, buf_size)) {
113 res = -EFAULT; 115 ret = -EFAULT;
114 goto out_unlock; 116 goto out_unlock;
115 } 117 }
116 res = sscanf(buf, "%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &p5, &p6); 118 ret = sscanf(buf, "%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &p5, &p6);
117 if (res != 6) { 119 if (ret != 6) {
118 res = -EFAULT; 120 ret = -EINVAL;
119 goto out_unlock; 121 goto out_unlock;
120 } 122 }
121 priv->sp.sp_error = p1; 123 sp.sp_error = p1;
122 priv->sp.sp_offset = p2; 124 sp.sp_offset = p2;
123 priv->sp.sp_stabletime = p3; 125 sp.sp_stabletime = p3;
124 priv->sp.sp_calcontrol = p4; 126 sp.sp_calcontrol = p4;
125 priv->sp.sp_extsleepclk = p5; 127 sp.sp_extsleepclk = p5;
126 priv->sp.sp_reserved = p6; 128 sp.sp_reserved = p6;
127 129
128 res = lbs_prepare_and_send_command(priv, 130 ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_SET, &sp);
129 CMD_802_11_SLEEP_PARAMS, 131 if (!ret)
130 CMD_ACT_SET, 132 ret = count;
131 CMD_OPTION_WAITFORRSP, 0, NULL); 133 else if (ret > 0)
132 134 ret = -EINVAL;
133 if (!res)
134 res = count;
135 else
136 res = -EINVAL;
137 135
138out_unlock: 136out_unlock:
139 free_page(addr); 137 free_page(addr);
140 return res; 138 return ret;
141} 139}
142 140
143static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, 141static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf,
144 size_t count, loff_t *ppos) 142 size_t count, loff_t *ppos)
145{ 143{
146 struct lbs_private *priv = file->private_data; 144 struct lbs_private *priv = file->private_data;
147 ssize_t res; 145 ssize_t ret;
148 size_t pos = 0; 146 size_t pos = 0;
147 struct sleep_params sp;
149 unsigned long addr = get_zeroed_page(GFP_KERNEL); 148 unsigned long addr = get_zeroed_page(GFP_KERNEL);
150 char *buf = (char *)addr; 149 char *buf = (char *)addr;
151 150
152 res = lbs_prepare_and_send_command(priv, 151 ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_GET, &sp);
153 CMD_802_11_SLEEP_PARAMS, 152 if (ret)
154 CMD_ACT_GET,
155 CMD_OPTION_WAITFORRSP, 0, NULL);
156 if (res) {
157 res = -EFAULT;
158 goto out_unlock; 153 goto out_unlock;
159 }
160 154
161 pos += snprintf(buf, len, "%d %d %d %d %d %d\n", priv->sp.sp_error, 155 pos += snprintf(buf, len, "%d %d %d %d %d %d\n", sp.sp_error,
162 priv->sp.sp_offset, priv->sp.sp_stabletime, 156 sp.sp_offset, sp.sp_stabletime,
163 priv->sp.sp_calcontrol, priv->sp.sp_extsleepclk, 157 sp.sp_calcontrol, sp.sp_extsleepclk,
164 priv->sp.sp_reserved); 158 sp.sp_reserved);
165 159
166 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); 160 ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
167 161
168out_unlock: 162out_unlock:
169 free_page(addr); 163 free_page(addr);
170 return res; 164 return ret;
171} 165}
172 166
173static ssize_t lbs_extscan(struct file *file, const char __user *userbuf, 167static ssize_t lbs_extscan(struct file *file, const char __user *userbuf,