Lines Matching defs:hdev

53 	struct hci_dev    *hdev;
65 struct hci_dev *hdev = hci_pi(sk)->hdev;
67 if (!hdev)
69 if (hci_dev_test_flag(hdev, HCI_UNREGISTER))
71 return hdev;
203 void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
208 BT_DBG("hdev %p len %d", hdev, skb->len);
215 if (sk->sk_state != BT_BOUND || hci_pi(sk)->hdev != hdev)
358 void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb)
367 BT_DBG("hdev %p len %d", hdev, skb->len);
411 hdr->index = cpu_to_le16(hdev->id);
419 void hci_send_monitor_ctrl_event(struct hci_dev *hdev, u16 event,
426 if (hdev)
427 index = cpu_to_le16(hdev->id);
473 static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event)
488 ni->type = 0x00; /* Old hdev->dev_type */
489 ni->bus = hdev->bus;
490 bacpy(&ni->bdaddr, &hdev->bdaddr);
491 memcpy_and_pad(ni->name, sizeof(ni->name), hdev->name,
492 strnlen(hdev->name, sizeof(ni->name)), '\0');
506 if (hdev->manufacturer == 0xffff)
516 bacpy(&ii->bdaddr, &hdev->bdaddr);
517 ii->manufacturer = cpu_to_le16(hdev->manufacturer);
546 hdr->index = cpu_to_le16(hdev->id);
603 if (hci_pi(sk)->hdev)
604 hdr->index = cpu_to_le16(hci_pi(sk)->hdev->id);
643 if (hci_pi(sk)->hdev)
644 hdr->index = cpu_to_le16(hci_pi(sk)->hdev->id);
717 struct hci_dev *hdev;
721 list_for_each_entry(hdev, &hci_dev_list, list) {
724 skb = create_monitor_event(hdev, HCI_DEV_REG);
731 if (!test_bit(HCI_RUNNING, &hdev->flags))
734 skb = create_monitor_event(hdev, HCI_DEV_OPEN);
741 if (test_bit(HCI_UP, &hdev->flags))
742 skb = create_monitor_event(hdev, HCI_DEV_UP);
743 else if (hci_dev_test_flag(hdev, HCI_SETUP))
744 skb = create_monitor_event(hdev, HCI_DEV_SETUP);
778 static void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data)
800 hci_send_to_sock(hdev, skb);
804 void hci_sock_dev_event(struct hci_dev *hdev, int event)
806 BT_DBG("hdev %s event %d", hdev->name, event);
812 skb = create_monitor_event(hdev, event);
825 ev.dev_id = hdev->id;
835 if (hci_pi(sk)->hdev == hdev) {
897 struct hci_dev *hdev;
928 hdev = hci_pi(sk)->hdev;
929 if (hdev) {
931 !hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
943 * been complete and hdev will get released when we put
946 hci_dev_do_close(hdev);
947 hci_dev_clear_flag(hdev, HCI_USER_CHANNEL);
948 mgmt_index_added(hdev);
951 atomic_dec(&hdev->promisc);
952 hci_dev_put(hdev);
961 static int hci_sock_reject_list_add(struct hci_dev *hdev, void __user *arg)
969 hci_dev_lock(hdev);
971 err = hci_bdaddr_list_add(&hdev->reject_list, &bdaddr, BDADDR_BREDR);
973 hci_dev_unlock(hdev);
978 static int hci_sock_reject_list_del(struct hci_dev *hdev, void __user *arg)
986 hci_dev_lock(hdev);
988 err = hci_bdaddr_list_del(&hdev->reject_list, &bdaddr, BDADDR_BREDR);
990 hci_dev_unlock(hdev);
999 struct hci_dev *hdev = hci_hdev_from_sock(sk);
1001 if (IS_ERR(hdev))
1002 return PTR_ERR(hdev);
1004 if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL))
1007 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED))
1017 return hci_get_conn_info(hdev, (void __user *)arg);
1020 return hci_get_auth_info(hdev, (void __user *)arg);
1025 return hci_sock_reject_list_add(hdev, (void __user *)arg);
1030 return hci_sock_reject_list_del(hdev, (void __user *)arg);
1186 struct hci_dev *hdev = NULL;
1208 hdev = hci_pi(sk)->hdev;
1209 if (hdev && hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
1210 hci_pi(sk)->hdev = NULL;
1212 hci_dev_put(hdev);
1214 hdev = NULL;
1223 if (hci_pi(sk)->hdev) {
1229 hdev = hci_dev_get(haddr.hci_dev);
1230 if (!hdev) {
1235 atomic_inc(&hdev->promisc);
1258 hci_pi(sk)->hdev = hdev;
1270 if (hci_pi(sk)->hdev) {
1285 hdev = hci_dev_get(haddr.hci_dev);
1286 if (!hdev) {
1291 if (test_bit(HCI_INIT, &hdev->flags) ||
1292 hci_dev_test_flag(hdev, HCI_SETUP) ||
1293 hci_dev_test_flag(hdev, HCI_CONFIG) ||
1294 (!hci_dev_test_flag(hdev, HCI_AUTO_OFF) &&
1295 test_bit(HCI_UP, &hdev->flags))) {
1297 hci_dev_put(hdev);
1301 if (hci_dev_test_and_set_flag(hdev, HCI_USER_CHANNEL)) {
1303 hci_dev_put(hdev);
1307 mgmt_index_removed(hdev);
1309 err = hci_dev_open(hdev->id);
1321 hci_dev_clear_flag(hdev, HCI_USER_CHANNEL);
1322 mgmt_index_added(hdev);
1323 hci_dev_put(hdev);
1349 hci_pi(sk)->hdev = hdev;
1359 atomic_inc(&hdev->promisc);
1486 struct hci_dev *hdev;
1496 hdev = hci_hdev_from_sock(sk);
1497 if (IS_ERR(hdev)) {
1498 err = PTR_ERR(hdev);
1503 haddr->hci_dev = hdev->id;
1616 struct hci_dev *hdev = NULL;
1667 hdev = hci_dev_get(index);
1668 if (!hdev) {
1674 if (hci_dev_test_flag(hdev, HCI_SETUP) ||
1675 hci_dev_test_flag(hdev, HCI_CONFIG) ||
1676 hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) {
1682 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED) &&
1692 if (no_hdev != !hdev) {
1707 if (hdev && chan->hdev_init)
1708 chan->hdev_init(sk, hdev);
1712 err = handler->func(sk, hdev, cp, len);
1719 if (hdev)
1720 hci_dev_put(hdev);
1729 struct hci_dev *hdev;
1773 hdev = hci_dev_get(index);
1774 if (!hdev)
1777 hdev = NULL;
1785 if (hdev)
1786 hci_dev_put(hdev);
1796 struct hci_dev *hdev;
1840 hdev = hci_hdev_from_sock(sk);
1841 if (IS_ERR(hdev)) {
1842 err = PTR_ERR(hdev);
1846 if (!test_bit(HCI_UP, &hdev->flags)) {
1868 skb_queue_tail(&hdev->raw_q, skb);
1869 queue_work(hdev->workqueue, &hdev->tx_work);
1889 skb_queue_tail(&hdev->raw_q, skb);
1890 queue_work(hdev->workqueue, &hdev->tx_work);
1897 skb_queue_tail(&hdev->cmd_q, skb);
1898 queue_work(hdev->workqueue, &hdev->cmd_work);
1913 skb_queue_tail(&hdev->raw_q, skb);
1914 queue_work(hdev->workqueue, &hdev->tx_work);