diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-27 12:28:45 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2012-01-02 19:19:29 -0500 |
commit | 393432cd8dc02b88a00decd495913643aa5ff705 (patch) | |
tree | 2c59666496a3c669781bbc8bb5f94854a1b6f944 /net/bluetooth/rfcomm | |
parent | 95ca83f42fb5f5bf789b514635f79242afe555d1 (diff) |
Bluetooth: Fix context in RFCOMM tty
We now run in process context, no need to disable interrupts.
Calls from the tty layer also run in process context.
rw_lock was converted to spinlock, we have more writers than readers in
this case.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/rfcomm')
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index fa8f4de53b99..a2d4f5122a6a 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -76,7 +76,7 @@ struct rfcomm_dev { | |||
76 | }; | 76 | }; |
77 | 77 | ||
78 | static LIST_HEAD(rfcomm_dev_list); | 78 | static LIST_HEAD(rfcomm_dev_list); |
79 | static DEFINE_RWLOCK(rfcomm_dev_lock); | 79 | static DEFINE_SPINLOCK(rfcomm_dev_lock); |
80 | 80 | ||
81 | static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb); | 81 | static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb); |
82 | static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err); | 82 | static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err); |
@@ -146,7 +146,7 @@ static inline struct rfcomm_dev *rfcomm_dev_get(int id) | |||
146 | { | 146 | { |
147 | struct rfcomm_dev *dev; | 147 | struct rfcomm_dev *dev; |
148 | 148 | ||
149 | read_lock(&rfcomm_dev_lock); | 149 | spin_lock(&rfcomm_dev_lock); |
150 | 150 | ||
151 | dev = __rfcomm_dev_get(id); | 151 | dev = __rfcomm_dev_get(id); |
152 | 152 | ||
@@ -157,7 +157,7 @@ static inline struct rfcomm_dev *rfcomm_dev_get(int id) | |||
157 | rfcomm_dev_hold(dev); | 157 | rfcomm_dev_hold(dev); |
158 | } | 158 | } |
159 | 159 | ||
160 | read_unlock(&rfcomm_dev_lock); | 160 | spin_unlock(&rfcomm_dev_lock); |
161 | 161 | ||
162 | return dev; | 162 | return dev; |
163 | } | 163 | } |
@@ -205,7 +205,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) | |||
205 | if (!dev) | 205 | if (!dev) |
206 | return -ENOMEM; | 206 | return -ENOMEM; |
207 | 207 | ||
208 | write_lock_bh(&rfcomm_dev_lock); | 208 | spin_lock(&rfcomm_dev_lock); |
209 | 209 | ||
210 | if (req->dev_id < 0) { | 210 | if (req->dev_id < 0) { |
211 | dev->id = 0; | 211 | dev->id = 0; |
@@ -290,7 +290,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) | |||
290 | __module_get(THIS_MODULE); | 290 | __module_get(THIS_MODULE); |
291 | 291 | ||
292 | out: | 292 | out: |
293 | write_unlock_bh(&rfcomm_dev_lock); | 293 | spin_unlock(&rfcomm_dev_lock); |
294 | 294 | ||
295 | if (err < 0) | 295 | if (err < 0) |
296 | goto free; | 296 | goto free; |
@@ -327,9 +327,9 @@ static void rfcomm_dev_del(struct rfcomm_dev *dev) | |||
327 | if (atomic_read(&dev->opened) > 0) | 327 | if (atomic_read(&dev->opened) > 0) |
328 | return; | 328 | return; |
329 | 329 | ||
330 | write_lock_bh(&rfcomm_dev_lock); | 330 | spin_lock(&rfcomm_dev_lock); |
331 | list_del_init(&dev->list); | 331 | list_del_init(&dev->list); |
332 | write_unlock_bh(&rfcomm_dev_lock); | 332 | spin_unlock(&rfcomm_dev_lock); |
333 | 333 | ||
334 | rfcomm_dev_put(dev); | 334 | rfcomm_dev_put(dev); |
335 | } | 335 | } |
@@ -473,7 +473,7 @@ static int rfcomm_get_dev_list(void __user *arg) | |||
473 | 473 | ||
474 | di = dl->dev_info; | 474 | di = dl->dev_info; |
475 | 475 | ||
476 | read_lock_bh(&rfcomm_dev_lock); | 476 | spin_lock(&rfcomm_dev_lock); |
477 | 477 | ||
478 | list_for_each_entry(dev, &rfcomm_dev_list, list) { | 478 | list_for_each_entry(dev, &rfcomm_dev_list, list) { |
479 | if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) | 479 | if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) |
@@ -488,7 +488,7 @@ static int rfcomm_get_dev_list(void __user *arg) | |||
488 | break; | 488 | break; |
489 | } | 489 | } |
490 | 490 | ||
491 | read_unlock_bh(&rfcomm_dev_lock); | 491 | spin_unlock(&rfcomm_dev_lock); |
492 | 492 | ||
493 | dl->dev_num = n; | 493 | dl->dev_num = n; |
494 | size = sizeof(*dl) + n * sizeof(*di); | 494 | size = sizeof(*dl) + n * sizeof(*di); |
@@ -766,9 +766,9 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) | |||
766 | rfcomm_dlc_unlock(dev->dlc); | 766 | rfcomm_dlc_unlock(dev->dlc); |
767 | 767 | ||
768 | if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) { | 768 | if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) { |
769 | write_lock_bh(&rfcomm_dev_lock); | 769 | spin_lock(&rfcomm_dev_lock); |
770 | list_del_init(&dev->list); | 770 | list_del_init(&dev->list); |
771 | write_unlock_bh(&rfcomm_dev_lock); | 771 | spin_unlock(&rfcomm_dev_lock); |
772 | 772 | ||
773 | rfcomm_dev_put(dev); | 773 | rfcomm_dev_put(dev); |
774 | } | 774 | } |