Lines Matching defs:hdev

53 	struct hci_dev    *hdev;
64 struct hci_dev *hdev = hci_pi(sk)->hdev;
66 if (!hdev)
68 if (hci_dev_test_flag(hdev, HCI_UNREGISTER))
70 return hdev;
202 void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
207 BT_DBG("hdev %p len %d", hdev, skb->len);
214 if (sk->sk_state != BT_BOUND || hci_pi(sk)->hdev != hdev)
310 void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb)
319 BT_DBG("hdev %p len %d", hdev, skb->len);
361 hdr->index = cpu_to_le16(hdev->id);
369 void hci_send_monitor_ctrl_event(struct hci_dev *hdev, u16 event,
376 if (hdev)
377 index = cpu_to_le16(hdev->id);
423 static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event)
438 ni->type = hdev->dev_type;
439 ni->bus = hdev->bus;
440 bacpy(&ni->bdaddr, &hdev->bdaddr);
441 memcpy_and_pad(ni->name, sizeof(ni->name), hdev->name,
442 strnlen(hdev->name, sizeof(ni->name)), '\0');
456 if (hdev->manufacturer == 0xffff)
466 bacpy(&ii->bdaddr, &hdev->bdaddr);
467 ii->manufacturer = cpu_to_le16(hdev->manufacturer);
496 hdr->index = cpu_to_le16(hdev->id);
551 if (hci_pi(sk)->hdev)
552 hdr->index = cpu_to_le16(hci_pi(sk)->hdev->id);
589 if (hci_pi(sk)->hdev)
590 hdr->index = cpu_to_le16(hci_pi(sk)->hdev->id);
659 struct hci_dev *hdev;
663 list_for_each_entry(hdev, &hci_dev_list, list) {
666 skb = create_monitor_event(hdev, HCI_DEV_REG);
673 if (!test_bit(HCI_RUNNING, &hdev->flags))
676 skb = create_monitor_event(hdev, HCI_DEV_OPEN);
683 if (test_bit(HCI_UP, &hdev->flags))
684 skb = create_monitor_event(hdev, HCI_DEV_UP);
685 else if (hci_dev_test_flag(hdev, HCI_SETUP))
686 skb = create_monitor_event(hdev, HCI_DEV_SETUP);
720 static void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data)
742 hci_send_to_sock(hdev, skb);
746 void hci_sock_dev_event(struct hci_dev *hdev, int event)
748 BT_DBG("hdev %s event %d", hdev->name, event);
754 skb = create_monitor_event(hdev, event);
767 ev.dev_id = hdev->id;
777 if (hci_pi(sk)->hdev == hdev) {
839 struct hci_dev *hdev;
870 hdev = hci_pi(sk)->hdev;
871 if (hdev) {
882 hci_dev_do_close(hdev);
883 hci_dev_clear_flag(hdev, HCI_USER_CHANNEL);
884 mgmt_index_added(hdev);
887 atomic_dec(&hdev->promisc);
888 hci_dev_put(hdev);
897 static int hci_sock_reject_list_add(struct hci_dev *hdev, void __user *arg)
905 hci_dev_lock(hdev);
907 err = hci_bdaddr_list_add(&hdev->reject_list, &bdaddr, BDADDR_BREDR);
909 hci_dev_unlock(hdev);
914 static int hci_sock_reject_list_del(struct hci_dev *hdev, void __user *arg)
922 hci_dev_lock(hdev);
924 err = hci_bdaddr_list_del(&hdev->reject_list, &bdaddr, BDADDR_BREDR);
926 hci_dev_unlock(hdev);
935 struct hci_dev *hdev = hci_hdev_from_sock(sk);
937 if (IS_ERR(hdev))
938 return PTR_ERR(hdev);
940 if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL))
943 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED))
946 if (hdev->dev_type != HCI_PRIMARY)
956 return hci_get_conn_info(hdev, (void __user *)arg);
959 return hci_get_auth_info(hdev, (void __user *)arg);
964 return hci_sock_reject_list_add(hdev, (void __user *)arg);
969 return hci_sock_reject_list_del(hdev, (void __user *)arg);
1125 struct hci_dev *hdev = NULL;
1147 hdev = hci_pi(sk)->hdev;
1148 if (hdev && hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
1149 hci_pi(sk)->hdev = NULL;
1151 hci_dev_put(hdev);
1153 hdev = NULL;
1162 if (hci_pi(sk)->hdev) {
1168 hdev = hci_dev_get(haddr.hci_dev);
1169 if (!hdev) {
1174 atomic_inc(&hdev->promisc);
1197 hci_pi(sk)->hdev = hdev;
1209 if (hci_pi(sk)->hdev) {
1224 hdev = hci_dev_get(haddr.hci_dev);
1225 if (!hdev) {
1230 if (test_bit(HCI_INIT, &hdev->flags) ||
1231 hci_dev_test_flag(hdev, HCI_SETUP) ||
1232 hci_dev_test_flag(hdev, HCI_CONFIG) ||
1233 (!hci_dev_test_flag(hdev, HCI_AUTO_OFF) &&
1234 test_bit(HCI_UP, &hdev->flags))) {
1236 hci_dev_put(hdev);
1240 if (hci_dev_test_and_set_flag(hdev, HCI_USER_CHANNEL)) {
1242 hci_dev_put(hdev);
1246 mgmt_index_removed(hdev);
1248 err = hci_dev_open(hdev->id);
1260 hci_dev_clear_flag(hdev, HCI_USER_CHANNEL);
1261 mgmt_index_added(hdev);
1262 hci_dev_put(hdev);
1288 hci_pi(sk)->hdev = hdev;
1298 atomic_inc(&hdev->promisc);
1421 struct hci_dev *hdev;
1431 hdev = hci_hdev_from_sock(sk);
1432 if (IS_ERR(hdev)) {
1433 err = PTR_ERR(hdev);
1438 haddr->hci_dev = hdev->id;
1547 struct hci_dev *hdev = NULL;
1607 hdev = hci_dev_get(index);
1608 if (!hdev) {
1614 if (hci_dev_test_flag(hdev, HCI_SETUP) ||
1615 hci_dev_test_flag(hdev, HCI_CONFIG) ||
1616 hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) {
1622 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED) &&
1632 if (no_hdev != !hdev) {
1647 if (hdev && chan->hdev_init)
1648 chan->hdev_init(sk, hdev);
1652 err = handler->func(sk, hdev, cp, len);
1659 if (hdev)
1660 hci_dev_put(hdev);
1670 struct hci_dev *hdev;
1728 hdev = hci_dev_get(index);
1729 if (!hdev) {
1734 hdev = NULL;
1742 if (hdev)
1743 hci_dev_put(hdev);
1755 struct hci_dev *hdev;
1795 hdev = hci_hdev_from_sock(sk);
1796 if (IS_ERR(hdev)) {
1797 err = PTR_ERR(hdev);
1801 if (!test_bit(HCI_UP, &hdev->flags)) {
1832 skb_queue_tail(&hdev->raw_q, skb);
1833 queue_work(hdev->workqueue, &hdev->tx_work);
1853 skb_queue_tail(&hdev->raw_q, skb);
1854 queue_work(hdev->workqueue, &hdev->tx_work);
1861 skb_queue_tail(&hdev->cmd_q, skb);
1862 queue_work(hdev->workqueue, &hdev->cmd_work);
1877 skb_queue_tail(&hdev->raw_q, skb);
1878 queue_work(hdev->workqueue, &hdev->tx_work);