Lines Matching refs:hu

87 static inline void hci_uart_tx_complete(struct hci_uart *hu, int pkt_type)  in hci_uart_tx_complete()  argument
89 struct hci_dev *hdev = hu->hdev; in hci_uart_tx_complete()
107 static inline struct sk_buff *hci_uart_dequeue(struct hci_uart *hu) in hci_uart_dequeue() argument
109 struct sk_buff *skb = hu->tx_skb; in hci_uart_dequeue()
112 skb = hu->proto->dequeue(hu); in hci_uart_dequeue()
114 hu->tx_skb = NULL; in hci_uart_dequeue()
119 int hci_uart_tx_wakeup(struct hci_uart *hu) in hci_uart_tx_wakeup() argument
121 struct tty_struct *tty = hu->tty; in hci_uart_tx_wakeup()
122 struct hci_dev *hdev = hu->hdev; in hci_uart_tx_wakeup()
125 if (test_and_set_bit(HCI_UART_SENDING, &hu->tx_state)) { in hci_uart_tx_wakeup()
126 set_bit(HCI_UART_TX_WAKEUP, &hu->tx_state); in hci_uart_tx_wakeup()
133 clear_bit(HCI_UART_TX_WAKEUP, &hu->tx_state); in hci_uart_tx_wakeup()
135 while ((skb = hci_uart_dequeue(hu))) { in hci_uart_tx_wakeup()
144 hu->tx_skb = skb; in hci_uart_tx_wakeup()
148 hci_uart_tx_complete(hu, bt_cb(skb)->pkt_type); in hci_uart_tx_wakeup()
152 if (test_bit(HCI_UART_TX_WAKEUP, &hu->tx_state)) in hci_uart_tx_wakeup()
155 clear_bit(HCI_UART_SENDING, &hu->tx_state); in hci_uart_tx_wakeup()
175 struct hci_uart *hu = hci_get_drvdata(hdev); in hci_uart_flush() local
176 struct tty_struct *tty = hu->tty; in hci_uart_flush()
180 if (hu->tx_skb) { in hci_uart_flush()
181 kfree_skb(hu->tx_skb); hu->tx_skb = NULL; in hci_uart_flush()
188 if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) in hci_uart_flush()
189 hu->proto->flush(hu); in hci_uart_flush()
211 struct hci_uart *hu; in hci_uart_send_frame() local
221 hu = hci_get_drvdata(hdev); in hci_uart_send_frame()
225 hu->proto->enqueue(hu, skb); in hci_uart_send_frame()
227 hci_uart_tx_wakeup(hu); in hci_uart_send_frame()
244 struct hci_uart *hu = (void *) tty->disc_data; in hci_uart_tty_open() local
250 if (hu) in hci_uart_tty_open()
258 if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { in hci_uart_tty_open()
263 tty->disc_data = hu; in hci_uart_tty_open()
264 hu->tty = tty; in hci_uart_tty_open()
267 spin_lock_init(&hu->rx_lock); in hci_uart_tty_open()
288 struct hci_uart *hu = (void *)tty->disc_data; in hci_uart_tty_close() local
295 if (hu) { in hci_uart_tty_close()
296 struct hci_dev *hdev = hu->hdev; in hci_uart_tty_close()
301 if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { in hci_uart_tty_close()
306 hu->proto->close(hu); in hci_uart_tty_close()
309 kfree(hu); in hci_uart_tty_close()
323 struct hci_uart *hu = (void *)tty->disc_data; in hci_uart_tty_wakeup() local
327 if (!hu) in hci_uart_tty_wakeup()
332 if (tty != hu->tty) in hci_uart_tty_wakeup()
335 if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) in hci_uart_tty_wakeup()
336 hci_uart_tx_wakeup(hu); in hci_uart_tty_wakeup()
353 struct hci_uart *hu = (void *)tty->disc_data; in hci_uart_tty_receive() local
355 if (!hu || tty != hu->tty) in hci_uart_tty_receive()
358 if (!test_bit(HCI_UART_PROTO_SET, &hu->flags)) in hci_uart_tty_receive()
361 spin_lock(&hu->rx_lock); in hci_uart_tty_receive()
362 hu->proto->recv(hu, (void *) data, count); in hci_uart_tty_receive()
363 hu->hdev->stat.byte_rx += count; in hci_uart_tty_receive()
364 spin_unlock(&hu->rx_lock); in hci_uart_tty_receive()
369 static int hci_uart_register_dev(struct hci_uart *hu) in hci_uart_register_dev() argument
382 hu->hdev = hdev; in hci_uart_register_dev()
385 hci_set_drvdata(hdev, hu); in hci_uart_register_dev()
391 hdev->parent = hu->tty->dev; in hci_uart_register_dev()
393 if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags)) in hci_uart_register_dev()
396 if (!test_bit(HCI_UART_RESET_ON_INIT, &hu->hdev_flags)) in hci_uart_register_dev()
399 if (test_bit(HCI_UART_CREATE_AMP, &hu->hdev_flags)) in hci_uart_register_dev()
413 static int hci_uart_set_proto(struct hci_uart *hu, int id) in hci_uart_set_proto() argument
422 err = p->open(hu); in hci_uart_set_proto()
426 hu->proto = p; in hci_uart_set_proto()
428 err = hci_uart_register_dev(hu); in hci_uart_set_proto()
430 p->close(hu); in hci_uart_set_proto()
453 struct hci_uart *hu = (void *)tty->disc_data; in hci_uart_tty_ioctl() local
459 if (!hu) in hci_uart_tty_ioctl()
464 if (!test_and_set_bit(HCI_UART_PROTO_SET, &hu->flags)) { in hci_uart_tty_ioctl()
465 err = hci_uart_set_proto(hu, arg); in hci_uart_tty_ioctl()
467 clear_bit(HCI_UART_PROTO_SET, &hu->flags); in hci_uart_tty_ioctl()
475 if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) in hci_uart_tty_ioctl()
476 return hu->proto->id; in hci_uart_tty_ioctl()
480 if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) in hci_uart_tty_ioctl()
481 return hu->hdev->id; in hci_uart_tty_ioctl()
485 if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) in hci_uart_tty_ioctl()
487 hu->hdev_flags = arg; in hci_uart_tty_ioctl()
491 return hu->hdev_flags; in hci_uart_tty_ioctl()