diff options
Diffstat (limited to 'drivers/net/irda/irtty-sir.c')
-rw-r--r-- | drivers/net/irda/irtty-sir.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index 101750bf210f..6a98b7ae4975 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | #include <linux/smp_lock.h> | 34 | #include <linux/smp_lock.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/mutex.h> | ||
36 | 37 | ||
37 | #include <net/irda/irda.h> | 38 | #include <net/irda/irda.h> |
38 | #include <net/irda/irda_device.h> | 39 | #include <net/irda/irda_device.h> |
@@ -338,7 +339,7 @@ static inline void irtty_stop_receiver(struct tty_struct *tty, int stop) | |||
338 | /*****************************************************************/ | 339 | /*****************************************************************/ |
339 | 340 | ||
340 | /* serialize ldisc open/close with sir_dev */ | 341 | /* serialize ldisc open/close with sir_dev */ |
341 | static DECLARE_MUTEX(irtty_sem); | 342 | static DEFINE_MUTEX(irtty_mutex); |
342 | 343 | ||
343 | /* notifier from sir_dev when irda% device gets opened (ifup) */ | 344 | /* notifier from sir_dev when irda% device gets opened (ifup) */ |
344 | 345 | ||
@@ -348,11 +349,11 @@ static int irtty_start_dev(struct sir_dev *dev) | |||
348 | struct tty_struct *tty; | 349 | struct tty_struct *tty; |
349 | 350 | ||
350 | /* serialize with ldisc open/close */ | 351 | /* serialize with ldisc open/close */ |
351 | down(&irtty_sem); | 352 | mutex_lock(&irtty_mutex); |
352 | 353 | ||
353 | priv = dev->priv; | 354 | priv = dev->priv; |
354 | if (unlikely(!priv || priv->magic!=IRTTY_MAGIC)) { | 355 | if (unlikely(!priv || priv->magic!=IRTTY_MAGIC)) { |
355 | up(&irtty_sem); | 356 | mutex_unlock(&irtty_mutex); |
356 | return -ESTALE; | 357 | return -ESTALE; |
357 | } | 358 | } |
358 | 359 | ||
@@ -363,7 +364,7 @@ static int irtty_start_dev(struct sir_dev *dev) | |||
363 | /* Make sure we can receive more data */ | 364 | /* Make sure we can receive more data */ |
364 | irtty_stop_receiver(tty, FALSE); | 365 | irtty_stop_receiver(tty, FALSE); |
365 | 366 | ||
366 | up(&irtty_sem); | 367 | mutex_unlock(&irtty_mutex); |
367 | return 0; | 368 | return 0; |
368 | } | 369 | } |
369 | 370 | ||
@@ -375,11 +376,11 @@ static int irtty_stop_dev(struct sir_dev *dev) | |||
375 | struct tty_struct *tty; | 376 | struct tty_struct *tty; |
376 | 377 | ||
377 | /* serialize with ldisc open/close */ | 378 | /* serialize with ldisc open/close */ |
378 | down(&irtty_sem); | 379 | mutex_lock(&irtty_mutex); |
379 | 380 | ||
380 | priv = dev->priv; | 381 | priv = dev->priv; |
381 | if (unlikely(!priv || priv->magic!=IRTTY_MAGIC)) { | 382 | if (unlikely(!priv || priv->magic!=IRTTY_MAGIC)) { |
382 | up(&irtty_sem); | 383 | mutex_unlock(&irtty_mutex); |
383 | return -ESTALE; | 384 | return -ESTALE; |
384 | } | 385 | } |
385 | 386 | ||
@@ -390,7 +391,7 @@ static int irtty_stop_dev(struct sir_dev *dev) | |||
390 | if (tty->driver->stop) | 391 | if (tty->driver->stop) |
391 | tty->driver->stop(tty); | 392 | tty->driver->stop(tty); |
392 | 393 | ||
393 | up(&irtty_sem); | 394 | mutex_unlock(&irtty_mutex); |
394 | 395 | ||
395 | return 0; | 396 | return 0; |
396 | } | 397 | } |
@@ -514,13 +515,13 @@ static int irtty_open(struct tty_struct *tty) | |||
514 | priv->dev = dev; | 515 | priv->dev = dev; |
515 | 516 | ||
516 | /* serialize with start_dev - in case we were racing with ifup */ | 517 | /* serialize with start_dev - in case we were racing with ifup */ |
517 | down(&irtty_sem); | 518 | mutex_lock(&irtty_mutex); |
518 | 519 | ||
519 | dev->priv = priv; | 520 | dev->priv = priv; |
520 | tty->disc_data = priv; | 521 | tty->disc_data = priv; |
521 | tty->receive_room = 65536; | 522 | tty->receive_room = 65536; |
522 | 523 | ||
523 | up(&irtty_sem); | 524 | mutex_unlock(&irtty_mutex); |
524 | 525 | ||
525 | IRDA_DEBUG(0, "%s - %s: irda line discipline opened\n", __FUNCTION__, tty->name); | 526 | IRDA_DEBUG(0, "%s - %s: irda line discipline opened\n", __FUNCTION__, tty->name); |
526 | 527 | ||