diff options
author | Tilman Schmidt <tilman@imap.cc> | 2006-04-11 01:55:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-11 09:18:50 -0400 |
commit | abfd1dc7c18e4be89715071a524324c7b2515565 (patch) | |
tree | 84109f661246b66b2a7503164ec41e4382e37812 /drivers/isdn/gigaset/interface.c | |
parent | 01371500b245ae63f542d74140a3d8ccb74d0318 (diff) |
[PATCH] isdn4linux: Siemens Gigaset drivers: mutex conversion
With Hansjoerg Lipp <hjlipp@web.de>
Convert the semaphores used by the Gigaset drivers to mutexes.
Signed-off-by: Hansjoerg Lipp <hjlipp@web.de>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/gigaset/interface.c')
-rw-r--r-- | drivers/isdn/gigaset/interface.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index 25750864d20..ac408acaaf1 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c | |||
@@ -160,7 +160,7 @@ static int if_open(struct tty_struct *tty, struct file *filp) | |||
160 | if (!cs) | 160 | if (!cs) |
161 | return -ENODEV; | 161 | return -ENODEV; |
162 | 162 | ||
163 | if (down_interruptible(&cs->sem)) | 163 | if (mutex_lock_interruptible(&cs->mutex)) |
164 | return -ERESTARTSYS; // FIXME -EINTR? | 164 | return -ERESTARTSYS; // FIXME -EINTR? |
165 | tty->driver_data = cs; | 165 | tty->driver_data = cs; |
166 | 166 | ||
@@ -173,7 +173,7 @@ static int if_open(struct tty_struct *tty, struct file *filp) | |||
173 | tty->low_latency = 1; //FIXME test | 173 | tty->low_latency = 1; //FIXME test |
174 | } | 174 | } |
175 | 175 | ||
176 | up(&cs->sem); | 176 | mutex_unlock(&cs->mutex); |
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
179 | 179 | ||
@@ -190,7 +190,7 @@ static void if_close(struct tty_struct *tty, struct file *filp) | |||
190 | 190 | ||
191 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 191 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
192 | 192 | ||
193 | down(&cs->sem); | 193 | mutex_lock(&cs->mutex); |
194 | 194 | ||
195 | if (!cs->open_count) | 195 | if (!cs->open_count) |
196 | warn("%s: device not opened", __func__); | 196 | warn("%s: device not opened", __func__); |
@@ -202,7 +202,7 @@ static void if_close(struct tty_struct *tty, struct file *filp) | |||
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | up(&cs->sem); | 205 | mutex_unlock(&cs->mutex); |
206 | } | 206 | } |
207 | 207 | ||
208 | static int if_ioctl(struct tty_struct *tty, struct file *file, | 208 | static int if_ioctl(struct tty_struct *tty, struct file *file, |
@@ -222,7 +222,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file, | |||
222 | 222 | ||
223 | gig_dbg(DEBUG_IF, "%u: %s(0x%x)", cs->minor_index, __func__, cmd); | 223 | gig_dbg(DEBUG_IF, "%u: %s(0x%x)", cs->minor_index, __func__, cmd); |
224 | 224 | ||
225 | if (down_interruptible(&cs->sem)) | 225 | if (mutex_lock_interruptible(&cs->mutex)) |
226 | return -ERESTARTSYS; // FIXME -EINTR? | 226 | return -ERESTARTSYS; // FIXME -EINTR? |
227 | 227 | ||
228 | if (!cs->open_count) | 228 | if (!cs->open_count) |
@@ -279,7 +279,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file, | |||
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
282 | up(&cs->sem); | 282 | mutex_unlock(&cs->mutex); |
283 | 283 | ||
284 | return retval; | 284 | return retval; |
285 | } | 285 | } |
@@ -297,13 +297,13 @@ static int if_tiocmget(struct tty_struct *tty, struct file *file) | |||
297 | 297 | ||
298 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 298 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
299 | 299 | ||
300 | if (down_interruptible(&cs->sem)) | 300 | if (mutex_lock_interruptible(&cs->mutex)) |
301 | return -ERESTARTSYS; // FIXME -EINTR? | 301 | return -ERESTARTSYS; // FIXME -EINTR? |
302 | 302 | ||
303 | // FIXME read from device? | 303 | // FIXME read from device? |
304 | retval = cs->control_state & (TIOCM_RTS|TIOCM_DTR); | 304 | retval = cs->control_state & (TIOCM_RTS|TIOCM_DTR); |
305 | 305 | ||
306 | up(&cs->sem); | 306 | mutex_unlock(&cs->mutex); |
307 | 307 | ||
308 | return retval; | 308 | return retval; |
309 | } | 309 | } |
@@ -324,7 +324,7 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file, | |||
324 | gig_dbg(DEBUG_IF, "%u: %s(0x%x, 0x%x)", | 324 | gig_dbg(DEBUG_IF, "%u: %s(0x%x, 0x%x)", |
325 | cs->minor_index, __func__, set, clear); | 325 | cs->minor_index, __func__, set, clear); |
326 | 326 | ||
327 | if (down_interruptible(&cs->sem)) | 327 | if (mutex_lock_interruptible(&cs->mutex)) |
328 | return -ERESTARTSYS; // FIXME -EINTR? | 328 | return -ERESTARTSYS; // FIXME -EINTR? |
329 | 329 | ||
330 | if (!atomic_read(&cs->connected)) { | 330 | if (!atomic_read(&cs->connected)) { |
@@ -336,7 +336,7 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file, | |||
336 | cs->control_state = mc; | 336 | cs->control_state = mc; |
337 | } | 337 | } |
338 | 338 | ||
339 | up(&cs->sem); | 339 | mutex_unlock(&cs->mutex); |
340 | 340 | ||
341 | return retval; | 341 | return retval; |
342 | } | 342 | } |
@@ -354,7 +354,7 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count) | |||
354 | 354 | ||
355 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 355 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
356 | 356 | ||
357 | if (down_interruptible(&cs->sem)) | 357 | if (mutex_lock_interruptible(&cs->mutex)) |
358 | return -ERESTARTSYS; // FIXME -EINTR? | 358 | return -ERESTARTSYS; // FIXME -EINTR? |
359 | 359 | ||
360 | if (!cs->open_count) | 360 | if (!cs->open_count) |
@@ -370,7 +370,7 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count) | |||
370 | &cs->if_wake_tasklet); | 370 | &cs->if_wake_tasklet); |
371 | } | 371 | } |
372 | 372 | ||
373 | up(&cs->sem); | 373 | mutex_unlock(&cs->mutex); |
374 | 374 | ||
375 | return retval; | 375 | return retval; |
376 | } | 376 | } |
@@ -388,7 +388,7 @@ static int if_write_room(struct tty_struct *tty) | |||
388 | 388 | ||
389 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 389 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
390 | 390 | ||
391 | if (down_interruptible(&cs->sem)) | 391 | if (mutex_lock_interruptible(&cs->mutex)) |
392 | return -ERESTARTSYS; // FIXME -EINTR? | 392 | return -ERESTARTSYS; // FIXME -EINTR? |
393 | 393 | ||
394 | if (!cs->open_count) | 394 | if (!cs->open_count) |
@@ -402,7 +402,7 @@ static int if_write_room(struct tty_struct *tty) | |||
402 | } else | 402 | } else |
403 | retval = cs->ops->write_room(cs); | 403 | retval = cs->ops->write_room(cs); |
404 | 404 | ||
405 | up(&cs->sem); | 405 | mutex_unlock(&cs->mutex); |
406 | 406 | ||
407 | return retval; | 407 | return retval; |
408 | } | 408 | } |
@@ -420,7 +420,7 @@ static int if_chars_in_buffer(struct tty_struct *tty) | |||
420 | 420 | ||
421 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 421 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
422 | 422 | ||
423 | if (down_interruptible(&cs->sem)) | 423 | if (mutex_lock_interruptible(&cs->mutex)) |
424 | return -ERESTARTSYS; // FIXME -EINTR? | 424 | return -ERESTARTSYS; // FIXME -EINTR? |
425 | 425 | ||
426 | if (!cs->open_count) | 426 | if (!cs->open_count) |
@@ -434,7 +434,7 @@ static int if_chars_in_buffer(struct tty_struct *tty) | |||
434 | } else | 434 | } else |
435 | retval = cs->ops->chars_in_buffer(cs); | 435 | retval = cs->ops->chars_in_buffer(cs); |
436 | 436 | ||
437 | up(&cs->sem); | 437 | mutex_unlock(&cs->mutex); |
438 | 438 | ||
439 | return retval; | 439 | return retval; |
440 | } | 440 | } |
@@ -451,7 +451,7 @@ static void if_throttle(struct tty_struct *tty) | |||
451 | 451 | ||
452 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 452 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
453 | 453 | ||
454 | down(&cs->sem); | 454 | mutex_lock(&cs->mutex); |
455 | 455 | ||
456 | if (!cs->open_count) | 456 | if (!cs->open_count) |
457 | warn("%s: device not opened", __func__); | 457 | warn("%s: device not opened", __func__); |
@@ -459,7 +459,7 @@ static void if_throttle(struct tty_struct *tty) | |||
459 | //FIXME | 459 | //FIXME |
460 | } | 460 | } |
461 | 461 | ||
462 | up(&cs->sem); | 462 | mutex_unlock(&cs->mutex); |
463 | } | 463 | } |
464 | 464 | ||
465 | static void if_unthrottle(struct tty_struct *tty) | 465 | static void if_unthrottle(struct tty_struct *tty) |
@@ -474,7 +474,7 @@ static void if_unthrottle(struct tty_struct *tty) | |||
474 | 474 | ||
475 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 475 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
476 | 476 | ||
477 | down(&cs->sem); | 477 | mutex_lock(&cs->mutex); |
478 | 478 | ||
479 | if (!cs->open_count) | 479 | if (!cs->open_count) |
480 | warn("%s: device not opened", __func__); | 480 | warn("%s: device not opened", __func__); |
@@ -482,7 +482,7 @@ static void if_unthrottle(struct tty_struct *tty) | |||
482 | //FIXME | 482 | //FIXME |
483 | } | 483 | } |
484 | 484 | ||
485 | up(&cs->sem); | 485 | mutex_unlock(&cs->mutex); |
486 | } | 486 | } |
487 | 487 | ||
488 | static void if_set_termios(struct tty_struct *tty, struct termios *old) | 488 | static void if_set_termios(struct tty_struct *tty, struct termios *old) |
@@ -501,7 +501,7 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old) | |||
501 | 501 | ||
502 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 502 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
503 | 503 | ||
504 | down(&cs->sem); | 504 | mutex_lock(&cs->mutex); |
505 | 505 | ||
506 | if (!cs->open_count) { | 506 | if (!cs->open_count) { |
507 | warn("%s: device not opened", __func__); | 507 | warn("%s: device not opened", __func__); |
@@ -586,7 +586,7 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old) | |||
586 | cs->control_state = control_state; | 586 | cs->control_state = control_state; |
587 | 587 | ||
588 | out: | 588 | out: |
589 | up(&cs->sem); | 589 | mutex_unlock(&cs->mutex); |
590 | } | 590 | } |
591 | 591 | ||
592 | 592 | ||