Skip to content

Commit

Permalink
hostap: Don't use create_proc_read_entry()
Browse files Browse the repository at this point in the history
Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.

Signed-off-by: David Howells <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
cc: Jouni Malinen <[email protected]>
cc: John W. Linville <[email protected]>
cc: Johannes Berg <[email protected]>
cc: [email protected]
cc: [email protected]
cc: [email protected]
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
dhowells authored and Al Viro committed Apr 29, 2013
1 parent 4c4df9b commit 6bbefe8
Show file tree
Hide file tree
Showing 12 changed files with 703 additions and 523 deletions.
375 changes: 219 additions & 156 deletions drivers/net/wireless/hostap/hostap_ap.c

Large diffs are not rendered by default.

68 changes: 59 additions & 9 deletions drivers/net/wireless/hostap/hostap_download.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,70 @@ static int prism2_pda_ok(u8 *buf)
}


static int prism2_download_aux_dump(struct net_device *dev,
unsigned int addr, int len, u8 *buf)
{
int res;
#define prism2_download_aux_dump_npages 65536

prism2_enable_aux_port(dev, 1);
res = hfa384x_from_aux(dev, addr, len, buf);
prism2_enable_aux_port(dev, 0);
if (res)
return -1;
struct prism2_download_aux_dump {
local_info_t *local;
u16 page[0x80];
};

static int prism2_download_aux_dump_proc_show(struct seq_file *m, void *v)
{
struct prism2_download_aux_dump *ctx = m->private;

hfa384x_from_aux(ctx->local->dev, (unsigned long)v - 1, 0x80, ctx->page);
seq_write(m, ctx->page, 0x80);
return 0;
}

static void *prism2_download_aux_dump_proc_start(struct seq_file *m, loff_t *_pos)
{
struct prism2_download_aux_dump *ctx = m->private;
prism2_enable_aux_port(ctx->local->dev, 1);
if (*_pos >= prism2_download_aux_dump_npages)
return NULL;
return (void *)((unsigned long)*_pos + 1);
}

static void *prism2_download_aux_dump_proc_next(struct seq_file *m, void *v, loff_t *_pos)
{
++*_pos;
if (*_pos >= prism2_download_aux_dump_npages)
return NULL;
return (void *)((unsigned long)*_pos + 1);
}

static void prism2_download_aux_dump_proc_stop(struct seq_file *m, void *v)
{
struct prism2_download_aux_dump *ctx = m->private;
prism2_enable_aux_port(ctx->local->dev, 0);
}

static const struct seq_operations prism2_download_aux_dump_proc_seqops = {
.start = prism2_download_aux_dump_proc_start,
.next = prism2_download_aux_dump_proc_next,
.stop = prism2_download_aux_dump_proc_stop,
.show = prism2_download_aux_dump_proc_show,
};

static int prism2_download_aux_dump_proc_open(struct inode *inode, struct file *file)
{
int ret = seq_open_private(file, &prism2_download_aux_dump_proc_seqops,
sizeof(struct prism2_download_aux_dump));
if (ret == 0) {
struct seq_file *m = file->private_data;
m->private = PDE_DATA(inode);
}
return ret;
}

static const struct file_operations prism2_download_aux_dump_proc_fops = {
.open = prism2_download_aux_dump_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_private,
};


static u8 * prism2_read_pda(struct net_device *dev)
{
Expand Down
38 changes: 22 additions & 16 deletions drivers/net/wireless/hostap/hostap_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/if_arp.h>
#include <linux/delay.h>
#include <linux/random.h>
Expand Down Expand Up @@ -129,8 +130,7 @@ static void prism2_check_sta_fw_version(local_info_t *local);

#ifdef PRISM2_DOWNLOAD_SUPPORT
/* hostap_download.c */
static int prism2_download_aux_dump(struct net_device *dev,
unsigned int addr, int len, u8 *buf);
static const struct file_operations prism2_download_aux_dump_proc_fops;
static u8 * prism2_read_pda(struct net_device *dev);
static int prism2_download(local_info_t *local,
struct prism2_download_param *param);
Expand Down Expand Up @@ -2894,19 +2894,12 @@ static void hostap_tick_timer(unsigned long data)


#ifndef PRISM2_NO_PROCFS_DEBUG
static int prism2_registers_proc_read(char *page, char **start, off_t off,
int count, int *eof, void *data)
static int prism2_registers_proc_show(struct seq_file *m, void *v)
{
char *p = page;
local_info_t *local = (local_info_t *) data;

if (off != 0) {
*eof = 1;
return 0;
}
local_info_t *local = m->private;

#define SHOW_REG(n) \
p += sprintf(p, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF))
seq_printf(m, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF))

SHOW_REG(CMD);
SHOW_REG(PARAM0);
Expand Down Expand Up @@ -2952,8 +2945,21 @@ p += sprintf(p, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF))
SHOW_REG(PCI_M1_CTL);
#endif /* PRISM2_PCI */

return (p - page);
return 0;
}

static int prism2_registers_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, prism2_registers_proc_show, PDE_DATA(inode));
}

static const struct file_operations prism2_registers_proc_fops = {
.open = prism2_registers_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};

#endif /* PRISM2_NO_PROCFS_DEBUG */


Expand Down Expand Up @@ -3128,7 +3134,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
local->func->reset_port = prism2_reset_port;
local->func->schedule_reset = prism2_schedule_reset;
#ifdef PRISM2_DOWNLOAD_SUPPORT
local->func->read_aux = prism2_download_aux_dump;
local->func->read_aux_fops = &prism2_download_aux_dump_proc_fops;
local->func->download = prism2_download;
#endif /* PRISM2_DOWNLOAD_SUPPORT */
local->func->tx = prism2_tx_80211;
Expand Down Expand Up @@ -3274,8 +3280,8 @@ static int hostap_hw_ready(struct net_device *dev)
}
hostap_init_proc(local);
#ifndef PRISM2_NO_PROCFS_DEBUG
create_proc_read_entry("registers", 0, local->proc,
prism2_registers_proc_read, local);
proc_create_data("registers", 0, local->proc,
&prism2_registers_proc_fops, local);
#endif /* PRISM2_NO_PROCFS_DEBUG */
hostap_init_ap_proc(local);
return 0;
Expand Down
Loading

0 comments on commit 6bbefe8

Please sign in to comment.