diff options
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 8cd82dce5008..9a7a44fc721f 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -74,6 +74,8 @@ struct rfcomm_dev { | |||
74 | wait_queue_head_t wait; | 74 | wait_queue_head_t wait; |
75 | struct tasklet_struct wakeup_task; | 75 | struct tasklet_struct wakeup_task; |
76 | 76 | ||
77 | struct device *tty_dev; | ||
78 | |||
77 | atomic_t wmem_alloc; | 79 | atomic_t wmem_alloc; |
78 | }; | 80 | }; |
79 | 81 | ||
@@ -261,7 +263,7 @@ out: | |||
261 | return err; | 263 | return err; |
262 | } | 264 | } |
263 | 265 | ||
264 | tty_register_device(rfcomm_tty_driver, dev->id, rfcomm_get_device(dev)); | 266 | dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL); |
265 | 267 | ||
266 | return dev->id; | 268 | return dev->id; |
267 | } | 269 | } |
@@ -630,6 +632,9 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
630 | set_current_state(TASK_RUNNING); | 632 | set_current_state(TASK_RUNNING); |
631 | remove_wait_queue(&dev->wait, &wait); | 633 | remove_wait_queue(&dev->wait, &wait); |
632 | 634 | ||
635 | if (err == 0) | ||
636 | device_move(dev->tty_dev, rfcomm_get_device(dev)); | ||
637 | |||
633 | return err; | 638 | return err; |
634 | } | 639 | } |
635 | 640 | ||
@@ -642,6 +647,8 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) | |||
642 | BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc, dev->opened); | 647 | BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc, dev->opened); |
643 | 648 | ||
644 | if (--dev->opened == 0) { | 649 | if (--dev->opened == 0) { |
650 | device_move(dev->tty_dev, NULL); | ||
651 | |||
645 | /* Close DLC and dettach TTY */ | 652 | /* Close DLC and dettach TTY */ |
646 | rfcomm_dlc_close(dev->dlc, 0); | 653 | rfcomm_dlc_close(dev->dlc, 0); |
647 | 654 | ||