aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-03 12:01:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-03 12:01:02 -0400
commit49eb7b0750d9483c74e9c14ae6ea1e9d62481c3c (patch)
tree68f76b18328d070a4b5182f9ed82c2134cae16d2 /drivers/bluetooth
parent5142c33ed86acbcef5c63a63d2b7384b9210d39f (diff)
parent9ce4f8f3f45443922c98e25133b8c9790fc7949a (diff)
Merge tag 'tty-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty into next
Pull tty/serial driver updates from Greg KH: "Here is the big tty / serial driver pull request for 3.16-rc1. A variety of different serial driver fixes and updates and additions, nothing huge, and no real major core tty changes at all. All have been in linux-next for a while" * tag 'tty-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (84 commits) Revert "serial: imx: remove the DMA wait queue" serial: kgdb_nmi: Improve console integration with KDB I/O serial: kgdb_nmi: Switch from tasklets to real timers serial: kgdb_nmi: Use container_of() to locate private data serial: cpm_uart: No LF conversion in put_poll_char() serial: sirf: Fix compilation failure console: Remove superfluous readonly check console: Use explicit pointer type for vc_uni_pagedir* fields vgacon: Fix & cleanup refcounting ARM: tty: Move HVC DCC assembly to arch/arm tty/hvc/hvc_console: Fix wakeup of HVC thread on hvc_kick() drivers/tty/n_hdlc.c: replace kmalloc/memset by kzalloc vt: emulate 8- and 24-bit colour codes. printk/of_serial: fix serial console cessation part way through boot. serial: 8250_dma: check the result of TX buffer mapping serial: uart: add hw flow control support configuration tty/serial: at91: add interrupts for modem control lines tty/serial: at91: use mctrl_gpio helpers tty/serial: Add GPIOLIB helpers for controlling modem lines ARM: at91: gpio: implement get_direction ...
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/hci_ldisc.c24
-rw-r--r--drivers/bluetooth/hci_uart.h1
2 files changed, 20 insertions, 5 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index f1fbf4f1e5be..e00f8f5b5c8e 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -118,10 +118,6 @@ static inline struct sk_buff *hci_uart_dequeue(struct hci_uart *hu)
118 118
119int hci_uart_tx_wakeup(struct hci_uart *hu) 119int hci_uart_tx_wakeup(struct hci_uart *hu)
120{ 120{
121 struct tty_struct *tty = hu->tty;
122 struct hci_dev *hdev = hu->hdev;
123 struct sk_buff *skb;
124
125 if (test_and_set_bit(HCI_UART_SENDING, &hu->tx_state)) { 121 if (test_and_set_bit(HCI_UART_SENDING, &hu->tx_state)) {
126 set_bit(HCI_UART_TX_WAKEUP, &hu->tx_state); 122 set_bit(HCI_UART_TX_WAKEUP, &hu->tx_state);
127 return 0; 123 return 0;
@@ -129,6 +125,22 @@ int hci_uart_tx_wakeup(struct hci_uart *hu)
129 125
130 BT_DBG(""); 126 BT_DBG("");
131 127
128 schedule_work(&hu->write_work);
129
130 return 0;
131}
132
133static void hci_uart_write_work(struct work_struct *work)
134{
135 struct hci_uart *hu = container_of(work, struct hci_uart, write_work);
136 struct tty_struct *tty = hu->tty;
137 struct hci_dev *hdev = hu->hdev;
138 struct sk_buff *skb;
139
140 /* REVISIT: should we cope with bad skbs or ->write() returning
141 * and error value ?
142 */
143
132restart: 144restart:
133 clear_bit(HCI_UART_TX_WAKEUP, &hu->tx_state); 145 clear_bit(HCI_UART_TX_WAKEUP, &hu->tx_state);
134 146
@@ -153,7 +165,6 @@ restart:
153 goto restart; 165 goto restart;
154 166
155 clear_bit(HCI_UART_SENDING, &hu->tx_state); 167 clear_bit(HCI_UART_SENDING, &hu->tx_state);
156 return 0;
157} 168}
158 169
159static void hci_uart_init_work(struct work_struct *work) 170static void hci_uart_init_work(struct work_struct *work)
@@ -282,6 +293,7 @@ static int hci_uart_tty_open(struct tty_struct *tty)
282 tty->receive_room = 65536; 293 tty->receive_room = 65536;
283 294
284 INIT_WORK(&hu->init_ready, hci_uart_init_work); 295 INIT_WORK(&hu->init_ready, hci_uart_init_work);
296 INIT_WORK(&hu->write_work, hci_uart_write_work);
285 297
286 spin_lock_init(&hu->rx_lock); 298 spin_lock_init(&hu->rx_lock);
287 299
@@ -319,6 +331,8 @@ static void hci_uart_tty_close(struct tty_struct *tty)
319 if (hdev) 331 if (hdev)
320 hci_uart_close(hdev); 332 hci_uart_close(hdev);
321 333
334 cancel_work_sync(&hu->write_work);
335
322 if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { 336 if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
323 if (hdev) { 337 if (hdev) {
324 if (test_bit(HCI_UART_REGISTERED, &hu->flags)) 338 if (test_bit(HCI_UART_REGISTERED, &hu->flags))
diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
index fffa61ff5cb1..12df101ca942 100644
--- a/drivers/bluetooth/hci_uart.h
+++ b/drivers/bluetooth/hci_uart.h
@@ -68,6 +68,7 @@ struct hci_uart {
68 unsigned long hdev_flags; 68 unsigned long hdev_flags;
69 69
70 struct work_struct init_ready; 70 struct work_struct init_ready;
71 struct work_struct write_work;
71 72
72 struct hci_uart_proto *proto; 73 struct hci_uart_proto *proto;
73 void *priv; 74 void *priv;