aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8192u
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 17:51:54 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 17:51:54 -0700
commit20b4fb485227404329e41ad15588afad3df23050 (patch)
treef3e099f0ab3da8a93b447203e294d2bb22f6dc05 /drivers/staging/rtl8192u
parentb9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff)
parentac3e3c5b1164397656df81b9e9ab4991184d3236 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro, Misc cleanups all over the place, mainly wrt /proc interfaces (switch create_proc_entry to proc_create(), get rid of the deprecated create_proc_read_entry() in favor of using proc_create_data() and seq_file etc). 7kloc removed. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits) don't bother with deferred freeing of fdtables proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h proc: Make the PROC_I() and PDE() macros internal to procfs proc: Supply a function to remove a proc entry by PDE take cgroup_open() and cpuset_open() to fs/proc/base.c ppc: Clean up scanlog ppc: Clean up rtas_flash driver somewhat hostap: proc: Use remove_proc_subtree() drm: proc: Use remove_proc_subtree() drm: proc: Use minor->index to label things, not PDE->name drm: Constify drm_proc_list[] zoran: Don't print proc_dir_entry data in debug reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show() proc: Supply an accessor for getting the data from a PDE's parent airo: Use remove_proc_subtree() rtl8192u: Don't need to save device proc dir PDE rtl8187se: Use a dir under /proc/net/r8180/ proc: Add proc_mkdir_data() proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h} proc: Move PDE_NET() to fs/proc/proc_net.c ...
Diffstat (limited to 'drivers/staging/rtl8192u')
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_module.c53
-rw-r--r--drivers/staging/rtl8192u/ieee80211/proc.c8
-rw-r--r--drivers/staging/rtl8192u/r8192U.h1
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c211
4 files changed, 110 insertions, 163 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index 76c56e5aed7..e0870c05a5e 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -243,39 +243,34 @@ static int debug = \
;
struct proc_dir_entry *ieee80211_proc;
-static int show_debug_level(char *page, char **start, off_t offset,
- int count, int *eof, void *data)
+static int show_debug_level(struct seq_file *m, void *v)
{
- return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
+ return seq_printf(m, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
- unsigned long count, void *data)
+static ssize_t write_debug_level(struct file *file, const char __user *buffer,
+ size_t count, loff_t *ppos)
{
- char buf[] = "0x00000000";
- unsigned long len = min_t(unsigned long, sizeof(buf) - 1, count);
- char *p = (char *)buf;
unsigned long val;
+ int err = kstrtoul_from_user(buffer, count, 0, &val);
+ if (err)
+ return err;
+ ieee80211_debug_level = val;
+ return count;
+}
- if (copy_from_user(buf, buffer, len))
- return count;
- buf[len] = 0;
- if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') {
- p++;
- if (p[0] == 'x' || p[0] == 'X')
- p++;
- val = simple_strtoul(p, &p, 16);
- } else
- val = simple_strtoul(p, &p, 10);
- if (p == buf)
- printk(KERN_INFO DRV_NAME
- ": %s is not in hex or decimal form.\n", buf);
- else
- ieee80211_debug_level = val;
-
- return strnlen(buf, count);
+static int open_debug_level(struct inode *inode, struct file *file)
+{
+ return single_open(file, show_debug_level, NULL);
}
+static const struct file_operations fops = {
+ .open = open_debug_level,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .write = write_debug_level
+};
+
int __init ieee80211_debug_init(void)
{
struct proc_dir_entry *e;
@@ -288,17 +283,13 @@ int __init ieee80211_debug_init(void)
" proc directory\n");
return -EIO;
}
- e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR,
- ieee80211_proc);
+ e = proc_create("debug_level", S_IRUGO | S_IWUSR,
+ ieee80211_proc, &fops);
if (!e) {
remove_proc_entry(DRV_NAME, init_net.proc_net);
ieee80211_proc = NULL;
return -EIO;
}
- e->read_proc = show_debug_level;
- e->write_proc = store_debug_level;
- e->data = NULL;
-
return 0;
}
diff --git a/drivers/staging/rtl8192u/ieee80211/proc.c b/drivers/staging/rtl8192u/ieee80211/proc.c
index 6eda928e409..c426dfdd9fd 100644
--- a/drivers/staging/rtl8192u/ieee80211/proc.c
+++ b/drivers/staging/rtl8192u/ieee80211/proc.c
@@ -99,7 +99,7 @@ static int crypto_info_open(struct inode *inode, struct file *file)
return seq_open(file, &crypto_seq_ops);
}
-static struct file_operations proc_crypto_ops = {
+static const struct file_operations proc_crypto_ops = {
.open = crypto_info_open,
.read = seq_read,
.llseek = seq_lseek,
@@ -108,9 +108,5 @@ static struct file_operations proc_crypto_ops = {
void __init crypto_init_proc(void)
{
- struct proc_dir_entry *proc;
-
- proc = create_proc_entry("crypto", 0, NULL);
- if (proc)
- proc->proc_fops = &proc_crypto_ops;
+ proc_create("crypto", 0, NULL, &proc_crypto_ops);
}
diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h
index e538e026b51..bedeb330ad4 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -946,7 +946,6 @@ typedef struct r8192_priv {
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
- struct proc_dir_entry *dir_dev;
/*RX stuff*/
// u32 *rxring;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index f7de2f6d49a..14592339755 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -71,6 +71,8 @@ double __extendsfdf2(float a) {return a;}
//#include "r8192xU_phyreg.h"
#include <linux/usb.h>
#include <linux/slab.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
// FIXME: check if 2.6.7 is ok
#ifdef CONFIG_RTL8192_PM
@@ -472,103 +474,73 @@ void watch_dog_timer_callback(unsigned long data);
static struct proc_dir_entry *rtl8192_proc;
-static int proc_get_stats_ap(char *page, char **start, off_t offset, int count,
- int *eof, void *data)
+static int proc_get_stats_ap(struct seq_file *m, void *v)
{
- struct net_device *dev = data;
+ struct net_device *dev = m->private;
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
struct ieee80211_device *ieee = priv->ieee80211;
struct ieee80211_network *target;
- int len = 0;
-
list_for_each_entry(target, &ieee->network_list, list) {
-
- len += snprintf(page + len, count - len, "%s ", target->ssid);
-
+ const char *wpa = "non_WPA";
if (target->wpa_ie_len > 0 || target->rsn_ie_len > 0)
- len += snprintf(page + len, count - len, "WPA\n");
- else
- len += snprintf(page + len, count - len, "non_WPA\n");
+ wpa = "WPA";
+
+ seq_printf(m, "%s %s\n", target->ssid, wpa);
}
- *eof = 1;
- return len;
+ return 0;
}
-static int proc_get_registers(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
+static int proc_get_registers(struct seq_file *m, void *v)
{
- struct net_device *dev = data;
-// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+ struct net_device *dev = m->private;
+ int i,n, max = 0xff;
- int len = 0;
- int i,n;
-
- int max=0xff;
-
- /* This dump the current register page */
- len += snprintf(page + len, count - len,
- "\n####################page 0##################\n ");
+ seq_puts(m, "\n####################page 0##################\n ");
for (n=0;n<=max;) {
//printk( "\nD: %2x> ", n);
- len += snprintf(page + len, count - len,
- "\nD: %2x > ",n);
+ seq_printf(m, "\nD: %2x > ",n);
for (i=0;i<16 && n<=max;i++,n++)
- len += snprintf(page + len, count - len,
- "%2x ",read_nic_byte(dev,0x000|n));
+ seq_printf(m, "%2x ",read_nic_byte(dev,0x000|n));
// printk("%2x ",read_nic_byte(dev,n));
}
- len += snprintf(page + len, count - len,
- "\n####################page 1##################\n ");
+
+ seq_puts(m, "\n####################page 1##################\n ");
for (n=0;n<=max;) {
//printk( "\nD: %2x> ", n);
- len += snprintf(page + len, count - len,
- "\nD: %2x > ",n);
+ seq_printf(m, "\nD: %2x > ",n);
for (i=0;i<16 && n<=max;i++,n++)
- len += snprintf(page + len, count - len,
- "%2x ",read_nic_byte(dev,0x100|n));
+ seq_printf(m, "%2x ",read_nic_byte(dev,0x100|n));
// printk("%2x ",read_nic_byte(dev,n));
}
- len += snprintf(page + len, count - len,
- "\n####################page 3##################\n ");
+
+ seq_puts(m, "\n####################page 3##################\n ");
for (n=0;n<=max;) {
//printk( "\nD: %2x> ", n);
- len += snprintf(page + len, count - len,
- "\nD: %2x > ",n);
+ seq_printf(m, "\nD: %2x > ",n);
for(i=0;i<16 && n<=max;i++,n++)
- len += snprintf(page + len, count - len,
- "%2x ",read_nic_byte(dev,0x300|n));
+ seq_printf(m, "%2x ",read_nic_byte(dev,0x300|n));
// printk("%2x ",read_nic_byte(dev,n));
}
- len += snprintf(page + len, count - len,"\n");
- *eof = 1;
- return len;
+ seq_putc(m, '\n');
+ return 0;
}
-
-
-
-
-static int proc_get_stats_tx(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
+static int proc_get_stats_tx(struct seq_file *m, void *v)
{
- struct net_device *dev = data;
+ struct net_device *dev = m->private;
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
- int len = 0;
-
- len += snprintf(page + len, count - len,
+ seq_printf(m,
"TX VI priority ok int: %lu\n"
"TX VI priority error int: %lu\n"
"TX VO priority ok int: %lu\n"
@@ -629,22 +601,15 @@ static int proc_get_stats_tx(char *page, char **start,
// priv->stats.txbeaconerr
);
- *eof = 1;
- return len;
+ return 0;
}
-
-
-static int proc_get_stats_rx(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
+static int proc_get_stats_rx(struct seq_file *m, void *v)
{
- struct net_device *dev = data;
+ struct net_device *dev = m->private;
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
- int len = 0;
-
- len += snprintf(page + len, count - len,
+ seq_printf(m,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
"RX invalid urb error: %lu\n",
@@ -652,9 +617,9 @@ static int proc_get_stats_rx(char *page, char **start,
priv->stats.rxstaterr,
priv->stats.rxurberr);
- *eof = 1;
- return len;
+ return 0;
}
+
void rtl8192_proc_module_init(void)
{
RT_TRACE(COMP_INIT, "Initializing proc filesystem");
@@ -667,74 +632,70 @@ void rtl8192_proc_module_remove(void)
remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net);
}
-
-void rtl8192_proc_remove_one(struct net_device *dev)
+/*
+ * seq_file wrappers for procfile show routines.
+ */
+static int rtl8192_proc_open(struct inode *inode, struct file *file)
{
- struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+ struct net_device *dev = proc_get_parent_data(inode);
+ int (*show)(struct seq_file *, void *) = PDE_DATA(inode);
-
- if (priv->dir_dev) {
- // remove_proc_entry("stats-hw", priv->dir_dev);
- remove_proc_entry("stats-tx", priv->dir_dev);
- remove_proc_entry("stats-rx", priv->dir_dev);
- // remove_proc_entry("stats-ieee", priv->dir_dev);
- remove_proc_entry("stats-ap", priv->dir_dev);
- remove_proc_entry("registers", priv->dir_dev);
- // remove_proc_entry("cck-registers",priv->dir_dev);
- // remove_proc_entry("ofdm-registers",priv->dir_dev);
- //remove_proc_entry(dev->name, rtl8192_proc);
- remove_proc_entry("wlan0", rtl8192_proc);
- priv->dir_dev = NULL;
- }
+ return single_open(file, show, dev);
}
+static const struct file_operations rtl8192_proc_fops = {
+ .open = rtl8192_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
-void rtl8192_proc_init_one(struct net_device *dev)
-{
- struct proc_dir_entry *e;
- struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
- priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc);
- if (!priv->dir_dev) {
- RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n",
- dev->name);
- return;
- }
- e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_rx, dev);
-
- if (!e) {
- RT_TRACE(COMP_ERR,"Unable to initialize "
- "/proc/net/rtl8192/%s/stats-rx\n",
- dev->name);
- }
-
+/*
+ * Table of proc files we need to create.
+ */
+struct rtl8192_proc_file {
+ char name[12];
+ int (*show)(struct seq_file *, void *);
+};
- e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_tx, dev);
+static const struct rtl8192_proc_file rtl8192_proc_files[] = {
+ { "stats-rx", &proc_get_stats_rx },
+ { "stats-tx", &proc_get_stats_tx },
+ { "stats-ap", &proc_get_stats_ap },
+ { "registers", &proc_get_registers },
+ { "" }
+};
- if (!e) {
- RT_TRACE(COMP_ERR, "Unable to initialize "
- "/proc/net/rtl8192/%s/stats-tx\n",
- dev->name);
- }
+void rtl8192_proc_init_one(struct net_device *dev)
+{
+ const struct rtl8192_proc_file *f;
+ struct proc_dir_entry *dir;
- e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_ap, dev);
+ if (rtl8192_proc) {
+ dir = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev);
+ if (!dir) {
+ RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n",
+ dev->name);
+ return;
+ }
- if (!e) {
- RT_TRACE(COMP_ERR, "Unable to initialize "
- "/proc/net/rtl8192/%s/stats-ap\n",
- dev->name);
+ for (f = rtl8192_proc_files; f->name[0]; f++) {
+ if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir,
+ &rtl8192_proc_fops, f->show)) {
+ RT_TRACE(COMP_ERR, "Unable to initialize "
+ "/proc/net/rtl8192/%s/%s\n",
+ dev->name, f->name);
+ return;
+ }
+ }
}
+}
- e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_registers, dev);
- if (!e) {
- RT_TRACE(COMP_ERR, "Unable to initialize "
- "/proc/net/rtl8192/%s/registers\n",
- dev->name);
- }
+void rtl8192_proc_remove_one(struct net_device *dev)
+{
+ remove_proc_subtree(dev->name, rtl8192_proc);
}
+
/****************************************************************************
-----------------------------MISC STUFF-------------------------
*****************************************************************************/