diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-21 12:25:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-21 12:25:47 -0500 |
commit | 2bf2154c6bb5599e3ec3f73c34861a0b12aa839e (patch) | |
tree | 62691bd915e2e3c2e6648306d3fb893f7a1dc57e /drivers/usb/class/cdc-acm.c | |
parent | 08a4ecee986dd98e86090ff5faac4782b6765aed (diff) | |
parent | 71a8924bee63d891f6256d560e32416a458440b3 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (81 commits)
[PATCH] USB: omninet: fix up debugging comments
[PATCH] USB serial: add navman driver
[PATCH] USB: Fix irda-usb use after use
[PATCH] USB: rtl8150 small fix
[PATCH] USB: ftdi_sio: add Icom ID1 USB product and vendor ids
[PATCH] USB: cp2101: add new device IDs
[PATCH] USB: fix check_ctrlrecip to allow control transfers in state ADDRESS
[PATCH] USB: vicam.c: fix a NULL pointer dereference
[PATCH] USB: ZC0301 driver bugfix
[PATCH] USB: add support for Creativelabs Silvercrest USB keyboard
[PATCH] USB: storage: new unusual_devs.h entry: Mitsumi 7in1 Card Reader
[PATCH] USB: storage: unusual_devs.h entry 0420:0001
[PATCH] USB: storage: another unusual_devs.h entry
[PATCH] USB: storage: sandisk unusual_devices entry
[PATCH] USB: fix initdata issue in isp116x-hcd
[PATCH] USB: usbcore: usb_set_configuration oops (NULL ptr dereference)
[PATCH] USB: usbcore: Don't assume a USB configuration includes any interfaces
[PATCH] USB: ub 03 drop stall clearing
[PATCH] USB: ub 02 remove diag
[PATCH] USB: ub 01 remove first_open
...
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 97bdeb1c2181..6dd339f4c0fc 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/tty_flip.h> | 60 | #include <linux/tty_flip.h> |
61 | #include <linux/module.h> | 61 | #include <linux/module.h> |
62 | #include <linux/smp_lock.h> | 62 | #include <linux/smp_lock.h> |
63 | #include <linux/mutex.h> | ||
63 | #include <asm/uaccess.h> | 64 | #include <asm/uaccess.h> |
64 | #include <linux/usb.h> | 65 | #include <linux/usb.h> |
65 | #include <linux/usb_cdc.h> | 66 | #include <linux/usb_cdc.h> |
@@ -80,7 +81,7 @@ static struct usb_driver acm_driver; | |||
80 | static struct tty_driver *acm_tty_driver; | 81 | static struct tty_driver *acm_tty_driver; |
81 | static struct acm *acm_table[ACM_TTY_MINORS]; | 82 | static struct acm *acm_table[ACM_TTY_MINORS]; |
82 | 83 | ||
83 | static DECLARE_MUTEX(open_sem); | 84 | static DEFINE_MUTEX(open_mutex); |
84 | 85 | ||
85 | #define ACM_READY(acm) (acm && acm->dev && acm->used) | 86 | #define ACM_READY(acm) (acm && acm->dev && acm->used) |
86 | 87 | ||
@@ -431,8 +432,8 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) | |||
431 | int rv = -EINVAL; | 432 | int rv = -EINVAL; |
432 | int i; | 433 | int i; |
433 | dbg("Entering acm_tty_open.\n"); | 434 | dbg("Entering acm_tty_open.\n"); |
434 | 435 | ||
435 | down(&open_sem); | 436 | mutex_lock(&open_mutex); |
436 | 437 | ||
437 | acm = acm_table[tty->index]; | 438 | acm = acm_table[tty->index]; |
438 | if (!acm || !acm->dev) | 439 | if (!acm || !acm->dev) |
@@ -474,14 +475,14 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) | |||
474 | 475 | ||
475 | done: | 476 | done: |
476 | err_out: | 477 | err_out: |
477 | up(&open_sem); | 478 | mutex_unlock(&open_mutex); |
478 | return rv; | 479 | return rv; |
479 | 480 | ||
480 | full_bailout: | 481 | full_bailout: |
481 | usb_kill_urb(acm->ctrlurb); | 482 | usb_kill_urb(acm->ctrlurb); |
482 | bail_out: | 483 | bail_out: |
483 | acm->used--; | 484 | acm->used--; |
484 | up(&open_sem); | 485 | mutex_unlock(&open_mutex); |
485 | return -EIO; | 486 | return -EIO; |
486 | } | 487 | } |
487 | 488 | ||
@@ -507,7 +508,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) | |||
507 | if (!acm || !acm->used) | 508 | if (!acm || !acm->used) |
508 | return; | 509 | return; |
509 | 510 | ||
510 | down(&open_sem); | 511 | mutex_lock(&open_mutex); |
511 | if (!--acm->used) { | 512 | if (!--acm->used) { |
512 | if (acm->dev) { | 513 | if (acm->dev) { |
513 | acm_set_control(acm, acm->ctrlout = 0); | 514 | acm_set_control(acm, acm->ctrlout = 0); |
@@ -518,7 +519,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) | |||
518 | } else | 519 | } else |
519 | acm_tty_unregister(acm); | 520 | acm_tty_unregister(acm); |
520 | } | 521 | } |
521 | up(&open_sem); | 522 | mutex_unlock(&open_mutex); |
522 | } | 523 | } |
523 | 524 | ||
524 | static int acm_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) | 525 | static int acm_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) |
@@ -1013,9 +1014,9 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1013 | return; | 1014 | return; |
1014 | } | 1015 | } |
1015 | 1016 | ||
1016 | down(&open_sem); | 1017 | mutex_lock(&open_mutex); |
1017 | if (!usb_get_intfdata(intf)) { | 1018 | if (!usb_get_intfdata(intf)) { |
1018 | up(&open_sem); | 1019 | mutex_unlock(&open_mutex); |
1019 | return; | 1020 | return; |
1020 | } | 1021 | } |
1021 | acm->dev = NULL; | 1022 | acm->dev = NULL; |
@@ -1045,11 +1046,11 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1045 | 1046 | ||
1046 | if (!acm->used) { | 1047 | if (!acm->used) { |
1047 | acm_tty_unregister(acm); | 1048 | acm_tty_unregister(acm); |
1048 | up(&open_sem); | 1049 | mutex_unlock(&open_mutex); |
1049 | return; | 1050 | return; |
1050 | } | 1051 | } |
1051 | 1052 | ||
1052 | up(&open_sem); | 1053 | mutex_unlock(&open_mutex); |
1053 | 1054 | ||
1054 | if (acm->tty) | 1055 | if (acm->tty) |
1055 | tty_hangup(acm->tty); | 1056 | tty_hangup(acm->tty); |