aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/rfcomm/tty.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-04-02 07:54:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-09 15:04:31 -0400
commitb2c4be398bf771a09f84eae6cf12cbd685384b8d (patch)
treea5520240386e2904fa6d20e1b7e9aff48859bc7f /net/bluetooth/rfcomm/tty.c
parent67054019289ff11a7ffbc1a5d3c95aeb36e2f03e (diff)
TTY: rfcomm/tty, remove work for tty_wakeup
tty_wakeup is safe to be called from all contexts. No need to schedule a work for that. Let us call it directly like in other drivers. This allows us to kill another member of rfcomm_dev structure. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/bluetooth/rfcomm/tty.c')
-rw-r--r--net/bluetooth/rfcomm/tty.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index da4f54515775..0433d2632334 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -65,7 +65,6 @@ struct rfcomm_dev {
65 65
66 struct rfcomm_dlc *dlc; 66 struct rfcomm_dlc *dlc;
67 wait_queue_head_t wait; 67 wait_queue_head_t wait;
68 struct work_struct wakeup_task;
69 68
70 struct device *tty_dev; 69 struct device *tty_dev;
71 70
@@ -81,8 +80,6 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb);
81static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err); 80static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err);
82static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig); 81static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig);
83 82
84static void rfcomm_tty_wakeup(struct work_struct *work);
85
86/* ---- Device functions ---- */ 83/* ---- Device functions ---- */
87 84
88/* 85/*
@@ -248,7 +245,6 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
248 tty_port_init(&dev->port); 245 tty_port_init(&dev->port);
249 dev->port.ops = &rfcomm_port_ops; 246 dev->port.ops = &rfcomm_port_ops;
250 init_waitqueue_head(&dev->wait); 247 init_waitqueue_head(&dev->wait);
251 INIT_WORK(&dev->wakeup_task, rfcomm_tty_wakeup);
252 248
253 skb_queue_head_init(&dev->pending); 249 skb_queue_head_init(&dev->pending);
254 250
@@ -340,9 +336,10 @@ static inline unsigned int rfcomm_room(struct rfcomm_dlc *dlc)
340static void rfcomm_wfree(struct sk_buff *skb) 336static void rfcomm_wfree(struct sk_buff *skb)
341{ 337{
342 struct rfcomm_dev *dev = (void *) skb->sk; 338 struct rfcomm_dev *dev = (void *) skb->sk;
339 struct tty_struct *tty = dev->port.tty;
343 atomic_sub(skb->truesize, &dev->wmem_alloc); 340 atomic_sub(skb->truesize, &dev->wmem_alloc);
344 if (test_bit(RFCOMM_TTY_ATTACHED, &dev->flags)) 341 if (test_bit(RFCOMM_TTY_ATTACHED, &dev->flags) && tty)
345 queue_work(system_nrt_wq, &dev->wakeup_task); 342 tty_wakeup(tty);
346 tty_port_put(&dev->port); 343 tty_port_put(&dev->port);
347} 344}
348 345
@@ -625,18 +622,6 @@ static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig)
625} 622}
626 623
627/* ---- TTY functions ---- */ 624/* ---- TTY functions ---- */
628static void rfcomm_tty_wakeup(struct work_struct *work)
629{
630 struct rfcomm_dev *dev = container_of(work, struct rfcomm_dev,
631 wakeup_task);
632 struct tty_struct *tty = dev->port.tty;
633 if (!tty)
634 return;
635
636 BT_DBG("dev %p tty %p", dev, tty);
637 tty_wakeup(tty);
638}
639
640static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev) 625static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev)
641{ 626{
642 struct tty_struct *tty = dev->port.tty; 627 struct tty_struct *tty = dev->port.tty;
@@ -753,7 +738,6 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp)
753 rfcomm_dlc_close(dev->dlc, 0); 738 rfcomm_dlc_close(dev->dlc, 0);
754 739
755 clear_bit(RFCOMM_TTY_ATTACHED, &dev->flags); 740 clear_bit(RFCOMM_TTY_ATTACHED, &dev->flags);
756 cancel_work_sync(&dev->wakeup_task);
757 741
758 rfcomm_dlc_lock(dev->dlc); 742 rfcomm_dlc_lock(dev->dlc);
759 tty->driver_data = NULL; 743 tty->driver_data = NULL;