aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/rfcomm/Kconfig1
-rw-r--r--net/bluetooth/rfcomm/tty.c21
-rw-r--r--net/irda/ircomm/Kconfig2
-rw-r--r--net/irda/ircomm/ircomm_tty.c8
4 files changed, 14 insertions, 18 deletions
diff --git a/net/bluetooth/rfcomm/Kconfig b/net/bluetooth/rfcomm/Kconfig
index 22e718b554e4..18d352ea2bc7 100644
--- a/net/bluetooth/rfcomm/Kconfig
+++ b/net/bluetooth/rfcomm/Kconfig
@@ -12,6 +12,7 @@ config BT_RFCOMM
12config BT_RFCOMM_TTY 12config BT_RFCOMM_TTY
13 bool "RFCOMM TTY support" 13 bool "RFCOMM TTY support"
14 depends on BT_RFCOMM 14 depends on BT_RFCOMM
15 depends on TTY
15 help 16 help
16 This option enables TTY emulation support for RFCOMM channels. 17 This option enables TTY emulation support for RFCOMM channels.
17 18
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index bd6fd0f43d2b..b6e44ad6cca6 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -541,23 +541,21 @@ int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
541static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb) 541static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb)
542{ 542{
543 struct rfcomm_dev *dev = dlc->owner; 543 struct rfcomm_dev *dev = dlc->owner;
544 struct tty_struct *tty;
545 544
546 if (!dev) { 545 if (!dev) {
547 kfree_skb(skb); 546 kfree_skb(skb);
548 return; 547 return;
549 } 548 }
550 549
551 tty = dev->port.tty; 550 if (!skb_queue_empty(&dev->pending)) {
552 if (!tty || !skb_queue_empty(&dev->pending)) {
553 skb_queue_tail(&dev->pending, skb); 551 skb_queue_tail(&dev->pending, skb);
554 return; 552 return;
555 } 553 }
556 554
557 BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len); 555 BT_DBG("dlc %p len %d", dlc, skb->len);
558 556
559 tty_insert_flip_string(tty, skb->data, skb->len); 557 tty_insert_flip_string(&dev->port, skb->data, skb->len);
560 tty_flip_buffer_push(tty); 558 tty_flip_buffer_push(&dev->port);
561 559
562 kfree_skb(skb); 560 kfree_skb(skb);
563} 561}
@@ -621,26 +619,23 @@ static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig)
621/* ---- TTY functions ---- */ 619/* ---- TTY functions ---- */
622static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev) 620static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev)
623{ 621{
624 struct tty_struct *tty = dev->port.tty;
625 struct sk_buff *skb; 622 struct sk_buff *skb;
626 int inserted = 0; 623 int inserted = 0;
627 624
628 if (!tty) 625 BT_DBG("dev %p", dev);
629 return;
630
631 BT_DBG("dev %p tty %p", dev, tty);
632 626
633 rfcomm_dlc_lock(dev->dlc); 627 rfcomm_dlc_lock(dev->dlc);
634 628
635 while ((skb = skb_dequeue(&dev->pending))) { 629 while ((skb = skb_dequeue(&dev->pending))) {
636 inserted += tty_insert_flip_string(tty, skb->data, skb->len); 630 inserted += tty_insert_flip_string(&dev->port, skb->data,
631 skb->len);
637 kfree_skb(skb); 632 kfree_skb(skb);
638 } 633 }
639 634
640 rfcomm_dlc_unlock(dev->dlc); 635 rfcomm_dlc_unlock(dev->dlc);
641 636
642 if (inserted > 0) 637 if (inserted > 0)
643 tty_flip_buffer_push(tty); 638 tty_flip_buffer_push(&dev->port);
644} 639}
645 640
646static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) 641static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
diff --git a/net/irda/ircomm/Kconfig b/net/irda/ircomm/Kconfig
index 2d4c6b4a78d6..19492c1707b7 100644
--- a/net/irda/ircomm/Kconfig
+++ b/net/irda/ircomm/Kconfig
@@ -1,6 +1,6 @@
1config IRCOMM 1config IRCOMM
2 tristate "IrCOMM protocol" 2 tristate "IrCOMM protocol"
3 depends on IRDA 3 depends on IRDA && TTY
4 help 4 help
5 Say Y here if you want to build support for the IrCOMM protocol. 5 Say Y here if you want to build support for the IrCOMM protocol.
6 To compile it as modules, choose M here: the modules will be 6 To compile it as modules, choose M here: the modules will be
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index a68c88cdec6e..9a5fd3c3e530 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -452,7 +452,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
452 self->line, self->port.count); 452 self->line, self->port.count);
453 453
454 /* Not really used by us, but lets do it anyway */ 454 /* Not really used by us, but lets do it anyway */
455 tty->low_latency = (self->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; 455 self->port.low_latency = (self->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
456 456
457 /* 457 /*
458 * If the port is the middle of closing, bail out now 458 * If the port is the middle of closing, bail out now
@@ -1136,14 +1136,14 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
1136 ircomm_tty_send_initial_parameters(self); 1136 ircomm_tty_send_initial_parameters(self);
1137 ircomm_tty_link_established(self); 1137 ircomm_tty_link_established(self);
1138 } 1138 }
1139 tty_kref_put(tty);
1139 1140
1140 /* 1141 /*
1141 * Use flip buffer functions since the code may be called from interrupt 1142 * Use flip buffer functions since the code may be called from interrupt
1142 * context 1143 * context
1143 */ 1144 */
1144 tty_insert_flip_string(tty, skb->data, skb->len); 1145 tty_insert_flip_string(&self->port, skb->data, skb->len);
1145 tty_flip_buffer_push(tty); 1146 tty_flip_buffer_push(&self->port);
1146 tty_kref_put(tty);
1147 1147
1148 /* No need to kfree_skb - see ircomm_ttp_data_indication() */ 1148 /* No need to kfree_skb - see ircomm_ttp_data_indication() */
1149 1149