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 = 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))
1010 if (hdev->dev_type != HCI_PRIMARY)
1020 return hci_get_conn_info(hdev, (void __user *)arg);
1023 return hci_get_auth_info(hdev, (void __user *)arg);
1028 return hci_sock_reject_list_add(hdev, (void __user *)arg);
1033 return hci_sock_reject_list_del(hdev, (void __user *)arg);
1189 struct hci_dev *hdev = NULL;
1211 hdev = hci_pi(sk)->hdev;
1212 if (hdev && hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
1213 hci_pi(sk)->hdev = NULL;
1215 hci_dev_put(hdev);
1217 hdev = NULL;
1226 if (hci_pi(sk)->hdev) {
1232 hdev = hci_dev_get(haddr.hci_dev);
1233 if (!hdev) {
1238 atomic_inc(&hdev->promisc);
1261 hci_pi(sk)->hdev = hdev;
1273 if (hci_pi(sk)->hdev) {
1288 hdev = hci_dev_get(haddr.hci_dev);
1289 if (!hdev) {
1294 if (test_bit(HCI_INIT, &hdev->flags) ||
1295 hci_dev_test_flag(hdev, HCI_SETUP) ||
1296 hci_dev_test_flag(hdev, HCI_CONFIG) ||
1297 (!hci_dev_test_flag(hdev, HCI_AUTO_OFF) &&
1298 test_bit(HCI_UP, &hdev->flags))) {
1300 hci_dev_put(hdev);
1304 if (hci_dev_test_and_set_flag(hdev, HCI_USER_CHANNEL)) {
1306 hci_dev_put(hdev);
1310 mgmt_index_removed(hdev);
1312 err = hci_dev_open(hdev->id);
1324 hci_dev_clear_flag(hdev, HCI_USER_CHANNEL);
1325 mgmt_index_added(hdev);
1326 hci_dev_put(hdev);
1352 hci_pi(sk)->hdev = hdev;
1362 atomic_inc(&hdev->promisc);
1489 struct hci_dev *hdev;
1499 hdev = hci_hdev_from_sock(sk);
1500 if (IS_ERR(hdev)) {
1501 err = PTR_ERR(hdev);
1506 haddr->hci_dev = hdev->id;
1619 struct hci_dev *hdev = NULL;
1670 hdev = hci_dev_get(index);
1671 if (!hdev) {
1677 if (hci_dev_test_flag(hdev, HCI_SETUP) ||
1678 hci_dev_test_flag(hdev, HCI_CONFIG) ||
1679 hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) {
1685 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED) &&
1695 if (no_hdev != !hdev) {
1710 if (hdev && chan->hdev_init)
1711 chan->hdev_init(sk, hdev);
1715 err = handler->func(sk, hdev, cp, len);
1722 if (hdev)
1723 hci_dev_put(hdev);
1732 struct hci_dev *hdev;
1776 hdev = hci_dev_get(index);
1777 if (!hdev)
1780 hdev = NULL;
1788 if (hdev)
1789 hci_dev_put(hdev);
1799 struct hci_dev *hdev;
1843 hdev = hci_hdev_from_sock(sk);
1844 if (IS_ERR(hdev)) {
1845 err = PTR_ERR(hdev);
1849 if (!test_bit(HCI_UP, &hdev->flags)) {
1871 skb_queue_tail(&hdev->raw_q, skb);
1872 queue_work(hdev->workqueue, &hdev->tx_work);
1892 skb_queue_tail(&hdev->raw_q, skb);
1893 queue_work(hdev->workqueue, &hdev->tx_work);
1900 skb_queue_tail(&hdev->cmd_q, skb);
1901 queue_work(hdev->workqueue, &hdev->cmd_work);
1916 skb_queue_tail(&hdev->raw_q, skb);
1917 queue_work(hdev->workqueue, &hdev->tx_work);