aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-08 13:29:16 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:06:18 -0500
commite7deced05f15693cca71bfae747b8d57eadeb1b2 (patch)
tree3eedb1d58e5645b800d9d4a51f08042f26677866 /drivers
parent59f3e4bf1e3bc385d91a993d75865f99baa0486d (diff)
libertas: fix lbs_rtap attribute in sysfs
At least it doesn't oops when you attempt to read or write it now. Only when you enable it and then later turn it off. And when it's enabled I don't see how it actually works. But one fewer oops is good, for now... Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/libertas/dev.h2
-rw-r--r--drivers/net/wireless/libertas/main.c18
2 files changed, 6 insertions, 14 deletions
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index fb26f18e446e..5cb29235fee3 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -143,8 +143,6 @@ struct lbs_private {
143 all other bits reserved 0 */ 143 all other bits reserved 0 */
144 u8 dnld_sent; 144 u8 dnld_sent;
145 145
146 struct device *hotplug_device;
147
148 /** thread to service interrupts */ 146 /** thread to service interrupts */
149 struct task_struct *main_thread; 147 struct task_struct *main_thread;
150 wait_queue_head_t waitq; 148 wait_queue_head_t waitq;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index f595664f98cc..d03a2f8710fb 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -256,8 +256,7 @@ void lbs_remove_rtap(struct lbs_private *priv);
256static ssize_t lbs_rtap_get(struct device *dev, 256static ssize_t lbs_rtap_get(struct device *dev,
257 struct device_attribute *attr, char * buf) 257 struct device_attribute *attr, char * buf)
258{ 258{
259 struct lbs_private *priv = (struct lbs_private *) 259 struct lbs_private *priv = to_net_dev(dev)->priv;
260 (to_net_dev(dev))->priv;
261 struct lbs_adapter *adapter = priv->adapter; 260 struct lbs_adapter *adapter = priv->adapter;
262 return snprintf(buf, 5, "0x%X\n", adapter->monitormode); 261 return snprintf(buf, 5, "0x%X\n", adapter->monitormode);
263} 262}
@@ -269,8 +268,7 @@ static ssize_t lbs_rtap_set(struct device *dev,
269 struct device_attribute *attr, const char * buf, size_t count) 268 struct device_attribute *attr, const char * buf, size_t count)
270{ 269{
271 int monitor_mode; 270 int monitor_mode;
272 struct lbs_private *priv = (struct lbs_private *) 271 struct lbs_private *priv = to_net_dev(dev)->priv;
273 (to_net_dev(dev))->priv;
274 struct lbs_adapter *adapter = priv->adapter; 272 struct lbs_adapter *adapter = priv->adapter;
275 273
276 sscanf(buf, "%x", &monitor_mode); 274 sscanf(buf, "%x", &monitor_mode);
@@ -1158,7 +1156,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
1158 priv->card = card; 1156 priv->card = card;
1159 priv->mesh_open = 0; 1157 priv->mesh_open = 0;
1160 priv->infra_open = 0; 1158 priv->infra_open = 0;
1161 priv->hotplug_device = dmdev;
1162 1159
1163 /* Setup the OS Interface to our functions */ 1160 /* Setup the OS Interface to our functions */
1164 dev->open = lbs_open; 1161 dev->open = lbs_open;
@@ -1178,15 +1175,13 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
1178 SET_NETDEV_DEV(dev, dmdev); 1175 SET_NETDEV_DEV(dev, dmdev);
1179 1176
1180 priv->rtap_net_dev = NULL; 1177 priv->rtap_net_dev = NULL;
1181 if (device_create_file(dmdev, &dev_attr_lbs_rtap))
1182 goto err_init_adapter;
1183 1178
1184 lbs_deb_thread("Starting main thread...\n"); 1179 lbs_deb_thread("Starting main thread...\n");
1185 init_waitqueue_head(&priv->waitq); 1180 init_waitqueue_head(&priv->waitq);
1186 priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main"); 1181 priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main");
1187 if (IS_ERR(priv->main_thread)) { 1182 if (IS_ERR(priv->main_thread)) {
1188 lbs_deb_thread("Error creating main thread.\n"); 1183 lbs_deb_thread("Error creating main thread.\n");
1189 goto err_kthread_run; 1184 goto err_init_adapter;
1190 } 1185 }
1191 1186
1192 priv->work_thread = create_singlethread_workqueue("lbs_worker"); 1187 priv->work_thread = create_singlethread_workqueue("lbs_worker");
@@ -1196,9 +1191,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
1196 1191
1197 goto done; 1192 goto done;
1198 1193
1199err_kthread_run:
1200 device_remove_file(dmdev, &dev_attr_lbs_rtap);
1201
1202err_init_adapter: 1194err_init_adapter:
1203 lbs_free_adapter(priv); 1195 lbs_free_adapter(priv);
1204 1196
@@ -1224,7 +1216,7 @@ int lbs_remove_card(struct lbs_private *priv)
1224 lbs_remove_rtap(priv); 1216 lbs_remove_rtap(priv);
1225 1217
1226 dev = priv->dev; 1218 dev = priv->dev;
1227 device_remove_file(priv->hotplug_device, &dev_attr_lbs_rtap); 1219 device_remove_file(&dev->dev, &dev_attr_lbs_rtap);
1228 1220
1229 cancel_delayed_work(&priv->scan_work); 1221 cancel_delayed_work(&priv->scan_work);
1230 cancel_delayed_work(&priv->assoc_work); 1222 cancel_delayed_work(&priv->assoc_work);
@@ -1273,6 +1265,8 @@ int lbs_start_card(struct lbs_private *priv)
1273 lbs_pr_err("cannot register ethX device\n"); 1265 lbs_pr_err("cannot register ethX device\n");
1274 goto done; 1266 goto done;
1275 } 1267 }
1268 if (device_create_file(&dev->dev, &dev_attr_lbs_rtap))
1269 lbs_pr_err("cannot register lbs_rtap attribute\n");
1276 1270
1277 lbs_debugfs_init_one(priv, dev); 1271 lbs_debugfs_init_one(priv, dev);
1278 1272