Lines 437-443
static int rfcomm_release_dev(void __use
Link Here
|
437 |
tty_kref_put(tty); |
437 |
tty_kref_put(tty); |
438 |
} |
438 |
} |
439 |
|
439 |
|
440 |
if (!test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags)) |
440 |
if (!test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags) && |
|
|
441 |
!test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags)) |
441 |
tty_port_put(&dev->port); |
442 |
tty_port_put(&dev->port); |
442 |
|
443 |
|
443 |
tty_port_put(&dev->port); |
444 |
tty_port_put(&dev->port); |
Lines 670-679
static int rfcomm_tty_install(struct tty
Link Here
|
670 |
|
671 |
|
671 |
/* install the tty_port */ |
672 |
/* install the tty_port */ |
672 |
err = tty_port_install(&dev->port, driver, tty); |
673 |
err = tty_port_install(&dev->port, driver, tty); |
673 |
if (err) |
674 |
if (err) { |
674 |
rfcomm_tty_cleanup(tty); |
675 |
rfcomm_tty_cleanup(tty); |
|
|
676 |
return err; |
677 |
} |
678 |
|
679 |
/* take over the tty_port reference if the port was created with the |
680 |
* flag RFCOMM_RELEASE_ONHUP. This will force the release of the port |
681 |
* when the last process closes the tty. The behaviour is expected by |
682 |
* userspace. |
683 |
*/ |
684 |
if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) |
685 |
tty_port_put(&dev->port); |
686 |
|
687 |
return 0; |
675 |
|
688 |
|
676 |
return err; |
|
|
677 |
} |
689 |
} |
678 |
|
690 |
|
679 |
static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) |
691 |
static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) |
Lines 1010-1019
static void rfcomm_tty_hangup(struct tty
Link Here
|
1010 |
BT_DBG("tty %p dev %p", tty, dev); |
1022 |
BT_DBG("tty %p dev %p", tty, dev); |
1011 |
|
1023 |
|
1012 |
tty_port_hangup(&dev->port); |
1024 |
tty_port_hangup(&dev->port); |
1013 |
|
|
|
1014 |
if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags) && |
1015 |
!test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags)) |
1016 |
tty_port_put(&dev->port); |
1017 |
} |
1025 |
} |
1018 |
|
1026 |
|
1019 |
static int rfcomm_tty_tiocmget(struct tty_struct *tty) |
1027 |
static int rfcomm_tty_tiocmget(struct tty_struct *tty) |