aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware/eicon/divasi.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2010-01-14 06:10:54 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-14 06:10:54 -0500
commit9a58a80a701bdb2d220cdab4914218df5b48d781 (patch)
tree01eeb65ec70f22ec326d0938d002cc6a2aec73e8 /drivers/isdn/hardware/eicon/divasi.c
parent508e14b4a4fb1a824a14f2c5b8d7df67b313f8e4 (diff)
proc_fops: convert drivers/isdn/ to seq_file
Convert code away from ->read_proc/->write_proc interfaces. Switch to proc_create()/proc_create_data() which make addition of proc entries reliable wrt NULL ->proc_fops, NULL ->data and so on. Problem with ->read_proc et al is described here commit 786d7e1612f0b0adb6046f19b906609e4fe8b1ba "Fix rmmod/read/write races in /proc entries" [akpm@linux-foundation.org: CONFIG_PROC_FS=n build fix] Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Tilman Schmidt <tilman@imap.cc> Signed-off-by: Karsten Keil <keil@b1-systems.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/hardware/eicon/divasi.c')
-rw-r--r--drivers/isdn/hardware/eicon/divasi.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c
index 69e71ebe7841..f577719ab3fa 100644
--- a/drivers/isdn/hardware/eicon/divasi.c
+++ b/drivers/isdn/hardware/eicon/divasi.c
@@ -17,6 +17,7 @@
17#include <linux/poll.h> 17#include <linux/poll.h>
18#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
19#include <linux/skbuff.h> 19#include <linux/skbuff.h>
20#include <linux/seq_file.h>
20#include <linux/smp_lock.h> 21#include <linux/smp_lock.h>
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
22 23
@@ -86,39 +87,40 @@ static void diva_um_timer_function(unsigned long data);
86extern struct proc_dir_entry *proc_net_eicon; 87extern struct proc_dir_entry *proc_net_eicon;
87static struct proc_dir_entry *um_idi_proc_entry = NULL; 88static struct proc_dir_entry *um_idi_proc_entry = NULL;
88 89
89static int 90static int um_idi_proc_show(struct seq_file *m, void *v)
90um_idi_proc_read(char *page, char **start, off_t off, int count, int *eof,
91 void *data)
92{ 91{
93 int len = 0;
94 char tmprev[32]; 92 char tmprev[32];
95 93
96 len += sprintf(page + len, "%s\n", DRIVERNAME); 94 seq_printf(m, "%s\n", DRIVERNAME);
97 len += sprintf(page + len, "name : %s\n", DRIVERLNAME); 95 seq_printf(m, "name : %s\n", DRIVERLNAME);
98 len += sprintf(page + len, "release : %s\n", DRIVERRELEASE_IDI); 96 seq_printf(m, "release : %s\n", DRIVERRELEASE_IDI);
99 strcpy(tmprev, main_revision); 97 strcpy(tmprev, main_revision);
100 len += sprintf(page + len, "revision : %s\n", getrev(tmprev)); 98 seq_printf(m, "revision : %s\n", getrev(tmprev));
101 len += sprintf(page + len, "build : %s\n", DIVA_BUILD); 99 seq_printf(m, "build : %s\n", DIVA_BUILD);
102 len += sprintf(page + len, "major : %d\n", major); 100 seq_printf(m, "major : %d\n", major);
103 101
104 if (off + count >= len) 102 return 0;
105 *eof = 1; 103}
106 if (len < off) 104
107 return 0; 105static int um_idi_proc_open(struct inode *inode, struct file *file)
108 *start = page + off; 106{
109 return ((count < len - off) ? count : len - off); 107 return single_open(file, um_idi_proc_show, NULL);
110} 108}
111 109
110static const struct file_operations um_idi_proc_fops = {
111 .owner = THIS_MODULE,
112 .open = um_idi_proc_open,
113 .read = seq_read,
114 .llseek = seq_lseek,
115 .release = single_release,
116};
117
112static int DIVA_INIT_FUNCTION create_um_idi_proc(void) 118static int DIVA_INIT_FUNCTION create_um_idi_proc(void)
113{ 119{
114 um_idi_proc_entry = create_proc_entry(DRIVERLNAME, 120 um_idi_proc_entry = proc_create(DRIVERLNAME, S_IRUGO, proc_net_eicon,
115 S_IFREG | S_IRUGO | S_IWUSR, 121 &um_idi_proc_fops);
116 proc_net_eicon);
117 if (!um_idi_proc_entry) 122 if (!um_idi_proc_entry)
118 return (0); 123 return (0);
119
120 um_idi_proc_entry->read_proc = um_idi_proc_read;
121
122 return (1); 124 return (1);
123} 125}
124 126