diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2009-11-25 02:14:12 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-28 15:04:54 -0500 |
commit | b8d83392980b65ea548cbf2b1c7c542b51961166 (patch) | |
tree | 0bbe345c96ddaf26a74f08bf794025ad0be8aa5b | |
parent | 83daee06adeed7b294802c998d5e03ea7d856aa1 (diff) |
ipw2x00: convert to seq_file
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ipw2x00/libipw_module.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/net/wireless/ipw2x00/libipw_module.c b/drivers/net/wireless/ipw2x00/libipw_module.c index e8a1ac5f8e11..bf21eb383dbd 100644 --- a/drivers/net/wireless/ipw2x00/libipw_module.c +++ b/drivers/net/wireless/ipw2x00/libipw_module.c | |||
@@ -248,17 +248,22 @@ u32 libipw_debug_level = 0; | |||
248 | EXPORT_SYMBOL_GPL(libipw_debug_level); | 248 | EXPORT_SYMBOL_GPL(libipw_debug_level); |
249 | static struct proc_dir_entry *libipw_proc = NULL; | 249 | static struct proc_dir_entry *libipw_proc = NULL; |
250 | 250 | ||
251 | static int show_debug_level(char *page, char **start, off_t offset, | 251 | static int debug_level_proc_show(struct seq_file *m, void *v) |
252 | int count, int *eof, void *data) | ||
253 | { | 252 | { |
254 | return snprintf(page, count, "0x%08X\n", libipw_debug_level); | 253 | seq_printf(m, "0x%08X\n", libipw_debug_level); |
254 | return 0; | ||
255 | } | 255 | } |
256 | 256 | ||
257 | static int store_debug_level(struct file *file, const char __user * buffer, | 257 | static int debug_level_proc_open(struct inode *inode, struct file *file) |
258 | unsigned long count, void *data) | 258 | { |
259 | return single_open(file, debug_level_proc_show, NULL); | ||
260 | } | ||
261 | |||
262 | static ssize_t debug_level_proc_write(struct file *file, | ||
263 | const char __user *buffer, size_t count, loff_t *pos) | ||
259 | { | 264 | { |
260 | char buf[] = "0x00000000\n"; | 265 | char buf[] = "0x00000000\n"; |
261 | unsigned long len = min((unsigned long)sizeof(buf) - 1, count); | 266 | size_t len = min(sizeof(buf) - 1, count); |
262 | unsigned long val; | 267 | unsigned long val; |
263 | 268 | ||
264 | if (copy_from_user(buf, buffer, len)) | 269 | if (copy_from_user(buf, buffer, len)) |
@@ -272,6 +277,15 @@ static int store_debug_level(struct file *file, const char __user * buffer, | |||
272 | 277 | ||
273 | return strnlen(buf, len); | 278 | return strnlen(buf, len); |
274 | } | 279 | } |
280 | |||
281 | static const struct file_operations debug_level_proc_fops = { | ||
282 | .owner = THIS_MODULE, | ||
283 | .open = debug_level_proc_open, | ||
284 | .read = seq_read, | ||
285 | .llseek = seq_lseek, | ||
286 | .release = single_release, | ||
287 | .write = debug_level_proc_write, | ||
288 | }; | ||
275 | #endif /* CONFIG_LIBIPW_DEBUG */ | 289 | #endif /* CONFIG_LIBIPW_DEBUG */ |
276 | 290 | ||
277 | static int __init libipw_init(void) | 291 | static int __init libipw_init(void) |
@@ -286,16 +300,13 @@ static int __init libipw_init(void) | |||
286 | " proc directory\n"); | 300 | " proc directory\n"); |
287 | return -EIO; | 301 | return -EIO; |
288 | } | 302 | } |
289 | e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, | 303 | e = proc_create("debug_level", S_IRUGO | S_IWUSR, libipw_proc, |
290 | libipw_proc); | 304 | &debug_level_proc_fops); |
291 | if (!e) { | 305 | if (!e) { |
292 | remove_proc_entry(DRV_NAME, init_net.proc_net); | 306 | remove_proc_entry(DRV_NAME, init_net.proc_net); |
293 | libipw_proc = NULL; | 307 | libipw_proc = NULL; |
294 | return -EIO; | 308 | return -EIO; |
295 | } | 309 | } |
296 | e->read_proc = show_debug_level; | ||
297 | e->write_proc = store_debug_level; | ||
298 | e->data = NULL; | ||
299 | #endif /* CONFIG_LIBIPW_DEBUG */ | 310 | #endif /* CONFIG_LIBIPW_DEBUG */ |
300 | 311 | ||
301 | printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); | 312 | printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); |