aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-02-17 17:58:57 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-26 14:42:41 -0500
commitc1a3313698895d8ad4760f98642007bf236af2e8 (patch)
tree337a876f727061362b6a169f8759849c105b8f7a /net
parentf5ffd4620aba9e55656483ae1ef5c79ba81f5403 (diff)
[Bluetooth] Make use of device_move() for RFCOMM TTY devices
In the case of bound RFCOMM TTY devices the parent is not available before its usage. So when opening a RFCOMM TTY device, move it to the corresponding ACL device as a child. When closing the device, move it back to the virtual device tree. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/rfcomm/tty.c9
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