aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/airo.c116
-rw-r--r--drivers/net/wireless/ath/wil6210/debugfs.c4
-rw-r--r--drivers/net/wireless/atmel.c69
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c375
-rw-r--r--drivers/net/wireless/hostap/hostap_download.c68
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c38
-rw-r--r--drivers/net/wireless/hostap/hostap_proc.c609
-rw-r--r--drivers/net/wireless/hostap/hostap_wlan.h3
-rw-r--r--drivers/net/wireless/ray_cs.c2
9 files changed, 698 insertions, 586 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 53295418f576..6125adb520a3 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -4506,108 +4506,75 @@ static int setup_proc_entry( struct net_device *dev,
4506 apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm, 4506 apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm,
4507 airo_entry); 4507 airo_entry);
4508 if (!apriv->proc_entry) 4508 if (!apriv->proc_entry)
4509 goto fail; 4509 return -ENOMEM;
4510 apriv->proc_entry->uid = proc_kuid; 4510 proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid);
4511 apriv->proc_entry->gid = proc_kgid;
4512 4511
4513 /* Setup the StatsDelta */ 4512 /* Setup the StatsDelta */
4514 entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm, 4513 entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm,
4515 apriv->proc_entry, &proc_statsdelta_ops, dev); 4514 apriv->proc_entry, &proc_statsdelta_ops, dev);
4516 if (!entry) 4515 if (!entry)
4517 goto fail_stats_delta; 4516 goto fail;
4518 entry->uid = proc_kuid; 4517 proc_set_user(entry, proc_kuid, proc_kgid);
4519 entry->gid = proc_kgid;
4520 4518
4521 /* Setup the Stats */ 4519 /* Setup the Stats */
4522 entry = proc_create_data("Stats", S_IRUGO & proc_perm, 4520 entry = proc_create_data("Stats", S_IRUGO & proc_perm,
4523 apriv->proc_entry, &proc_stats_ops, dev); 4521 apriv->proc_entry, &proc_stats_ops, dev);
4524 if (!entry) 4522 if (!entry)
4525 goto fail_stats; 4523 goto fail;
4526 entry->uid = proc_kuid; 4524 proc_set_user(entry, proc_kuid, proc_kgid);
4527 entry->gid = proc_kgid;
4528 4525
4529 /* Setup the Status */ 4526 /* Setup the Status */
4530 entry = proc_create_data("Status", S_IRUGO & proc_perm, 4527 entry = proc_create_data("Status", S_IRUGO & proc_perm,
4531 apriv->proc_entry, &proc_status_ops, dev); 4528 apriv->proc_entry, &proc_status_ops, dev);
4532 if (!entry) 4529 if (!entry)
4533 goto fail_status; 4530 goto fail;
4534 entry->uid = proc_kuid; 4531 proc_set_user(entry, proc_kuid, proc_kgid);
4535 entry->gid = proc_kgid;
4536 4532
4537 /* Setup the Config */ 4533 /* Setup the Config */
4538 entry = proc_create_data("Config", proc_perm, 4534 entry = proc_create_data("Config", proc_perm,
4539 apriv->proc_entry, &proc_config_ops, dev); 4535 apriv->proc_entry, &proc_config_ops, dev);
4540 if (!entry) 4536 if (!entry)
4541 goto fail_config; 4537 goto fail;
4542 entry->uid = proc_kuid; 4538 proc_set_user(entry, proc_kuid, proc_kgid);
4543 entry->gid = proc_kgid;
4544 4539
4545 /* Setup the SSID */ 4540 /* Setup the SSID */
4546 entry = proc_create_data("SSID", proc_perm, 4541 entry = proc_create_data("SSID", proc_perm,
4547 apriv->proc_entry, &proc_SSID_ops, dev); 4542 apriv->proc_entry, &proc_SSID_ops, dev);
4548 if (!entry) 4543 if (!entry)
4549 goto fail_ssid; 4544 goto fail;
4550 entry->uid = proc_kuid; 4545 proc_set_user(entry, proc_kuid, proc_kgid);
4551 entry->gid = proc_kgid;
4552 4546
4553 /* Setup the APList */ 4547 /* Setup the APList */
4554 entry = proc_create_data("APList", proc_perm, 4548 entry = proc_create_data("APList", proc_perm,
4555 apriv->proc_entry, &proc_APList_ops, dev); 4549 apriv->proc_entry, &proc_APList_ops, dev);
4556 if (!entry) 4550 if (!entry)
4557 goto fail_aplist; 4551 goto fail;
4558 entry->uid = proc_kuid; 4552 proc_set_user(entry, proc_kuid, proc_kgid);
4559 entry->gid = proc_kgid;
4560 4553
4561 /* Setup the BSSList */ 4554 /* Setup the BSSList */
4562 entry = proc_create_data("BSSList", proc_perm, 4555 entry = proc_create_data("BSSList", proc_perm,
4563 apriv->proc_entry, &proc_BSSList_ops, dev); 4556 apriv->proc_entry, &proc_BSSList_ops, dev);
4564 if (!entry) 4557 if (!entry)
4565 goto fail_bsslist; 4558 goto fail;
4566 entry->uid = proc_kuid; 4559 proc_set_user(entry, proc_kuid, proc_kgid);
4567 entry->gid = proc_kgid;
4568 4560
4569 /* Setup the WepKey */ 4561 /* Setup the WepKey */
4570 entry = proc_create_data("WepKey", proc_perm, 4562 entry = proc_create_data("WepKey", proc_perm,
4571 apriv->proc_entry, &proc_wepkey_ops, dev); 4563 apriv->proc_entry, &proc_wepkey_ops, dev);
4572 if (!entry) 4564 if (!entry)
4573 goto fail_wepkey; 4565 goto fail;
4574 entry->uid = proc_kuid; 4566 proc_set_user(entry, proc_kuid, proc_kgid);
4575 entry->gid = proc_kgid;
4576
4577 return 0; 4567 return 0;
4578 4568
4579fail_wepkey:
4580 remove_proc_entry("BSSList", apriv->proc_entry);
4581fail_bsslist:
4582 remove_proc_entry("APList", apriv->proc_entry);
4583fail_aplist:
4584 remove_proc_entry("SSID", apriv->proc_entry);
4585fail_ssid:
4586 remove_proc_entry("Config", apriv->proc_entry);
4587fail_config:
4588 remove_proc_entry("Status", apriv->proc_entry);
4589fail_status:
4590 remove_proc_entry("Stats", apriv->proc_entry);
4591fail_stats:
4592 remove_proc_entry("StatsDelta", apriv->proc_entry);
4593fail_stats_delta:
4594 remove_proc_entry(apriv->proc_name, airo_entry);
4595fail: 4569fail:
4570 remove_proc_subtree(apriv->proc_name, airo_entry);
4596 return -ENOMEM; 4571 return -ENOMEM;
4597} 4572}
4598 4573
4599static int takedown_proc_entry( struct net_device *dev, 4574static int takedown_proc_entry( struct net_device *dev,
4600 struct airo_info *apriv ) { 4575 struct airo_info *apriv )
4601 if ( !apriv->proc_entry->namelen ) return 0; 4576{
4602 remove_proc_entry("Stats",apriv->proc_entry); 4577 remove_proc_subtree(apriv->proc_name, airo_entry);
4603 remove_proc_entry("StatsDelta",apriv->proc_entry);
4604 remove_proc_entry("Status",apriv->proc_entry);
4605 remove_proc_entry("Config",apriv->proc_entry);
4606 remove_proc_entry("SSID",apriv->proc_entry);
4607 remove_proc_entry("APList",apriv->proc_entry);
4608 remove_proc_entry("BSSList",apriv->proc_entry);
4609 remove_proc_entry("WepKey",apriv->proc_entry);
4610 remove_proc_entry(apriv->proc_name,airo_entry);
4611 return 0; 4578 return 0;
4612} 4579}
4613 4580
@@ -4663,8 +4630,7 @@ static ssize_t proc_write( struct file *file,
4663static int proc_status_open(struct inode *inode, struct file *file) 4630static int proc_status_open(struct inode *inode, struct file *file)
4664{ 4631{
4665 struct proc_data *data; 4632 struct proc_data *data;
4666 struct proc_dir_entry *dp = PDE(inode); 4633 struct net_device *dev = PDE_DATA(inode);
4667 struct net_device *dev = dp->data;
4668 struct airo_info *apriv = dev->ml_priv; 4634 struct airo_info *apriv = dev->ml_priv;
4669 CapabilityRid cap_rid; 4635 CapabilityRid cap_rid;
4670 StatusRid status_rid; 4636 StatusRid status_rid;
@@ -4746,8 +4712,7 @@ static int proc_stats_rid_open( struct inode *inode,
4746 u16 rid ) 4712 u16 rid )
4747{ 4713{
4748 struct proc_data *data; 4714 struct proc_data *data;
4749 struct proc_dir_entry *dp = PDE(inode); 4715 struct net_device *dev = PDE_DATA(inode);
4750 struct net_device *dev = dp->data;
4751 struct airo_info *apriv = dev->ml_priv; 4716 struct airo_info *apriv = dev->ml_priv;
4752 StatsRid stats; 4717 StatsRid stats;
4753 int i, j; 4718 int i, j;
@@ -4809,8 +4774,7 @@ static inline int sniffing_mode(struct airo_info *ai)
4809static void proc_config_on_close(struct inode *inode, struct file *file) 4774static void proc_config_on_close(struct inode *inode, struct file *file)
4810{ 4775{
4811 struct proc_data *data = file->private_data; 4776 struct proc_data *data = file->private_data;
4812 struct proc_dir_entry *dp = PDE(inode); 4777 struct net_device *dev = PDE_DATA(inode);
4813 struct net_device *dev = dp->data;
4814 struct airo_info *ai = dev->ml_priv; 4778 struct airo_info *ai = dev->ml_priv;
4815 char *line; 4779 char *line;
4816 4780
@@ -5021,8 +4985,7 @@ static const char *get_rmode(__le16 mode)
5021static int proc_config_open(struct inode *inode, struct file *file) 4985static int proc_config_open(struct inode *inode, struct file *file)
5022{ 4986{
5023 struct proc_data *data; 4987 struct proc_data *data;
5024 struct proc_dir_entry *dp = PDE(inode); 4988 struct net_device *dev = PDE_DATA(inode);
5025 struct net_device *dev = dp->data;
5026 struct airo_info *ai = dev->ml_priv; 4989 struct airo_info *ai = dev->ml_priv;
5027 int i; 4990 int i;
5028 __le16 mode; 4991 __le16 mode;
@@ -5112,8 +5075,7 @@ static int proc_config_open(struct inode *inode, struct file *file)
5112static void proc_SSID_on_close(struct inode *inode, struct file *file) 5075static void proc_SSID_on_close(struct inode *inode, struct file *file)
5113{ 5076{
5114 struct proc_data *data = file->private_data; 5077 struct proc_data *data = file->private_data;
5115 struct proc_dir_entry *dp = PDE(inode); 5078 struct net_device *dev = PDE_DATA(inode);
5116 struct net_device *dev = dp->data;
5117 struct airo_info *ai = dev->ml_priv; 5079 struct airo_info *ai = dev->ml_priv;
5118 SsidRid SSID_rid; 5080 SsidRid SSID_rid;
5119 int i; 5081 int i;
@@ -5148,8 +5110,7 @@ static void proc_SSID_on_close(struct inode *inode, struct file *file)
5148 5110
5149static void proc_APList_on_close( struct inode *inode, struct file *file ) { 5111static void proc_APList_on_close( struct inode *inode, struct file *file ) {
5150 struct proc_data *data = file->private_data; 5112 struct proc_data *data = file->private_data;
5151 struct proc_dir_entry *dp = PDE(inode); 5113 struct net_device *dev = PDE_DATA(inode);
5152 struct net_device *dev = dp->data;
5153 struct airo_info *ai = dev->ml_priv; 5114 struct airo_info *ai = dev->ml_priv;
5154 APListRid APList_rid; 5115 APListRid APList_rid;
5155 int i; 5116 int i;
@@ -5283,8 +5244,7 @@ static int set_wep_tx_idx(struct airo_info *ai, u16 index, int perm, int lock)
5283 5244
5284static void proc_wepkey_on_close( struct inode *inode, struct file *file ) { 5245static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
5285 struct proc_data *data; 5246 struct proc_data *data;
5286 struct proc_dir_entry *dp = PDE(inode); 5247 struct net_device *dev = PDE_DATA(inode);
5287 struct net_device *dev = dp->data;
5288 struct airo_info *ai = dev->ml_priv; 5248 struct airo_info *ai = dev->ml_priv;
5289 int i, rc; 5249 int i, rc;
5290 char key[16]; 5250 char key[16];
@@ -5335,8 +5295,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
5335static int proc_wepkey_open( struct inode *inode, struct file *file ) 5295static int proc_wepkey_open( struct inode *inode, struct file *file )
5336{ 5296{
5337 struct proc_data *data; 5297 struct proc_data *data;
5338 struct proc_dir_entry *dp = PDE(inode); 5298 struct net_device *dev = PDE_DATA(inode);
5339 struct net_device *dev = dp->data;
5340 struct airo_info *ai = dev->ml_priv; 5299 struct airo_info *ai = dev->ml_priv;
5341 char *ptr; 5300 char *ptr;
5342 WepKeyRid wkr; 5301 WepKeyRid wkr;
@@ -5384,8 +5343,7 @@ static int proc_wepkey_open( struct inode *inode, struct file *file )
5384static int proc_SSID_open(struct inode *inode, struct file *file) 5343static int proc_SSID_open(struct inode *inode, struct file *file)
5385{ 5344{
5386 struct proc_data *data; 5345 struct proc_data *data;
5387 struct proc_dir_entry *dp = PDE(inode); 5346 struct net_device *dev = PDE_DATA(inode);
5388 struct net_device *dev = dp->data;
5389 struct airo_info *ai = dev->ml_priv; 5347 struct airo_info *ai = dev->ml_priv;
5390 int i; 5348 int i;
5391 char *ptr; 5349 char *ptr;
@@ -5428,8 +5386,7 @@ static int proc_SSID_open(struct inode *inode, struct file *file)
5428 5386
5429static int proc_APList_open( struct inode *inode, struct file *file ) { 5387static int proc_APList_open( struct inode *inode, struct file *file ) {
5430 struct proc_data *data; 5388 struct proc_data *data;
5431 struct proc_dir_entry *dp = PDE(inode); 5389 struct net_device *dev = PDE_DATA(inode);
5432 struct net_device *dev = dp->data;
5433 struct airo_info *ai = dev->ml_priv; 5390 struct airo_info *ai = dev->ml_priv;
5434 int i; 5391 int i;
5435 char *ptr; 5392 char *ptr;
@@ -5468,8 +5425,7 @@ static int proc_APList_open( struct inode *inode, struct file *file ) {
5468 5425
5469static int proc_BSSList_open( struct inode *inode, struct file *file ) { 5426static int proc_BSSList_open( struct inode *inode, struct file *file ) {
5470 struct proc_data *data; 5427 struct proc_data *data;
5471 struct proc_dir_entry *dp = PDE(inode); 5428 struct net_device *dev = PDE_DATA(inode);
5472 struct net_device *dev = dp->data;
5473 struct airo_info *ai = dev->ml_priv; 5429 struct airo_info *ai = dev->ml_priv;
5474 char *ptr; 5430 char *ptr;
5475 BSSListRid BSSList_rid; 5431 BSSListRid BSSList_rid;
@@ -5706,10 +5662,8 @@ static int __init airo_init_module( void )
5706 5662
5707 airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL); 5663 airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL);
5708 5664
5709 if (airo_entry) { 5665 if (airo_entry)
5710 airo_entry->uid = proc_kuid; 5666 proc_set_user(airo_entry, proc_kuid, proc_kgid);
5711 airo_entry->gid = proc_kgid;
5712 }
5713 5667
5714 for (i = 0; i < 4 && io[i] && irq[i]; i++) { 5668 for (i = 0; i < 4 && io[i] && irq[i]; i++) {
5715 airo_print_info("", "Trying to configure ISA adapter at irq=%d " 5669 airo_print_info("", "Trying to configure ISA adapter at irq=%d "
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 4be07f5e22b9..727b1f53e6ad 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -216,7 +216,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_iomem_x32, wil_debugfs_iomem_x32_get,
216 wil_debugfs_iomem_x32_set, "0x%08llx\n"); 216 wil_debugfs_iomem_x32_set, "0x%08llx\n");
217 217
218static struct dentry *wil_debugfs_create_iomem_x32(const char *name, 218static struct dentry *wil_debugfs_create_iomem_x32(const char *name,
219 mode_t mode, 219 umode_t mode,
220 struct dentry *parent, 220 struct dentry *parent,
221 void __iomem *value) 221 void __iomem *value)
222{ 222{
@@ -359,7 +359,7 @@ static const struct file_operations fops_ioblob = {
359 359
360static 360static
361struct dentry *wil_debugfs_create_ioblob(const char *name, 361struct dentry *wil_debugfs_create_ioblob(const char *name,
362 mode_t mode, 362 umode_t mode,
363 struct dentry *parent, 363 struct dentry *parent,
364 struct debugfs_blob_wrapper *blob) 364 struct debugfs_blob_wrapper *blob)
365{ 365{
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 4374079dfc2a..23a3498f14d4 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -63,6 +63,7 @@
63#include <net/iw_handler.h> 63#include <net/iw_handler.h>
64#include <linux/crc32.h> 64#include <linux/crc32.h>
65#include <linux/proc_fs.h> 65#include <linux/proc_fs.h>
66#include <linux/seq_file.h>
66#include <linux/device.h> 67#include <linux/device.h>
67#include <linux/moduleparam.h> 68#include <linux/moduleparam.h>
68#include <linux/firmware.h> 69#include <linux/firmware.h>
@@ -1409,30 +1410,28 @@ static int atmel_validate_channel(struct atmel_private *priv, int channel)
1409 return 0; 1410 return 0;
1410} 1411}
1411 1412
1412static int atmel_proc_output (char *buf, struct atmel_private *priv) 1413static int atmel_proc_show(struct seq_file *m, void *v)
1413{ 1414{
1415 struct atmel_private *priv = m->private;
1414 int i; 1416 int i;
1415 char *p = buf;
1416 char *s, *r, *c; 1417 char *s, *r, *c;
1417 1418
1418 p += sprintf(p, "Driver version:\t\t%d.%d\n", 1419 seq_printf(m, "Driver version:\t\t%d.%d\n", DRIVER_MAJOR, DRIVER_MINOR);
1419 DRIVER_MAJOR, DRIVER_MINOR);
1420 1420
1421 if (priv->station_state != STATION_STATE_DOWN) { 1421 if (priv->station_state != STATION_STATE_DOWN) {
1422 p += sprintf(p, "Firmware version:\t%d.%d build %d\n" 1422 seq_printf(m,
1423 "Firmware location:\t", 1423 "Firmware version:\t%d.%d build %d\n"
1424 priv->host_info.major_version, 1424 "Firmware location:\t",
1425 priv->host_info.minor_version, 1425 priv->host_info.major_version,
1426 priv->host_info.build_version); 1426 priv->host_info.minor_version,
1427 priv->host_info.build_version);
1427 1428
1428 if (priv->card_type != CARD_TYPE_EEPROM) 1429 if (priv->card_type != CARD_TYPE_EEPROM)
1429 p += sprintf(p, "on card\n"); 1430 seq_puts(m, "on card\n");
1430 else if (priv->firmware) 1431 else if (priv->firmware)
1431 p += sprintf(p, "%s loaded by host\n", 1432 seq_printf(m, "%s loaded by host\n", priv->firmware_id);
1432 priv->firmware_id);
1433 else 1433 else
1434 p += sprintf(p, "%s loaded by hotplug\n", 1434 seq_printf(m, "%s loaded by hotplug\n", priv->firmware_id);
1435 priv->firmware_id);
1436 1435
1437 switch (priv->card_type) { 1436 switch (priv->card_type) {
1438 case CARD_TYPE_PARALLEL_FLASH: 1437 case CARD_TYPE_PARALLEL_FLASH:
@@ -1453,12 +1452,12 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv)
1453 if (priv->reg_domain == channel_table[i].reg_domain) 1452 if (priv->reg_domain == channel_table[i].reg_domain)
1454 r = channel_table[i].name; 1453 r = channel_table[i].name;
1455 1454
1456 p += sprintf(p, "MAC memory type:\t%s\n", c); 1455 seq_printf(m, "MAC memory type:\t%s\n", c);
1457 p += sprintf(p, "Regulatory domain:\t%s\n", r); 1456 seq_printf(m, "Regulatory domain:\t%s\n", r);
1458 p += sprintf(p, "Host CRC checking:\t%s\n", 1457 seq_printf(m, "Host CRC checking:\t%s\n",
1459 priv->do_rx_crc ? "On" : "Off"); 1458 priv->do_rx_crc ? "On" : "Off");
1460 p += sprintf(p, "WPA-capable firmware:\t%s\n", 1459 seq_printf(m, "WPA-capable firmware:\t%s\n",
1461 priv->use_wpa ? "Yes" : "No"); 1460 priv->use_wpa ? "Yes" : "No");
1462 } 1461 }
1463 1462
1464 switch (priv->station_state) { 1463 switch (priv->station_state) {
@@ -1490,26 +1489,22 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv)
1490 s = "<unknown>"; 1489 s = "<unknown>";
1491 } 1490 }
1492 1491
1493 p += sprintf(p, "Current state:\t\t%s\n", s); 1492 seq_printf(m, "Current state:\t\t%s\n", s);
1494 return p - buf; 1493 return 0;
1495} 1494}
1496 1495
1497static int atmel_read_proc(char *page, char **start, off_t off, 1496static int atmel_proc_open(struct inode *inode, struct file *file)
1498 int count, int *eof, void *data)
1499{ 1497{
1500 struct atmel_private *priv = data; 1498 return single_open(file, atmel_proc_show, PDE_DATA(inode));
1501 int len = atmel_proc_output (page, priv);
1502 if (len <= off+count)
1503 *eof = 1;
1504 *start = page + off;
1505 len -= off;
1506 if (len > count)
1507 len = count;
1508 if (len < 0)
1509 len = 0;
1510 return len;
1511} 1499}
1512 1500
1501static const struct file_operations atmel_proc_fops = {
1502 .open = atmel_proc_open,
1503 .read = seq_read,
1504 .llseek = seq_lseek,
1505 .release = seq_release,
1506};
1507
1513static const struct net_device_ops atmel_netdev_ops = { 1508static const struct net_device_ops atmel_netdev_ops = {
1514 .ndo_open = atmel_open, 1509 .ndo_open = atmel_open,
1515 .ndo_stop = atmel_close, 1510 .ndo_stop = atmel_close,
@@ -1525,7 +1520,6 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
1525 struct device *sys_dev, 1520 struct device *sys_dev,
1526 int (*card_present)(void *), void *card) 1521 int (*card_present)(void *), void *card)
1527{ 1522{
1528 struct proc_dir_entry *ent;
1529 struct net_device *dev; 1523 struct net_device *dev;
1530 struct atmel_private *priv; 1524 struct atmel_private *priv;
1531 int rc; 1525 int rc;
@@ -1630,8 +1624,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
1630 1624
1631 netif_carrier_off(dev); 1625 netif_carrier_off(dev);
1632 1626
1633 ent = create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); 1627 if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv));
1634 if (!ent)
1635 printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); 1628 printk(KERN_WARNING "atmel: unable to create /proc entry.\n");
1636 1629
1637 printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", 1630 printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n",
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index dd9a18f8dbca..19c45e363aa7 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -17,6 +17,7 @@
17 */ 17 */
18 18
19#include <linux/proc_fs.h> 19#include <linux/proc_fs.h>
20#include <linux/seq_file.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
21#include <linux/random.h> 22#include <linux/random.h>
22#include <linux/if_arp.h> 23#include <linux/if_arp.h>
@@ -64,28 +65,32 @@ static void prism2_send_mgmt(struct net_device *dev,
64 65
65 66
66#ifndef PRISM2_NO_PROCFS_DEBUG 67#ifndef PRISM2_NO_PROCFS_DEBUG
67static int ap_debug_proc_read(char *page, char **start, off_t off, 68static int ap_debug_proc_show(struct seq_file *m, void *v)
68 int count, int *eof, void *data) 69{
69{ 70 struct ap_data *ap = m->private;
70 char *p = page; 71
71 struct ap_data *ap = (struct ap_data *) data; 72 seq_printf(m, "BridgedUnicastFrames=%u\n", ap->bridged_unicast);
72 73 seq_printf(m, "BridgedMulticastFrames=%u\n", ap->bridged_multicast);
73 if (off != 0) { 74 seq_printf(m, "max_inactivity=%u\n", ap->max_inactivity / HZ);
74 *eof = 1; 75 seq_printf(m, "bridge_packets=%u\n", ap->bridge_packets);
75 return 0; 76 seq_printf(m, "nullfunc_ack=%u\n", ap->nullfunc_ack);
76 } 77 seq_printf(m, "autom_ap_wds=%u\n", ap->autom_ap_wds);
77 78 seq_printf(m, "auth_algs=%u\n", ap->local->auth_algs);
78 p += sprintf(p, "BridgedUnicastFrames=%u\n", ap->bridged_unicast); 79 seq_printf(m, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc);
79 p += sprintf(p, "BridgedMulticastFrames=%u\n", ap->bridged_multicast); 80 return 0;
80 p += sprintf(p, "max_inactivity=%u\n", ap->max_inactivity / HZ); 81}
81 p += sprintf(p, "bridge_packets=%u\n", ap->bridge_packets);
82 p += sprintf(p, "nullfunc_ack=%u\n", ap->nullfunc_ack);
83 p += sprintf(p, "autom_ap_wds=%u\n", ap->autom_ap_wds);
84 p += sprintf(p, "auth_algs=%u\n", ap->local->auth_algs);
85 p += sprintf(p, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc);
86 82
87 return (p - page); 83static int ap_debug_proc_open(struct inode *inode, struct file *file)
84{
85 return single_open(file, ap_debug_proc_show, PDE_DATA(inode));
88} 86}
87
88static const struct file_operations ap_debug_proc_fops = {
89 .open = ap_debug_proc_open,
90 .read = seq_read,
91 .llseek = seq_lseek,
92 .release = seq_release,
93};
89#endif /* PRISM2_NO_PROCFS_DEBUG */ 94#endif /* PRISM2_NO_PROCFS_DEBUG */
90 95
91 96
@@ -325,50 +330,81 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap,
325} 330}
326 331
327 332
328static int ap_control_proc_read(char *page, char **start, off_t off, 333static int ap_control_proc_show(struct seq_file *m, void *v)
329 int count, int *eof, void *data)
330{ 334{
331 char *p = page; 335 struct ap_data *ap = m->private;
332 struct ap_data *ap = (struct ap_data *) data;
333 char *policy_txt; 336 char *policy_txt;
334 struct mac_entry *entry; 337 struct mac_entry *entry;
335 338
336 if (off != 0) { 339 if (v == SEQ_START_TOKEN) {
337 *eof = 1; 340 switch (ap->mac_restrictions.policy) {
341 case MAC_POLICY_OPEN:
342 policy_txt = "open";
343 break;
344 case MAC_POLICY_ALLOW:
345 policy_txt = "allow";
346 break;
347 case MAC_POLICY_DENY:
348 policy_txt = "deny";
349 break;
350 default:
351 policy_txt = "unknown";
352 break;
353 }
354 seq_printf(m, "MAC policy: %s\n", policy_txt);
355 seq_printf(m, "MAC entries: %u\n", ap->mac_restrictions.entries);
356 seq_puts(m, "MAC list:\n");
338 return 0; 357 return 0;
339 } 358 }
340 359
341 switch (ap->mac_restrictions.policy) { 360 entry = v;
342 case MAC_POLICY_OPEN: 361 seq_printf(m, "%pM\n", entry->addr);
343 policy_txt = "open"; 362 return 0;
344 break; 363}
345 case MAC_POLICY_ALLOW: 364
346 policy_txt = "allow"; 365static void *ap_control_proc_start(struct seq_file *m, loff_t *_pos)
347 break; 366{
348 case MAC_POLICY_DENY: 367 struct ap_data *ap = m->private;
349 policy_txt = "deny";
350 break;
351 default:
352 policy_txt = "unknown";
353 break;
354 }
355 p += sprintf(p, "MAC policy: %s\n", policy_txt);
356 p += sprintf(p, "MAC entries: %u\n", ap->mac_restrictions.entries);
357 p += sprintf(p, "MAC list:\n");
358 spin_lock_bh(&ap->mac_restrictions.lock); 368 spin_lock_bh(&ap->mac_restrictions.lock);
359 list_for_each_entry(entry, &ap->mac_restrictions.mac_list, list) { 369 return seq_list_start_head(&ap->mac_restrictions.mac_list, *_pos);
360 if (p - page > PAGE_SIZE - 80) { 370}
361 p += sprintf(p, "All entries did not fit one page.\n");
362 break;
363 }
364 371
365 p += sprintf(p, "%pM\n", entry->addr); 372static void *ap_control_proc_next(struct seq_file *m, void *v, loff_t *_pos)
366 } 373{
374 struct ap_data *ap = m->private;
375 return seq_list_next(v, &ap->mac_restrictions.mac_list, _pos);
376}
377
378static void ap_control_proc_stop(struct seq_file *m, void *v)
379{
380 struct ap_data *ap = m->private;
367 spin_unlock_bh(&ap->mac_restrictions.lock); 381 spin_unlock_bh(&ap->mac_restrictions.lock);
382}
368 383
369 return (p - page); 384static const struct seq_operations ap_control_proc_seqops = {
385 .start = ap_control_proc_start,
386 .next = ap_control_proc_next,
387 .stop = ap_control_proc_stop,
388 .show = ap_control_proc_show,
389};
390
391static int ap_control_proc_open(struct inode *inode, struct file *file)
392{
393 int ret = seq_open(file, &ap_control_proc_seqops);
394 if (ret == 0) {
395 struct seq_file *m = file->private_data;
396 m->private = PDE_DATA(inode);
397 }
398 return ret;
370} 399}
371 400
401static const struct file_operations ap_control_proc_fops = {
402 .open = ap_control_proc_open,
403 .read = seq_read,
404 .llseek = seq_lseek,
405 .release = seq_release,
406};
407
372 408
373int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac) 409int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac)
374{ 410{
@@ -510,61 +546,84 @@ void ap_control_kickall(struct ap_data *ap)
510 546
511#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 547#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
512 548
513#define PROC_LIMIT (PAGE_SIZE - 80) 549static int prism2_ap_proc_show(struct seq_file *m, void *v)
514
515static int prism2_ap_proc_read(char *page, char **start, off_t off,
516 int count, int *eof, void *data)
517{ 550{
518 char *p = page; 551 struct sta_info *sta = v;
519 struct ap_data *ap = (struct ap_data *) data;
520 struct sta_info *sta;
521 int i; 552 int i;
522 553
523 if (off > PROC_LIMIT) { 554 if (v == SEQ_START_TOKEN) {
524 *eof = 1; 555 seq_printf(m, "# BSSID CHAN SIGNAL NOISE RATE SSID FLAGS\n");
525 return 0; 556 return 0;
526 } 557 }
527 558
528 p += sprintf(p, "# BSSID CHAN SIGNAL NOISE RATE SSID FLAGS\n"); 559 if (!sta->ap)
529 spin_lock_bh(&ap->sta_table_lock); 560 return 0;
530 list_for_each_entry(sta, &ap->sta_list, list) {
531 if (!sta->ap)
532 continue;
533 561
534 p += sprintf(p, "%pM %d %d %d %d '", 562 seq_printf(m, "%pM %d %d %d %d '",
535 sta->addr, 563 sta->addr,
536 sta->u.ap.channel, sta->last_rx_signal, 564 sta->u.ap.channel, sta->last_rx_signal,
537 sta->last_rx_silence, sta->last_rx_rate); 565 sta->last_rx_silence, sta->last_rx_rate);
538 for (i = 0; i < sta->u.ap.ssid_len; i++)
539 p += sprintf(p, ((sta->u.ap.ssid[i] >= 32 &&
540 sta->u.ap.ssid[i] < 127) ?
541 "%c" : "<%02x>"),
542 sta->u.ap.ssid[i]);
543 p += sprintf(p, "'");
544 if (sta->capability & WLAN_CAPABILITY_ESS)
545 p += sprintf(p, " [ESS]");
546 if (sta->capability & WLAN_CAPABILITY_IBSS)
547 p += sprintf(p, " [IBSS]");
548 if (sta->capability & WLAN_CAPABILITY_PRIVACY)
549 p += sprintf(p, " [WEP]");
550 p += sprintf(p, "\n");
551
552 if ((p - page) > PROC_LIMIT) {
553 printk(KERN_DEBUG "hostap: ap proc did not fit\n");
554 break;
555 }
556 }
557 spin_unlock_bh(&ap->sta_table_lock);
558 566
559 if ((p - page) <= off) { 567 for (i = 0; i < sta->u.ap.ssid_len; i++) {
560 *eof = 1; 568 if (sta->u.ap.ssid[i] >= 32 && sta->u.ap.ssid[i] < 127)
561 return 0; 569 seq_putc(m, sta->u.ap.ssid[i]);
570 else
571 seq_printf(m, "<%02x>", sta->u.ap.ssid[i]);
562 } 572 }
563 573
564 *start = page + off; 574 seq_putc(m, '\'');
575 if (sta->capability & WLAN_CAPABILITY_ESS)
576 seq_puts(m, " [ESS]");
577 if (sta->capability & WLAN_CAPABILITY_IBSS)
578 seq_puts(m, " [IBSS]");
579 if (sta->capability & WLAN_CAPABILITY_PRIVACY)
580 seq_puts(m, " [WEP]");
581 seq_putc(m, '\n');
582 return 0;
583}
584
585static void *prism2_ap_proc_start(struct seq_file *m, loff_t *_pos)
586{
587 struct ap_data *ap = m->private;
588 spin_lock_bh(&ap->sta_table_lock);
589 return seq_list_start_head(&ap->sta_list, *_pos);
590}
565 591
566 return (p - page - off); 592static void *prism2_ap_proc_next(struct seq_file *m, void *v, loff_t *_pos)
593{
594 struct ap_data *ap = m->private;
595 return seq_list_next(v, &ap->sta_list, _pos);
567} 596}
597
598static void prism2_ap_proc_stop(struct seq_file *m, void *v)
599{
600 struct ap_data *ap = m->private;
601 spin_unlock_bh(&ap->sta_table_lock);
602}
603
604static const struct seq_operations prism2_ap_proc_seqops = {
605 .start = prism2_ap_proc_start,
606 .next = prism2_ap_proc_next,
607 .stop = prism2_ap_proc_stop,
608 .show = prism2_ap_proc_show,
609};
610
611static int prism2_ap_proc_open(struct inode *inode, struct file *file)
612{
613 int ret = seq_open(file, &prism2_ap_proc_seqops);
614 if (ret == 0) {
615 struct seq_file *m = file->private_data;
616 m->private = PDE_DATA(inode);
617 }
618 return ret;
619}
620
621static const struct file_operations prism2_ap_proc_fops = {
622 .open = prism2_ap_proc_open,
623 .read = seq_read,
624 .llseek = seq_lseek,
625 .release = seq_release,
626};
568#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 627#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
569 628
570 629
@@ -836,15 +895,12 @@ void hostap_init_ap_proc(local_info_t *local)
836 return; 895 return;
837 896
838#ifndef PRISM2_NO_PROCFS_DEBUG 897#ifndef PRISM2_NO_PROCFS_DEBUG
839 create_proc_read_entry("ap_debug", 0, ap->proc, 898 proc_create_data("ap_debug", 0, ap->proc, &ap_debug_proc_fops, ap);
840 ap_debug_proc_read, ap);
841#endif /* PRISM2_NO_PROCFS_DEBUG */ 899#endif /* PRISM2_NO_PROCFS_DEBUG */
842 900
843#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 901#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
844 create_proc_read_entry("ap_control", 0, ap->proc, 902 proc_create_data("ap_control", 0, ap->proc, &ap_control_proc_fops, ap);
845 ap_control_proc_read, ap); 903 proc_create_data("ap", 0, ap->proc, &prism2_ap_proc_fops, ap);
846 create_proc_read_entry("ap", 0, ap->proc,
847 prism2_ap_proc_read, ap);
848#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 904#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
849 905
850} 906}
@@ -982,79 +1038,86 @@ static void prism2_send_mgmt(struct net_device *dev,
982#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 1038#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
983 1039
984 1040
985static int prism2_sta_proc_read(char *page, char **start, off_t off, 1041static int prism2_sta_proc_show(struct seq_file *m, void *v)
986 int count, int *eof, void *data)
987{ 1042{
988 char *p = page; 1043 struct sta_info *sta = m->private;
989 struct sta_info *sta = (struct sta_info *) data;
990 int i; 1044 int i;
991 1045
992 /* FIX: possible race condition.. the STA data could have just expired, 1046 /* FIX: possible race condition.. the STA data could have just expired,
993 * but proc entry was still here so that the read could have started; 1047 * but proc entry was still here so that the read could have started;
994 * some locking should be done here.. */ 1048 * some locking should be done here.. */
995 1049
996 if (off != 0) { 1050 seq_printf(m,
997 *eof = 1; 1051 "%s=%pM\nusers=%d\naid=%d\n"
998 return 0; 1052 "flags=0x%04x%s%s%s%s%s%s%s\n"
999 } 1053 "capability=0x%02x\nlisten_interval=%d\nsupported_rates=",
1000 1054 sta->ap ? "AP" : "STA",
1001 p += sprintf(p, "%s=%pM\nusers=%d\naid=%d\n" 1055 sta->addr, atomic_read(&sta->users), sta->aid,
1002 "flags=0x%04x%s%s%s%s%s%s%s\n" 1056 sta->flags,
1003 "capability=0x%02x\nlisten_interval=%d\nsupported_rates=", 1057 sta->flags & WLAN_STA_AUTH ? " AUTH" : "",
1004 sta->ap ? "AP" : "STA", 1058 sta->flags & WLAN_STA_ASSOC ? " ASSOC" : "",
1005 sta->addr, atomic_read(&sta->users), sta->aid, 1059 sta->flags & WLAN_STA_PS ? " PS" : "",
1006 sta->flags, 1060 sta->flags & WLAN_STA_TIM ? " TIM" : "",
1007 sta->flags & WLAN_STA_AUTH ? " AUTH" : "", 1061 sta->flags & WLAN_STA_PERM ? " PERM" : "",
1008 sta->flags & WLAN_STA_ASSOC ? " ASSOC" : "", 1062 sta->flags & WLAN_STA_AUTHORIZED ? " AUTHORIZED" : "",
1009 sta->flags & WLAN_STA_PS ? " PS" : "", 1063 sta->flags & WLAN_STA_PENDING_POLL ? " POLL" : "",
1010 sta->flags & WLAN_STA_TIM ? " TIM" : "", 1064 sta->capability, sta->listen_interval);
1011 sta->flags & WLAN_STA_PERM ? " PERM" : "",
1012 sta->flags & WLAN_STA_AUTHORIZED ? " AUTHORIZED" : "",
1013 sta->flags & WLAN_STA_PENDING_POLL ? " POLL" : "",
1014 sta->capability, sta->listen_interval);
1015 /* supported_rates: 500 kbit/s units with msb ignored */ 1065 /* supported_rates: 500 kbit/s units with msb ignored */
1016 for (i = 0; i < sizeof(sta->supported_rates); i++) 1066 for (i = 0; i < sizeof(sta->supported_rates); i++)
1017 if (sta->supported_rates[i] != 0) 1067 if (sta->supported_rates[i] != 0)
1018 p += sprintf(p, "%d%sMbps ", 1068 seq_printf(m, "%d%sMbps ",
1019 (sta->supported_rates[i] & 0x7f) / 2, 1069 (sta->supported_rates[i] & 0x7f) / 2,
1020 sta->supported_rates[i] & 1 ? ".5" : ""); 1070 sta->supported_rates[i] & 1 ? ".5" : "");
1021 p += sprintf(p, "\njiffies=%lu\nlast_auth=%lu\nlast_assoc=%lu\n" 1071 seq_printf(m,
1022 "last_rx=%lu\nlast_tx=%lu\nrx_packets=%lu\n" 1072 "\njiffies=%lu\nlast_auth=%lu\nlast_assoc=%lu\n"
1023 "tx_packets=%lu\n" 1073 "last_rx=%lu\nlast_tx=%lu\nrx_packets=%lu\n"
1024 "rx_bytes=%lu\ntx_bytes=%lu\nbuffer_count=%d\n" 1074 "tx_packets=%lu\n"
1025 "last_rx: silence=%d dBm signal=%d dBm rate=%d%s Mbps\n" 1075 "rx_bytes=%lu\ntx_bytes=%lu\nbuffer_count=%d\n"
1026 "tx_rate=%d\ntx[1M]=%d\ntx[2M]=%d\ntx[5.5M]=%d\n" 1076 "last_rx: silence=%d dBm signal=%d dBm rate=%d%s Mbps\n"
1027 "tx[11M]=%d\n" 1077 "tx_rate=%d\ntx[1M]=%d\ntx[2M]=%d\ntx[5.5M]=%d\n"
1028 "rx[1M]=%d\nrx[2M]=%d\nrx[5.5M]=%d\nrx[11M]=%d\n", 1078 "tx[11M]=%d\n"
1029 jiffies, sta->last_auth, sta->last_assoc, sta->last_rx, 1079 "rx[1M]=%d\nrx[2M]=%d\nrx[5.5M]=%d\nrx[11M]=%d\n",
1030 sta->last_tx, 1080 jiffies, sta->last_auth, sta->last_assoc, sta->last_rx,
1031 sta->rx_packets, sta->tx_packets, sta->rx_bytes, 1081 sta->last_tx,
1032 sta->tx_bytes, skb_queue_len(&sta->tx_buf), 1082 sta->rx_packets, sta->tx_packets, sta->rx_bytes,
1033 sta->last_rx_silence, 1083 sta->tx_bytes, skb_queue_len(&sta->tx_buf),
1034 sta->last_rx_signal, sta->last_rx_rate / 10, 1084 sta->last_rx_silence,
1035 sta->last_rx_rate % 10 ? ".5" : "", 1085 sta->last_rx_signal, sta->last_rx_rate / 10,
1036 sta->tx_rate, sta->tx_count[0], sta->tx_count[1], 1086 sta->last_rx_rate % 10 ? ".5" : "",
1037 sta->tx_count[2], sta->tx_count[3], sta->rx_count[0], 1087 sta->tx_rate, sta->tx_count[0], sta->tx_count[1],
1038 sta->rx_count[1], sta->rx_count[2], sta->rx_count[3]); 1088 sta->tx_count[2], sta->tx_count[3], sta->rx_count[0],
1089 sta->rx_count[1], sta->rx_count[2], sta->rx_count[3]);
1039 if (sta->crypt && sta->crypt->ops && sta->crypt->ops->print_stats) 1090 if (sta->crypt && sta->crypt->ops && sta->crypt->ops->print_stats)
1040 p = sta->crypt->ops->print_stats(p, sta->crypt->priv); 1091 sta->crypt->ops->print_stats(m, sta->crypt->priv);
1041#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 1092#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
1042 if (sta->ap) { 1093 if (sta->ap) {
1043 if (sta->u.ap.channel >= 0) 1094 if (sta->u.ap.channel >= 0)
1044 p += sprintf(p, "channel=%d\n", sta->u.ap.channel); 1095 seq_printf(m, "channel=%d\n", sta->u.ap.channel);
1045 p += sprintf(p, "ssid="); 1096 seq_puts(m, "ssid=");
1046 for (i = 0; i < sta->u.ap.ssid_len; i++) 1097 for (i = 0; i < sta->u.ap.ssid_len; i++) {
1047 p += sprintf(p, ((sta->u.ap.ssid[i] >= 32 && 1098 if (sta->u.ap.ssid[i] >= 32 && sta->u.ap.ssid[i] < 127)
1048 sta->u.ap.ssid[i] < 127) ? 1099 seq_putc(m, sta->u.ap.ssid[i]);
1049 "%c" : "<%02x>"), 1100 else
1050 sta->u.ap.ssid[i]); 1101 seq_printf(m, "<%02x>", sta->u.ap.ssid[i]);
1051 p += sprintf(p, "\n"); 1102 }
1103 seq_putc(m, '\n');
1052 } 1104 }
1053#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 1105#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
1054 1106
1055 return (p - page); 1107 return 0;
1108}
1109
1110static int prism2_sta_proc_open(struct inode *inode, struct file *file)
1111{
1112 return single_open(file, prism2_sta_proc_show, PDE_DATA(inode));
1056} 1113}
1057 1114
1115static const struct file_operations prism2_sta_proc_fops = {
1116 .open = prism2_sta_proc_open,
1117 .read = seq_read,
1118 .llseek = seq_lseek,
1119 .release = seq_release,
1120};
1058 1121
1059static void handle_add_proc_queue(struct work_struct *work) 1122static void handle_add_proc_queue(struct work_struct *work)
1060{ 1123{
@@ -1076,9 +1139,9 @@ static void handle_add_proc_queue(struct work_struct *work)
1076 1139
1077 if (sta) { 1140 if (sta) {
1078 sprintf(name, "%pM", sta->addr); 1141 sprintf(name, "%pM", sta->addr);
1079 sta->proc = create_proc_read_entry( 1142 sta->proc = proc_create_data(
1080 name, 0, ap->proc, 1143 name, 0, ap->proc,
1081 prism2_sta_proc_read, sta); 1144 &prism2_sta_proc_fops, sta);
1082 1145
1083 atomic_dec(&sta->users); 1146 atomic_dec(&sta->users);
1084 } 1147 }
diff --git a/drivers/net/wireless/hostap/hostap_download.c b/drivers/net/wireless/hostap/hostap_download.c
index e73bf739fd9b..705fe668b969 100644
--- a/drivers/net/wireless/hostap/hostap_download.c
+++ b/drivers/net/wireless/hostap/hostap_download.c
@@ -174,20 +174,70 @@ static int prism2_pda_ok(u8 *buf)
174} 174}
175 175
176 176
177static int prism2_download_aux_dump(struct net_device *dev, 177#define prism2_download_aux_dump_npages 65536
178 unsigned int addr, int len, u8 *buf)
179{
180 int res;
181 178
182 prism2_enable_aux_port(dev, 1); 179struct prism2_download_aux_dump {
183 res = hfa384x_from_aux(dev, addr, len, buf); 180 local_info_t *local;
184 prism2_enable_aux_port(dev, 0); 181 u16 page[0x80];
185 if (res) 182};
186 return -1; 183
184static int prism2_download_aux_dump_proc_show(struct seq_file *m, void *v)
185{
186 struct prism2_download_aux_dump *ctx = m->private;
187 187
188 hfa384x_from_aux(ctx->local->dev, (unsigned long)v - 1, 0x80, ctx->page);
189 seq_write(m, ctx->page, 0x80);
188 return 0; 190 return 0;
189} 191}
190 192
193static void *prism2_download_aux_dump_proc_start(struct seq_file *m, loff_t *_pos)
194{
195 struct prism2_download_aux_dump *ctx = m->private;
196 prism2_enable_aux_port(ctx->local->dev, 1);
197 if (*_pos >= prism2_download_aux_dump_npages)
198 return NULL;
199 return (void *)((unsigned long)*_pos + 1);
200}
201
202static void *prism2_download_aux_dump_proc_next(struct seq_file *m, void *v, loff_t *_pos)
203{
204 ++*_pos;
205 if (*_pos >= prism2_download_aux_dump_npages)
206 return NULL;
207 return (void *)((unsigned long)*_pos + 1);
208}
209
210static void prism2_download_aux_dump_proc_stop(struct seq_file *m, void *v)
211{
212 struct prism2_download_aux_dump *ctx = m->private;
213 prism2_enable_aux_port(ctx->local->dev, 0);
214}
215
216static const struct seq_operations prism2_download_aux_dump_proc_seqops = {
217 .start = prism2_download_aux_dump_proc_start,
218 .next = prism2_download_aux_dump_proc_next,
219 .stop = prism2_download_aux_dump_proc_stop,
220 .show = prism2_download_aux_dump_proc_show,
221};
222
223static int prism2_download_aux_dump_proc_open(struct inode *inode, struct file *file)
224{
225 int ret = seq_open_private(file, &prism2_download_aux_dump_proc_seqops,
226 sizeof(struct prism2_download_aux_dump));
227 if (ret == 0) {
228 struct seq_file *m = file->private_data;
229 m->private = PDE_DATA(inode);
230 }
231 return ret;
232}
233
234static const struct file_operations prism2_download_aux_dump_proc_fops = {
235 .open = prism2_download_aux_dump_proc_open,
236 .read = seq_read,
237 .llseek = seq_lseek,
238 .release = seq_release_private,
239};
240
191 241
192static u8 * prism2_read_pda(struct net_device *dev) 242static u8 * prism2_read_pda(struct net_device *dev)
193{ 243{
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index 8e7000fd4414..507ab99eef4e 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -38,6 +38,7 @@
38#include <linux/netdevice.h> 38#include <linux/netdevice.h>
39#include <linux/etherdevice.h> 39#include <linux/etherdevice.h>
40#include <linux/proc_fs.h> 40#include <linux/proc_fs.h>
41#include <linux/seq_file.h>
41#include <linux/if_arp.h> 42#include <linux/if_arp.h>
42#include <linux/delay.h> 43#include <linux/delay.h>
43#include <linux/random.h> 44#include <linux/random.h>
@@ -129,8 +130,7 @@ static void prism2_check_sta_fw_version(local_info_t *local);
129 130
130#ifdef PRISM2_DOWNLOAD_SUPPORT 131#ifdef PRISM2_DOWNLOAD_SUPPORT
131/* hostap_download.c */ 132/* hostap_download.c */
132static int prism2_download_aux_dump(struct net_device *dev, 133static const struct file_operations prism2_download_aux_dump_proc_fops;
133 unsigned int addr, int len, u8 *buf);
134static u8 * prism2_read_pda(struct net_device *dev); 134static u8 * prism2_read_pda(struct net_device *dev);
135static int prism2_download(local_info_t *local, 135static int prism2_download(local_info_t *local,
136 struct prism2_download_param *param); 136 struct prism2_download_param *param);
@@ -2894,19 +2894,12 @@ static void hostap_tick_timer(unsigned long data)
2894 2894
2895 2895
2896#ifndef PRISM2_NO_PROCFS_DEBUG 2896#ifndef PRISM2_NO_PROCFS_DEBUG
2897static int prism2_registers_proc_read(char *page, char **start, off_t off, 2897static int prism2_registers_proc_show(struct seq_file *m, void *v)
2898 int count, int *eof, void *data)
2899{ 2898{
2900 char *p = page; 2899 local_info_t *local = m->private;
2901 local_info_t *local = (local_info_t *) data;
2902
2903 if (off != 0) {
2904 *eof = 1;
2905 return 0;
2906 }
2907 2900
2908#define SHOW_REG(n) \ 2901#define SHOW_REG(n) \
2909p += sprintf(p, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF)) 2902 seq_printf(m, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF))
2910 2903
2911 SHOW_REG(CMD); 2904 SHOW_REG(CMD);
2912 SHOW_REG(PARAM0); 2905 SHOW_REG(PARAM0);
@@ -2952,8 +2945,21 @@ p += sprintf(p, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF))
2952 SHOW_REG(PCI_M1_CTL); 2945 SHOW_REG(PCI_M1_CTL);
2953#endif /* PRISM2_PCI */ 2946#endif /* PRISM2_PCI */
2954 2947
2955 return (p - page); 2948 return 0;
2956} 2949}
2950
2951static int prism2_registers_proc_open(struct inode *inode, struct file *file)
2952{
2953 return single_open(file, prism2_registers_proc_show, PDE_DATA(inode));
2954}
2955
2956static const struct file_operations prism2_registers_proc_fops = {
2957 .open = prism2_registers_proc_open,
2958 .read = seq_read,
2959 .llseek = seq_lseek,
2960 .release = seq_release,
2961};
2962
2957#endif /* PRISM2_NO_PROCFS_DEBUG */ 2963#endif /* PRISM2_NO_PROCFS_DEBUG */
2958 2964
2959 2965
@@ -3128,7 +3134,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
3128 local->func->reset_port = prism2_reset_port; 3134 local->func->reset_port = prism2_reset_port;
3129 local->func->schedule_reset = prism2_schedule_reset; 3135 local->func->schedule_reset = prism2_schedule_reset;
3130#ifdef PRISM2_DOWNLOAD_SUPPORT 3136#ifdef PRISM2_DOWNLOAD_SUPPORT
3131 local->func->read_aux = prism2_download_aux_dump; 3137 local->func->read_aux_fops = &prism2_download_aux_dump_proc_fops;
3132 local->func->download = prism2_download; 3138 local->func->download = prism2_download;
3133#endif /* PRISM2_DOWNLOAD_SUPPORT */ 3139#endif /* PRISM2_DOWNLOAD_SUPPORT */
3134 local->func->tx = prism2_tx_80211; 3140 local->func->tx = prism2_tx_80211;
@@ -3274,8 +3280,8 @@ static int hostap_hw_ready(struct net_device *dev)
3274 } 3280 }
3275 hostap_init_proc(local); 3281 hostap_init_proc(local);
3276#ifndef PRISM2_NO_PROCFS_DEBUG 3282#ifndef PRISM2_NO_PROCFS_DEBUG
3277 create_proc_read_entry("registers", 0, local->proc, 3283 proc_create_data("registers", 0, local->proc,
3278 prism2_registers_proc_read, local); 3284 &prism2_registers_proc_fops, local);
3279#endif /* PRISM2_NO_PROCFS_DEBUG */ 3285#endif /* PRISM2_NO_PROCFS_DEBUG */
3280 hostap_init_ap_proc(local); 3286 hostap_init_ap_proc(local);
3281 return 0; 3287 return 0;
diff --git a/drivers/net/wireless/hostap/hostap_proc.c b/drivers/net/wireless/hostap/hostap_proc.c
index dc447c1b5abe..7491dab2c105 100644
--- a/drivers/net/wireless/hostap/hostap_proc.c
+++ b/drivers/net/wireless/hostap/hostap_proc.c
@@ -12,259 +12,297 @@
12 12
13 13
14#ifndef PRISM2_NO_PROCFS_DEBUG 14#ifndef PRISM2_NO_PROCFS_DEBUG
15static int prism2_debug_proc_read(char *page, char **start, off_t off, 15static int prism2_debug_proc_show(struct seq_file *m, void *v)
16 int count, int *eof, void *data)
17{ 16{
18 char *p = page; 17 local_info_t *local = m->private;
19 local_info_t *local = (local_info_t *) data;
20 int i; 18 int i;
21 19
22 if (off != 0) { 20 seq_printf(m, "next_txfid=%d next_alloc=%d\n",
23 *eof = 1; 21 local->next_txfid, local->next_alloc);
24 return 0;
25 }
26
27 p += sprintf(p, "next_txfid=%d next_alloc=%d\n",
28 local->next_txfid, local->next_alloc);
29 for (i = 0; i < PRISM2_TXFID_COUNT; i++) 22 for (i = 0; i < PRISM2_TXFID_COUNT; i++)
30 p += sprintf(p, "FID: tx=%04X intransmit=%04X\n", 23 seq_printf(m, "FID: tx=%04X intransmit=%04X\n",
31 local->txfid[i], local->intransmitfid[i]); 24 local->txfid[i], local->intransmitfid[i]);
32 p += sprintf(p, "FW TX rate control: %d\n", local->fw_tx_rate_control); 25 seq_printf(m, "FW TX rate control: %d\n", local->fw_tx_rate_control);
33 p += sprintf(p, "beacon_int=%d\n", local->beacon_int); 26 seq_printf(m, "beacon_int=%d\n", local->beacon_int);
34 p += sprintf(p, "dtim_period=%d\n", local->dtim_period); 27 seq_printf(m, "dtim_period=%d\n", local->dtim_period);
35 p += sprintf(p, "wds_max_connections=%d\n", 28 seq_printf(m, "wds_max_connections=%d\n", local->wds_max_connections);
36 local->wds_max_connections); 29 seq_printf(m, "dev_enabled=%d\n", local->dev_enabled);
37 p += sprintf(p, "dev_enabled=%d\n", local->dev_enabled); 30 seq_printf(m, "sw_tick_stuck=%d\n", local->sw_tick_stuck);
38 p += sprintf(p, "sw_tick_stuck=%d\n", local->sw_tick_stuck);
39 for (i = 0; i < WEP_KEYS; i++) { 31 for (i = 0; i < WEP_KEYS; i++) {
40 if (local->crypt_info.crypt[i] && 32 if (local->crypt_info.crypt[i] &&
41 local->crypt_info.crypt[i]->ops) { 33 local->crypt_info.crypt[i]->ops) {
42 p += sprintf(p, "crypt[%d]=%s\n", i, 34 seq_printf(m, "crypt[%d]=%s\n", i,
43 local->crypt_info.crypt[i]->ops->name); 35 local->crypt_info.crypt[i]->ops->name);
44 } 36 }
45 } 37 }
46 p += sprintf(p, "pri_only=%d\n", local->pri_only); 38 seq_printf(m, "pri_only=%d\n", local->pri_only);
47 p += sprintf(p, "pci=%d\n", local->func->hw_type == HOSTAP_HW_PCI); 39 seq_printf(m, "pci=%d\n", local->func->hw_type == HOSTAP_HW_PCI);
48 p += sprintf(p, "sram_type=%d\n", local->sram_type); 40 seq_printf(m, "sram_type=%d\n", local->sram_type);
49 p += sprintf(p, "no_pri=%d\n", local->no_pri); 41 seq_printf(m, "no_pri=%d\n", local->no_pri);
50 42
51 return (p - page); 43 return 0;
52} 44}
45
46static int prism2_debug_proc_open(struct inode *inode, struct file *file)
47{
48 return single_open(file, prism2_debug_proc_show, PDE_DATA(inode));
49}
50
51static const struct file_operations prism2_debug_proc_fops = {
52 .open = prism2_debug_proc_open,
53 .read = seq_read,
54 .llseek = seq_lseek,
55 .release = seq_release,
56};
53#endif /* PRISM2_NO_PROCFS_DEBUG */ 57#endif /* PRISM2_NO_PROCFS_DEBUG */
54 58
55 59
56static int prism2_stats_proc_read(char *page, char **start, off_t off, 60static int prism2_stats_proc_show(struct seq_file *m, void *v)
57 int count, int *eof, void *data)
58{ 61{
59 char *p = page; 62 local_info_t *local = m->private;
60 local_info_t *local = (local_info_t *) data;
61 struct comm_tallies_sums *sums = &local->comm_tallies; 63 struct comm_tallies_sums *sums = &local->comm_tallies;
62 64
63 if (off != 0) { 65 seq_printf(m, "TxUnicastFrames=%u\n", sums->tx_unicast_frames);
64 *eof = 1; 66 seq_printf(m, "TxMulticastframes=%u\n", sums->tx_multicast_frames);
65 return 0; 67 seq_printf(m, "TxFragments=%u\n", sums->tx_fragments);
66 } 68 seq_printf(m, "TxUnicastOctets=%u\n", sums->tx_unicast_octets);
67 69 seq_printf(m, "TxMulticastOctets=%u\n", sums->tx_multicast_octets);
68 p += sprintf(p, "TxUnicastFrames=%u\n", sums->tx_unicast_frames); 70 seq_printf(m, "TxDeferredTransmissions=%u\n",
69 p += sprintf(p, "TxMulticastframes=%u\n", sums->tx_multicast_frames); 71 sums->tx_deferred_transmissions);
70 p += sprintf(p, "TxFragments=%u\n", sums->tx_fragments); 72 seq_printf(m, "TxSingleRetryFrames=%u\n", sums->tx_single_retry_frames);
71 p += sprintf(p, "TxUnicastOctets=%u\n", sums->tx_unicast_octets); 73 seq_printf(m, "TxMultipleRetryFrames=%u\n",
72 p += sprintf(p, "TxMulticastOctets=%u\n", sums->tx_multicast_octets); 74 sums->tx_multiple_retry_frames);
73 p += sprintf(p, "TxDeferredTransmissions=%u\n", 75 seq_printf(m, "TxRetryLimitExceeded=%u\n",
74 sums->tx_deferred_transmissions); 76 sums->tx_retry_limit_exceeded);
75 p += sprintf(p, "TxSingleRetryFrames=%u\n", 77 seq_printf(m, "TxDiscards=%u\n", sums->tx_discards);
76 sums->tx_single_retry_frames); 78 seq_printf(m, "RxUnicastFrames=%u\n", sums->rx_unicast_frames);
77 p += sprintf(p, "TxMultipleRetryFrames=%u\n", 79 seq_printf(m, "RxMulticastFrames=%u\n", sums->rx_multicast_frames);
78 sums->tx_multiple_retry_frames); 80 seq_printf(m, "RxFragments=%u\n", sums->rx_fragments);
79 p += sprintf(p, "TxRetryLimitExceeded=%u\n", 81 seq_printf(m, "RxUnicastOctets=%u\n", sums->rx_unicast_octets);
80 sums->tx_retry_limit_exceeded); 82 seq_printf(m, "RxMulticastOctets=%u\n", sums->rx_multicast_octets);
81 p += sprintf(p, "TxDiscards=%u\n", sums->tx_discards); 83 seq_printf(m, "RxFCSErrors=%u\n", sums->rx_fcs_errors);
82 p += sprintf(p, "RxUnicastFrames=%u\n", sums->rx_unicast_frames); 84 seq_printf(m, "RxDiscardsNoBuffer=%u\n", sums->rx_discards_no_buffer);
83 p += sprintf(p, "RxMulticastFrames=%u\n", sums->rx_multicast_frames); 85 seq_printf(m, "TxDiscardsWrongSA=%u\n", sums->tx_discards_wrong_sa);
84 p += sprintf(p, "RxFragments=%u\n", sums->rx_fragments); 86 seq_printf(m, "RxDiscardsWEPUndecryptable=%u\n",
85 p += sprintf(p, "RxUnicastOctets=%u\n", sums->rx_unicast_octets); 87 sums->rx_discards_wep_undecryptable);
86 p += sprintf(p, "RxMulticastOctets=%u\n", sums->rx_multicast_octets); 88 seq_printf(m, "RxMessageInMsgFragments=%u\n",
87 p += sprintf(p, "RxFCSErrors=%u\n", sums->rx_fcs_errors); 89 sums->rx_message_in_msg_fragments);
88 p += sprintf(p, "RxDiscardsNoBuffer=%u\n", 90 seq_printf(m, "RxMessageInBadMsgFragments=%u\n",
89 sums->rx_discards_no_buffer); 91 sums->rx_message_in_bad_msg_fragments);
90 p += sprintf(p, "TxDiscardsWrongSA=%u\n", sums->tx_discards_wrong_sa);
91 p += sprintf(p, "RxDiscardsWEPUndecryptable=%u\n",
92 sums->rx_discards_wep_undecryptable);
93 p += sprintf(p, "RxMessageInMsgFragments=%u\n",
94 sums->rx_message_in_msg_fragments);
95 p += sprintf(p, "RxMessageInBadMsgFragments=%u\n",
96 sums->rx_message_in_bad_msg_fragments);
97 /* FIX: this may grow too long for one page(?) */ 92 /* FIX: this may grow too long for one page(?) */
98 93
99 return (p - page); 94 return 0;
95}
96
97static int prism2_stats_proc_open(struct inode *inode, struct file *file)
98{
99 return single_open(file, prism2_stats_proc_show, PDE_DATA(inode));
100} 100}
101 101
102static const struct file_operations prism2_stats_proc_fops = {
103 .open = prism2_stats_proc_open,
104 .read = seq_read,
105 .llseek = seq_lseek,
106 .release = seq_release,
107};
102 108
103static int prism2_wds_proc_read(char *page, char **start, off_t off, 109
104 int count, int *eof, void *data) 110static int prism2_wds_proc_show(struct seq_file *m, void *v)
105{ 111{
106 char *p = page; 112 struct list_head *ptr = v;
107 local_info_t *local = (local_info_t *) data;
108 struct list_head *ptr;
109 struct hostap_interface *iface; 113 struct hostap_interface *iface;
110 114
111 if (off > PROC_LIMIT) { 115 iface = list_entry(ptr, struct hostap_interface, list);
112 *eof = 1; 116 if (iface->type == HOSTAP_INTERFACE_WDS)
113 return 0; 117 seq_printf(m, "%s\t%pM\n",
114 } 118 iface->dev->name, iface->u.wds.remote_addr);
119 return 0;
120}
115 121
122static void *prism2_wds_proc_start(struct seq_file *m, loff_t *_pos)
123{
124 local_info_t *local = m->private;
116 read_lock_bh(&local->iface_lock); 125 read_lock_bh(&local->iface_lock);
117 list_for_each(ptr, &local->hostap_interfaces) { 126 return seq_list_start(&local->hostap_interfaces, *_pos);
118 iface = list_entry(ptr, struct hostap_interface, list); 127}
119 if (iface->type != HOSTAP_INTERFACE_WDS)
120 continue;
121 p += sprintf(p, "%s\t%pM\n",
122 iface->dev->name,
123 iface->u.wds.remote_addr);
124 if ((p - page) > PROC_LIMIT) {
125 printk(KERN_DEBUG "%s: wds proc did not fit\n",
126 local->dev->name);
127 break;
128 }
129 }
130 read_unlock_bh(&local->iface_lock);
131 128
132 if ((p - page) <= off) { 129static void *prism2_wds_proc_next(struct seq_file *m, void *v, loff_t *_pos)
133 *eof = 1; 130{
134 return 0; 131 local_info_t *local = m->private;
135 } 132 return seq_list_next(v, &local->hostap_interfaces, _pos);
133}
136 134
137 *start = page + off; 135static void prism2_wds_proc_stop(struct seq_file *m, void *v)
136{
137 local_info_t *local = m->private;
138 read_unlock_bh(&local->iface_lock);
139}
138 140
139 return (p - page - off); 141static const struct seq_operations prism2_wds_proc_seqops = {
142 .start = prism2_wds_proc_start,
143 .next = prism2_wds_proc_next,
144 .stop = prism2_wds_proc_stop,
145 .show = prism2_wds_proc_show,
146};
147
148static int prism2_wds_proc_open(struct inode *inode, struct file *file)
149{
150 int ret = seq_open(file, &prism2_wds_proc_seqops);
151 if (ret == 0) {
152 struct seq_file *m = file->private_data;
153 m->private = PDE_DATA(inode);
154 }
155 return ret;
140} 156}
141 157
158static const struct file_operations prism2_wds_proc_fops = {
159 .open = prism2_wds_proc_open,
160 .read = seq_read,
161 .llseek = seq_lseek,
162 .release = seq_release,
163};
142 164
143static int prism2_bss_list_proc_read(char *page, char **start, off_t off, 165
144 int count, int *eof, void *data) 166static int prism2_bss_list_proc_show(struct seq_file *m, void *v)
145{ 167{
146 char *p = page; 168 local_info_t *local = m->private;
147 local_info_t *local = (local_info_t *) data; 169 struct list_head *ptr = v;
148 struct list_head *ptr;
149 struct hostap_bss_info *bss; 170 struct hostap_bss_info *bss;
150 int i; 171 int i;
151 172
152 if (off > PROC_LIMIT) { 173 if (ptr == &local->bss_list) {
153 *eof = 1; 174 seq_printf(m, "#BSSID\tlast_update\tcount\tcapab_info\tSSID(txt)\t"
175 "SSID(hex)\tWPA IE\n");
154 return 0; 176 return 0;
155 } 177 }
156 178
157 p += sprintf(p, "#BSSID\tlast_update\tcount\tcapab_info\tSSID(txt)\t" 179 bss = list_entry(ptr, struct hostap_bss_info, list);
158 "SSID(hex)\tWPA IE\n"); 180 seq_printf(m, "%pM\t%lu\t%u\t0x%x\t",
181 bss->bssid, bss->last_update,
182 bss->count, bss->capab_info);
183
184 for (i = 0; i < bss->ssid_len; i++)
185 seq_putc(m,bss->ssid[i] >= 32 && bss->ssid[i] < 127 ?
186 bss->ssid[i] : '_');
187
188 seq_putc(m, '\t');
189 for (i = 0; i < bss->ssid_len; i++)
190 seq_printf(m, "%02x", bss->ssid[i]);
191 seq_putc(m, '\t');
192 for (i = 0; i < bss->wpa_ie_len; i++)
193 seq_printf(m, "%02x", bss->wpa_ie[i]);
194 seq_putc(m, '\n');
195 return 0;
196}
197
198static void *prism2_bss_list_proc_start(struct seq_file *m, loff_t *_pos)
199{
200 local_info_t *local = m->private;
159 spin_lock_bh(&local->lock); 201 spin_lock_bh(&local->lock);
160 list_for_each(ptr, &local->bss_list) { 202 return seq_list_start_head(&local->bss_list, *_pos);
161 bss = list_entry(ptr, struct hostap_bss_info, list); 203}
162 p += sprintf(p, "%pM\t%lu\t%u\t0x%x\t",
163 bss->bssid, bss->last_update,
164 bss->count, bss->capab_info);
165 for (i = 0; i < bss->ssid_len; i++) {
166 p += sprintf(p, "%c",
167 bss->ssid[i] >= 32 && bss->ssid[i] < 127 ?
168 bss->ssid[i] : '_');
169 }
170 p += sprintf(p, "\t");
171 for (i = 0; i < bss->ssid_len; i++) {
172 p += sprintf(p, "%02x", bss->ssid[i]);
173 }
174 p += sprintf(p, "\t");
175 for (i = 0; i < bss->wpa_ie_len; i++) {
176 p += sprintf(p, "%02x", bss->wpa_ie[i]);
177 }
178 p += sprintf(p, "\n");
179 if ((p - page) > PROC_LIMIT) {
180 printk(KERN_DEBUG "%s: BSS proc did not fit\n",
181 local->dev->name);
182 break;
183 }
184 }
185 spin_unlock_bh(&local->lock);
186 204
187 if ((p - page) <= off) { 205static void *prism2_bss_list_proc_next(struct seq_file *m, void *v, loff_t *_pos)
188 *eof = 1; 206{
189 return 0; 207 local_info_t *local = m->private;
190 } 208 return seq_list_next(v, &local->bss_list, _pos);
209}
191 210
192 *start = page + off; 211static void prism2_bss_list_proc_stop(struct seq_file *m, void *v)
212{
213 local_info_t *local = m->private;
214 spin_unlock_bh(&local->lock);
215}
216
217static const struct seq_operations prism2_bss_list_proc_seqops = {
218 .start = prism2_bss_list_proc_start,
219 .next = prism2_bss_list_proc_next,
220 .stop = prism2_bss_list_proc_stop,
221 .show = prism2_bss_list_proc_show,
222};
193 223
194 return (p - page - off); 224static int prism2_bss_list_proc_open(struct inode *inode, struct file *file)
225{
226 int ret = seq_open(file, &prism2_bss_list_proc_seqops);
227 if (ret == 0) {
228 struct seq_file *m = file->private_data;
229 m->private = PDE_DATA(inode);
230 }
231 return ret;
195} 232}
196 233
234static const struct file_operations prism2_bss_list_proc_fops = {
235 .open = prism2_bss_list_proc_open,
236 .read = seq_read,
237 .llseek = seq_lseek,
238 .release = seq_release,
239};
197 240
198static int prism2_crypt_proc_read(char *page, char **start, off_t off, 241
199 int count, int *eof, void *data) 242static int prism2_crypt_proc_show(struct seq_file *m, void *v)
200{ 243{
201 char *p = page; 244 local_info_t *local = m->private;
202 local_info_t *local = (local_info_t *) data;
203 int i; 245 int i;
204 246
205 if (off > PROC_LIMIT) { 247 seq_printf(m, "tx_keyidx=%d\n", local->crypt_info.tx_keyidx);
206 *eof = 1;
207 return 0;
208 }
209
210 p += sprintf(p, "tx_keyidx=%d\n", local->crypt_info.tx_keyidx);
211 for (i = 0; i < WEP_KEYS; i++) { 248 for (i = 0; i < WEP_KEYS; i++) {
212 if (local->crypt_info.crypt[i] && 249 if (local->crypt_info.crypt[i] &&
213 local->crypt_info.crypt[i]->ops && 250 local->crypt_info.crypt[i]->ops &&
214 local->crypt_info.crypt[i]->ops->print_stats) { 251 local->crypt_info.crypt[i]->ops->print_stats) {
215 p = local->crypt_info.crypt[i]->ops->print_stats( 252 local->crypt_info.crypt[i]->ops->print_stats(
216 p, local->crypt_info.crypt[i]->priv); 253 m, local->crypt_info.crypt[i]->priv);
217 } 254 }
218 } 255 }
256 return 0;
257}
219 258
220 if ((p - page) <= off) { 259static int prism2_crypt_proc_open(struct inode *inode, struct file *file)
221 *eof = 1; 260{
222 return 0; 261 return single_open(file, prism2_crypt_proc_show, PDE_DATA(inode));
223 }
224
225 *start = page + off;
226
227 return (p - page - off);
228} 262}
229 263
264static const struct file_operations prism2_crypt_proc_fops = {
265 .open = prism2_crypt_proc_open,
266 .read = seq_read,
267 .llseek = seq_lseek,
268 .release = seq_release,
269};
230 270
231static int prism2_pda_proc_read(char *page, char **start, off_t off, 271
232 int count, int *eof, void *data) 272static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf,
273 size_t count, loff_t *_pos)
233{ 274{
234 local_info_t *local = (local_info_t *) data; 275 local_info_t *local = PDE_DATA(file_inode(file));
276 size_t off;
235 277
236 if (local->pda == NULL || off >= PRISM2_PDA_SIZE) { 278 if (local->pda == NULL || *_pos >= PRISM2_PDA_SIZE)
237 *eof = 1;
238 return 0; 279 return 0;
239 }
240 280
241 if (off + count > PRISM2_PDA_SIZE) 281 off = *_pos;
282 if (count > PRISM2_PDA_SIZE - off)
242 count = PRISM2_PDA_SIZE - off; 283 count = PRISM2_PDA_SIZE - off;
243 284 if (copy_to_user(buf, local->pda + off, count) != 0)
244 memcpy(page, local->pda + off, count); 285 return -EFAULT;
286 *_pos += count;
245 return count; 287 return count;
246} 288}
247 289
290static const struct file_operations prism2_pda_proc_fops = {
291 .read = prism2_pda_proc_read,
292 .llseek = generic_file_llseek,
293};
248 294
249static int prism2_aux_dump_proc_read(char *page, char **start, off_t off,
250 int count, int *eof, void *data)
251{
252 local_info_t *local = (local_info_t *) data;
253
254 if (local->func->read_aux == NULL) {
255 *eof = 1;
256 return 0;
257 }
258 295
259 if (local->func->read_aux(local->dev, off, count, page)) { 296static ssize_t prism2_aux_dump_proc_no_read(struct file *file, char __user *buf,
260 *eof = 1; 297 size_t bufsize, loff_t *_pos)
261 return 0; 298{
262 } 299 return 0;
263 *start = page;
264
265 return count;
266} 300}
267 301
302static const struct file_operations prism2_aux_dump_proc_fops = {
303 .read = prism2_aux_dump_proc_no_read,
304};
305
268 306
269#ifdef PRISM2_IO_DEBUG 307#ifdef PRISM2_IO_DEBUG
270static int prism2_io_debug_proc_read(char *page, char **start, off_t off, 308static int prism2_io_debug_proc_read(char *page, char **start, off_t off,
@@ -306,82 +344,108 @@ static int prism2_io_debug_proc_read(char *page, char **start, off_t off,
306 344
307 345
308#ifndef PRISM2_NO_STATION_MODES 346#ifndef PRISM2_NO_STATION_MODES
309static int prism2_scan_results_proc_read(char *page, char **start, off_t off, 347static int prism2_scan_results_proc_show(struct seq_file *m, void *v)
310 int count, int *eof, void *data)
311{ 348{
312 char *p = page; 349 local_info_t *local = m->private;
313 local_info_t *local = (local_info_t *) data; 350 unsigned long entry;
314 int entry, i, len, total = 0; 351 int i, len;
315 struct hfa384x_hostscan_result *scanres; 352 struct hfa384x_hostscan_result *scanres;
316 u8 *pos; 353 u8 *p;
317 354
318 p += sprintf(p, "CHID ANL SL BcnInt Capab Rate BSSID ATIM SupRates " 355 if (v == SEQ_START_TOKEN) {
319 "SSID\n"); 356 seq_printf(m,
357 "CHID ANL SL BcnInt Capab Rate BSSID ATIM SupRates SSID\n");
358 return 0;
359 }
320 360
361 entry = (unsigned long)v - 2;
362 scanres = &local->last_scan_results[entry];
363
364 seq_printf(m, "%d %d %d %d 0x%02x %d %pM %d ",
365 le16_to_cpu(scanres->chid),
366 (s16) le16_to_cpu(scanres->anl),
367 (s16) le16_to_cpu(scanres->sl),
368 le16_to_cpu(scanres->beacon_interval),
369 le16_to_cpu(scanres->capability),
370 le16_to_cpu(scanres->rate),
371 scanres->bssid,
372 le16_to_cpu(scanres->atim));
373
374 p = scanres->sup_rates;
375 for (i = 0; i < sizeof(scanres->sup_rates); i++) {
376 if (p[i] == 0)
377 break;
378 seq_printf(m, "<%02x>", p[i]);
379 }
380 seq_putc(m, ' ');
381
382 p = scanres->ssid;
383 len = le16_to_cpu(scanres->ssid_len);
384 if (len > 32)
385 len = 32;
386 for (i = 0; i < len; i++) {
387 unsigned char c = p[i];
388 if (c >= 32 && c < 127)
389 seq_putc(m, c);
390 else
391 seq_printf(m, "<%02x>", c);
392 }
393 seq_putc(m, '\n');
394 return 0;
395}
396
397static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos)
398{
399 local_info_t *local = m->private;
321 spin_lock_bh(&local->lock); 400 spin_lock_bh(&local->lock);
322 for (entry = 0; entry < local->last_scan_results_count; entry++) {
323 scanres = &local->last_scan_results[entry];
324 401
325 if (total + (p - page) <= off) { 402 /* We have a header (pos 0) + N results to show (pos 1...N) */
326 total += p - page; 403 if (*_pos > local->last_scan_results_count)
327 p = page; 404 return NULL;
328 } 405 return (void *)(unsigned long)(*_pos + 1); /* 0 would be EOF */
329 if (total + (p - page) > off + count) 406}
330 break;
331 if ((p - page) > (PAGE_SIZE - 200))
332 break;
333 407
334 p += sprintf(p, "%d %d %d %d 0x%02x %d %pM %d ", 408static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *_pos)
335 le16_to_cpu(scanres->chid), 409{
336 (s16) le16_to_cpu(scanres->anl), 410 local_info_t *local = m->private;
337 (s16) le16_to_cpu(scanres->sl), 411
338 le16_to_cpu(scanres->beacon_interval), 412 ++*_pos;
339 le16_to_cpu(scanres->capability), 413 if (*_pos > local->last_scan_results_count)
340 le16_to_cpu(scanres->rate), 414 return NULL;
341 scanres->bssid, 415 return (void *)(unsigned long)(*_pos + 1); /* 0 would be EOF */
342 le16_to_cpu(scanres->atim)); 416}
343 417
344 pos = scanres->sup_rates; 418static void prism2_scan_results_proc_stop(struct seq_file *m, void *v)
345 for (i = 0; i < sizeof(scanres->sup_rates); i++) { 419{
346 if (pos[i] == 0) 420 local_info_t *local = m->private;
347 break;
348 p += sprintf(p, "<%02x>", pos[i]);
349 }
350 p += sprintf(p, " ");
351
352 pos = scanres->ssid;
353 len = le16_to_cpu(scanres->ssid_len);
354 if (len > 32)
355 len = 32;
356 for (i = 0; i < len; i++) {
357 unsigned char c = pos[i];
358 if (c >= 32 && c < 127)
359 p += sprintf(p, "%c", c);
360 else
361 p += sprintf(p, "<%02x>", c);
362 }
363 p += sprintf(p, "\n");
364 }
365 spin_unlock_bh(&local->lock); 421 spin_unlock_bh(&local->lock);
422}
366 423
367 total += (p - page); 424static const struct seq_operations prism2_scan_results_proc_seqops = {
368 if (total >= off + count) 425 .start = prism2_scan_results_proc_start,
369 *eof = 1; 426 .next = prism2_scan_results_proc_next,
427 .stop = prism2_scan_results_proc_stop,
428 .show = prism2_scan_results_proc_show,
429};
370 430
371 if (total < off) { 431static int prism2_scan_results_proc_open(struct inode *inode, struct file *file)
372 *eof = 1; 432{
373 return 0; 433 int ret = seq_open(file, &prism2_scan_results_proc_seqops);
434 if (ret == 0) {
435 struct seq_file *m = file->private_data;
436 m->private = PDE_DATA(inode);
374 } 437 }
438 return ret;
439}
440
441static const struct file_operations prism2_scan_results_proc_fops = {
442 .open = prism2_scan_results_proc_open,
443 .read = seq_read,
444 .llseek = seq_lseek,
445 .release = seq_release,
446};
375 447
376 len = total - off;
377 if (len > (p - page))
378 len = p - page;
379 *start = p - len;
380 if (len > count)
381 len = count;
382 448
383 return len;
384}
385#endif /* PRISM2_NO_STATION_MODES */ 449#endif /* PRISM2_NO_STATION_MODES */
386 450
387 451
@@ -403,53 +467,36 @@ void hostap_init_proc(local_info_t *local)
403 } 467 }
404 468
405#ifndef PRISM2_NO_PROCFS_DEBUG 469#ifndef PRISM2_NO_PROCFS_DEBUG
406 create_proc_read_entry("debug", 0, local->proc, 470 proc_create_data("debug", 0, local->proc,
407 prism2_debug_proc_read, local); 471 &prism2_debug_proc_fops, local);
408#endif /* PRISM2_NO_PROCFS_DEBUG */ 472#endif /* PRISM2_NO_PROCFS_DEBUG */
409 create_proc_read_entry("stats", 0, local->proc, 473 proc_create_data("stats", 0, local->proc,
410 prism2_stats_proc_read, local); 474 &prism2_stats_proc_fops, local);
411 create_proc_read_entry("wds", 0, local->proc, 475 proc_create_data("wds", 0, local->proc,
412 prism2_wds_proc_read, local); 476 &prism2_wds_proc_fops, local);
413 create_proc_read_entry("pda", 0, local->proc, 477 proc_create_data("pda", 0, local->proc,
414 prism2_pda_proc_read, local); 478 &prism2_pda_proc_fops, local);
415 create_proc_read_entry("aux_dump", 0, local->proc, 479 proc_create_data("aux_dump", 0, local->proc,
416 prism2_aux_dump_proc_read, local); 480 local->func->read_aux_fops ?: &prism2_aux_dump_proc_fops,
417 create_proc_read_entry("bss_list", 0, local->proc, 481 local);
418 prism2_bss_list_proc_read, local); 482 proc_create_data("bss_list", 0, local->proc,
419 create_proc_read_entry("crypt", 0, local->proc, 483 &prism2_bss_list_proc_fops, local);
420 prism2_crypt_proc_read, local); 484 proc_create_data("crypt", 0, local->proc,
485 &prism2_crypt_proc_fops, local);
421#ifdef PRISM2_IO_DEBUG 486#ifdef PRISM2_IO_DEBUG
422 create_proc_read_entry("io_debug", 0, local->proc, 487 proc_create_data("io_debug", 0, local->proc,
423 prism2_io_debug_proc_read, local); 488 &prism2_io_debug_proc_fops, local);
424#endif /* PRISM2_IO_DEBUG */ 489#endif /* PRISM2_IO_DEBUG */
425#ifndef PRISM2_NO_STATION_MODES 490#ifndef PRISM2_NO_STATION_MODES
426 create_proc_read_entry("scan_results", 0, local->proc, 491 proc_create_data("scan_results", 0, local->proc,
427 prism2_scan_results_proc_read, local); 492 &prism2_scan_results_proc_fops, local);
428#endif /* PRISM2_NO_STATION_MODES */ 493#endif /* PRISM2_NO_STATION_MODES */
429} 494}
430 495
431 496
432void hostap_remove_proc(local_info_t *local) 497void hostap_remove_proc(local_info_t *local)
433{ 498{
434 if (local->proc != NULL) { 499 remove_proc_subtree(local->ddev->name, hostap_proc);
435#ifndef PRISM2_NO_STATION_MODES
436 remove_proc_entry("scan_results", local->proc);
437#endif /* PRISM2_NO_STATION_MODES */
438#ifdef PRISM2_IO_DEBUG
439 remove_proc_entry("io_debug", local->proc);
440#endif /* PRISM2_IO_DEBUG */
441 remove_proc_entry("pda", local->proc);
442 remove_proc_entry("aux_dump", local->proc);
443 remove_proc_entry("wds", local->proc);
444 remove_proc_entry("stats", local->proc);
445 remove_proc_entry("bss_list", local->proc);
446 remove_proc_entry("crypt", local->proc);
447#ifndef PRISM2_NO_PROCFS_DEBUG
448 remove_proc_entry("debug", local->proc);
449#endif /* PRISM2_NO_PROCFS_DEBUG */
450 if (hostap_proc != NULL)
451 remove_proc_entry(local->proc->name, hostap_proc);
452 }
453} 500}
454 501
455 502
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
index 7bb0b4b3f2cb..57904015380f 100644
--- a/drivers/net/wireless/hostap/hostap_wlan.h
+++ b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -596,8 +596,7 @@ struct prism2_helper_functions {
596 struct prism2_download_param *param); 596 struct prism2_download_param *param);
597 int (*tx)(struct sk_buff *skb, struct net_device *dev); 597 int (*tx)(struct sk_buff *skb, struct net_device *dev);
598 int (*set_tim)(struct net_device *dev, int aid, int set); 598 int (*set_tim)(struct net_device *dev, int aid, int set);
599 int (*read_aux)(struct net_device *dev, unsigned addr, int len, 599 const struct file_operations *read_aux_fops;
600 u8 *buf);
601 600
602 int need_tx_headroom; /* number of bytes of headroom needed before 601 int need_tx_headroom; /* number of bytes of headroom needed before
603 * IEEE 802.11 header */ 602 * IEEE 802.11 header */
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index ebada812b3a5..9b557a1bb7f8 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -2778,7 +2778,7 @@ static ssize_t int_proc_write(struct file *file, const char __user *buffer,
2778 nr = nr * 10 + c; 2778 nr = nr * 10 + c;
2779 p++; 2779 p++;
2780 } while (--len); 2780 } while (--len);
2781 *(int *)PDE(file_inode(file))->data = nr; 2781 *(int *)PDE_DATA(file_inode(file)) = nr;
2782 return count; 2782 return count;
2783} 2783}
2784 2784