Commit b8d83392 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by John W. Linville

ipw2x00: convert to seq_file

Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 83daee06
...@@ -248,17 +248,22 @@ u32 libipw_debug_level = 0; ...@@ -248,17 +248,22 @@ u32 libipw_debug_level = 0;
EXPORT_SYMBOL_GPL(libipw_debug_level); EXPORT_SYMBOL_GPL(libipw_debug_level);
static struct proc_dir_entry *libipw_proc = NULL; static struct proc_dir_entry *libipw_proc = NULL;
static int show_debug_level(char *page, char **start, off_t offset, static int debug_level_proc_show(struct seq_file *m, void *v)
int count, int *eof, void *data)
{ {
return snprintf(page, count, "0x%08X\n", libipw_debug_level); seq_printf(m, "0x%08X\n", libipw_debug_level);
return 0;
} }
static int store_debug_level(struct file *file, const char __user * buffer, static int debug_level_proc_open(struct inode *inode, struct file *file)
unsigned long count, void *data) {
return single_open(file, debug_level_proc_show, NULL);
}
static ssize_t debug_level_proc_write(struct file *file,
const char __user *buffer, size_t count, loff_t *pos)
{ {
char buf[] = "0x00000000\n"; char buf[] = "0x00000000\n";
unsigned long len = min((unsigned long)sizeof(buf) - 1, count); size_t len = min(sizeof(buf) - 1, count);
unsigned long val; unsigned long val;
if (copy_from_user(buf, buffer, len)) if (copy_from_user(buf, buffer, len))
...@@ -272,6 +277,15 @@ static int store_debug_level(struct file *file, const char __user * buffer, ...@@ -272,6 +277,15 @@ static int store_debug_level(struct file *file, const char __user * buffer,
return strnlen(buf, len); return strnlen(buf, len);
} }
static const struct file_operations debug_level_proc_fops = {
.owner = THIS_MODULE,
.open = debug_level_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = debug_level_proc_write,
};
#endif /* CONFIG_LIBIPW_DEBUG */ #endif /* CONFIG_LIBIPW_DEBUG */
static int __init libipw_init(void) static int __init libipw_init(void)
...@@ -286,16 +300,13 @@ static int __init libipw_init(void) ...@@ -286,16 +300,13 @@ static int __init libipw_init(void)
" proc directory\n"); " proc directory\n");
return -EIO; return -EIO;
} }
e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, e = proc_create("debug_level", S_IRUGO | S_IWUSR, libipw_proc,
libipw_proc); &debug_level_proc_fops);
if (!e) { if (!e) {
remove_proc_entry(DRV_NAME, init_net.proc_net); remove_proc_entry(DRV_NAME, init_net.proc_net);
libipw_proc = NULL; libipw_proc = NULL;
return -EIO; return -EIO;
} }
e->read_proc = show_debug_level;
e->write_proc = store_debug_level;
e->data = NULL;
#endif /* CONFIG_LIBIPW_DEBUG */ #endif /* CONFIG_LIBIPW_DEBUG */
printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment