aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hysdn/hysdn_proclog.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hysdn/hysdn_proclog.c')
-rw-r--r--drivers/isdn/hysdn/hysdn_proclog.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
index c4301e8338ef..fcd49920b220 100644
--- a/drivers/isdn/hysdn/hysdn_proclog.c
+++ b/drivers/isdn/hysdn/hysdn_proclog.c
@@ -116,8 +116,7 @@ put_log_buffer(hysdn_card * card, char *cp)
116 strcpy(ib->log_start, cp); /* set output string */ 116 strcpy(ib->log_start, cp); /* set output string */
117 ib->next = NULL; 117 ib->next = NULL;
118 ib->proc_ctrl = pd; /* point to own control structure */ 118 ib->proc_ctrl = pd; /* point to own control structure */
119 save_flags(flags); 119 spin_lock_irqsave(&card->hysdn_lock, flags);
120 cli();
121 ib->usage_cnt = pd->if_used; 120 ib->usage_cnt = pd->if_used;
122 if (!pd->log_head) 121 if (!pd->log_head)
123 pd->log_head = ib; /* new head */ 122 pd->log_head = ib; /* new head */
@@ -125,7 +124,7 @@ put_log_buffer(hysdn_card * card, char *cp)
125 pd->log_tail->next = ib; /* follows existing messages */ 124 pd->log_tail->next = ib; /* follows existing messages */
126 pd->log_tail = ib; /* new tail */ 125 pd->log_tail = ib; /* new tail */
127 i = pd->del_lock++; /* get lock state */ 126 i = pd->del_lock++; /* get lock state */
128 restore_flags(flags); 127 spin_unlock_irqrestore(&card->hysdn_lock, flags);
129 128
130 /* delete old entrys */ 129 /* delete old entrys */
131 if (!i) 130 if (!i)
@@ -270,14 +269,13 @@ hysdn_log_open(struct inode *ino, struct file *filep)
270 } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { 269 } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) {
271 270
272 /* read access -> log/debug read */ 271 /* read access -> log/debug read */
273 save_flags(flags); 272 spin_lock_irqsave(&card->hysdn_lock, flags);
274 cli();
275 pd->if_used++; 273 pd->if_used++;
276 if (pd->log_head) 274 if (pd->log_head)
277 filep->private_data = &pd->log_tail->next; 275 filep->private_data = &pd->log_tail->next;
278 else 276 else
279 filep->private_data = &pd->log_head; 277 filep->private_data = &pd->log_head;
280 restore_flags(flags); 278 spin_unlock_irqrestore(&card->hysdn_lock, flags);
281 } else { /* simultaneous read/write access forbidden ! */ 279 } else { /* simultaneous read/write access forbidden ! */
282 unlock_kernel(); 280 unlock_kernel();
283 return (-EPERM); /* no permission this time */ 281 return (-EPERM); /* no permission this time */
@@ -301,7 +299,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
301 hysdn_card *card; 299 hysdn_card *card;
302 int retval = 0; 300 int retval = 0;
303 unsigned long flags; 301 unsigned long flags;
304 302 spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
305 303
306 lock_kernel(); 304 lock_kernel();
307 if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { 305 if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
@@ -311,8 +309,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
311 /* read access -> log/debug read, mark one further file as closed */ 309 /* read access -> log/debug read, mark one further file as closed */
312 310
313 pd = NULL; 311 pd = NULL;
314 save_flags(flags); 312 spin_lock_irqsave(&hysdn_lock, flags);
315 cli();
316 inf = *((struct log_data **) filep->private_data); /* get first log entry */ 313 inf = *((struct log_data **) filep->private_data); /* get first log entry */
317 if (inf) 314 if (inf)
318 pd = (struct procdata *) inf->proc_ctrl; /* still entries there */ 315 pd = (struct procdata *) inf->proc_ctrl; /* still entries there */
@@ -335,7 +332,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
335 inf->usage_cnt--; /* decrement usage count for buffers */ 332 inf->usage_cnt--; /* decrement usage count for buffers */
336 inf = inf->next; 333 inf = inf->next;
337 } 334 }
338 restore_flags(flags); 335 spin_unlock_irqrestore(&hysdn_lock, flags);
339 336
340 if (pd) 337 if (pd)
341 if (pd->if_used <= 0) /* delete buffers if last file closed */ 338 if (pd->if_used <= 0) /* delete buffers if last file closed */