aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/mISDN/timerdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/mISDN/timerdev.c')
-rw-r--r--drivers/isdn/mISDN/timerdev.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c
index b5fabc7019d8..875fabe16e36 100644
--- a/drivers/isdn/mISDN/timerdev.c
+++ b/drivers/isdn/mISDN/timerdev.c
@@ -61,7 +61,7 @@ mISDN_open(struct inode *ino, struct file *filep)
61 init_waitqueue_head(&dev->wait); 61 init_waitqueue_head(&dev->wait);
62 filep->private_data = dev; 62 filep->private_data = dev;
63 __module_get(THIS_MODULE); 63 __module_get(THIS_MODULE);
64 return 0; 64 return nonseekable_open(ino, filep);
65} 65}
66 66
67static int 67static int
@@ -124,18 +124,6 @@ mISDN_read(struct file *filep, char *buf, size_t count, loff_t *off)
124 return ret; 124 return ret;
125} 125}
126 126
127static loff_t
128mISDN_llseek(struct file *filep, loff_t offset, int orig)
129{
130 return -ESPIPE;
131}
132
133static ssize_t
134mISDN_write(struct file *filep, const char *buf, size_t count, loff_t *off)
135{
136 return -EOPNOTSUPP;
137}
138
139static unsigned int 127static unsigned int
140mISDN_poll(struct file *filep, poll_table *wait) 128mISDN_poll(struct file *filep, poll_table *wait)
141{ 129{
@@ -157,8 +145,9 @@ mISDN_poll(struct file *filep, poll_table *wait)
157} 145}
158 146
159static void 147static void
160dev_expire_timer(struct mISDNtimer *timer) 148dev_expire_timer(unsigned long data)
161{ 149{
150 struct mISDNtimer *timer = (void *)data;
162 u_long flags; 151 u_long flags;
163 152
164 spin_lock_irqsave(&timer->dev->lock, flags); 153 spin_lock_irqsave(&timer->dev->lock, flags);
@@ -191,7 +180,7 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout)
191 spin_unlock_irqrestore(&dev->lock, flags); 180 spin_unlock_irqrestore(&dev->lock, flags);
192 timer->dev = dev; 181 timer->dev = dev;
193 timer->tl.data = (long)timer; 182 timer->tl.data = (long)timer;
194 timer->tl.function = (void *) dev_expire_timer; 183 timer->tl.function = dev_expire_timer;
195 init_timer(&timer->tl); 184 init_timer(&timer->tl);
196 timer->tl.expires = jiffies + ((HZ * (u_long)timeout) / 1000); 185 timer->tl.expires = jiffies + ((HZ * (u_long)timeout) / 1000);
197 add_timer(&timer->tl); 186 add_timer(&timer->tl);
@@ -211,6 +200,9 @@ misdn_del_timer(struct mISDNtimerdev *dev, int id)
211 list_for_each_entry(timer, &dev->pending, list) { 200 list_for_each_entry(timer, &dev->pending, list) {
212 if (timer->id == id) { 201 if (timer->id == id) {
213 list_del_init(&timer->list); 202 list_del_init(&timer->list);
203 /* RED-PEN AK: race -- timer can be still running on
204 * other CPU. Needs reference count I think
205 */
214 del_timer(&timer->tl); 206 del_timer(&timer->tl);
215 ret = timer->id; 207 ret = timer->id;
216 kfree(timer); 208 kfree(timer);
@@ -268,9 +260,7 @@ mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
268} 260}
269 261
270static struct file_operations mISDN_fops = { 262static struct file_operations mISDN_fops = {
271 .llseek = mISDN_llseek,
272 .read = mISDN_read, 263 .read = mISDN_read,
273 .write = mISDN_write,
274 .poll = mISDN_poll, 264 .poll = mISDN_poll,
275 .ioctl = mISDN_ioctl, 265 .ioctl = mISDN_ioctl,
276 .open = mISDN_open, 266 .open = mISDN_open,