aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2013-01-03 09:53:06 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-16 01:30:15 -0500
commit2e124b4a390ca85325fae75764bef92f0547fa25 (patch)
tree5519fbcdbe954e79b271ea6d31ac5a4dc754c4f5 /net/bluetooth
parentd6c53c0e9bd0a83f9f9ddbc9fd80141a54d83896 (diff)
TTY: switch tty_flip_buffer_push
Now, we start converting tty buffer functions to actually use tty_port. This will allow us to get rid of the need of tty in many call sites. Only tty_port will needed and hence no more tty_port_tty_get in those paths. Now, the one where most of tty_port_tty_get gets removed: tty_flip_buffer_push. IOW we also closed all the races in drivers not using tty_port_tty_get at all yet. Also we move tty_flip_buffer_push declaration from include/linux/tty.h to include/linux/tty_flip.h to all others while we are changing it anyway. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/rfcomm/tty.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index cbec3b642871..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(&dev->port, 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,14 +619,10 @@ 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
@@ -641,7 +635,7 @@ static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev)
641 rfcomm_dlc_unlock(dev->dlc); 635 rfcomm_dlc_unlock(dev->dlc);
642 636
643 if (inserted > 0) 637 if (inserted > 0)
644 tty_flip_buffer_push(tty); 638 tty_flip_buffer_push(&dev->port);
645} 639}
646 640
647static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) 641static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)