Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: HCI: Remove HCI_AMP support

Since BT_HS has been remove HCI_AMP controllers no longer has any use so
remove it along with the capability of creating AMP controllers.

Since we no longer need to differentiate between AMP and Primary
controllers, as only HCI_PRIMARY is left, this also remove
hdev->dev_type altogether.

Fixes: e7b02296fb40 ("Bluetooth: Remove BT_HS")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

+49 -664
-9
drivers/bluetooth/btmrvl_main.c
··· 121 121 ((event->data[2] == MODULE_BROUGHT_UP) || 122 122 (event->data[2] == MODULE_ALREADY_UP)) ? 123 123 "Bring-up succeed" : "Bring-up failed"); 124 - 125 - if (event->length > 3 && event->data[3]) 126 - priv->btmrvl_dev.dev_type = HCI_AMP; 127 - else 128 - priv->btmrvl_dev.dev_type = HCI_PRIMARY; 129 - 130 - BT_DBG("dev_type: %d", priv->btmrvl_dev.dev_type); 131 124 } else if (priv->btmrvl_dev.sendcmdflag && 132 125 event->data[1] == MODULE_SHUTDOWN_REQ) { 133 126 BT_DBG("EVENT:%s", (event->data[2]) ? ··· 678 685 hdev->set_bdaddr = btmrvl_set_bdaddr; 679 686 hdev->wakeup = btmrvl_wakeup; 680 687 SET_HCIDEV_DEV(hdev, &card->func->dev); 681 - 682 - hdev->dev_type = priv->btmrvl_dev.dev_type; 683 688 684 689 ret = hci_register_dev(hdev); 685 690 if (ret < 0) {
-1
drivers/bluetooth/btrsi.c
··· 134 134 hdev->bus = HCI_USB; 135 135 136 136 hci_set_drvdata(hdev, h_adapter); 137 - hdev->dev_type = HCI_PRIMARY; 138 137 hdev->open = rsi_hci_open; 139 138 hdev->close = rsi_hci_close; 140 139 hdev->flush = rsi_hci_flush;
-8
drivers/bluetooth/btsdio.c
··· 32 32 /* Generic Bluetooth Type-B SDIO device */ 33 33 { SDIO_DEVICE_CLASS(SDIO_CLASS_BT_B) }, 34 34 35 - /* Generic Bluetooth AMP controller */ 36 - { SDIO_DEVICE_CLASS(SDIO_CLASS_BT_AMP) }, 37 - 38 35 { } /* Terminating entry */ 39 36 }; 40 37 ··· 315 318 316 319 hdev->bus = HCI_SDIO; 317 320 hci_set_drvdata(hdev, data); 318 - 319 - if (id->class == SDIO_CLASS_BT_AMP) 320 - hdev->dev_type = HCI_AMP; 321 - else 322 - hdev->dev_type = HCI_PRIMARY; 323 321 324 322 data->hdev = hdev; 325 323
-5
drivers/bluetooth/btusb.c
··· 4359 4359 hdev->bus = HCI_USB; 4360 4360 hci_set_drvdata(hdev, data); 4361 4361 4362 - if (id->driver_info & BTUSB_AMP) 4363 - hdev->dev_type = HCI_AMP; 4364 - else 4365 - hdev->dev_type = HCI_PRIMARY; 4366 - 4367 4362 data->hdev = hdev; 4368 4363 4369 4364 SET_HCIDEV_DEV(hdev, &intf->dev);
-1
drivers/bluetooth/hci_bcm4377.c
··· 2361 2361 bcm4377->hdev = hdev; 2362 2362 2363 2363 hdev->bus = HCI_PCI; 2364 - hdev->dev_type = HCI_PRIMARY; 2365 2364 hdev->open = bcm4377_hci_open; 2366 2365 hdev->close = bcm4377_hci_close; 2367 2366 hdev->send = bcm4377_hci_send_frame;
-6
drivers/bluetooth/hci_ldisc.c
··· 667 667 if (!test_bit(HCI_UART_RESET_ON_INIT, &hu->hdev_flags)) 668 668 set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); 669 669 670 - if (test_bit(HCI_UART_CREATE_AMP, &hu->hdev_flags)) 671 - hdev->dev_type = HCI_AMP; 672 - else 673 - hdev->dev_type = HCI_PRIMARY; 674 - 675 670 /* Only call open() for the protocol after hdev is fully initialized as 676 671 * open() (or a timer/workqueue it starts) may attempt to reference it. 677 672 */ ··· 717 722 { 718 723 unsigned long valid_flags = BIT(HCI_UART_RAW_DEVICE) | 719 724 BIT(HCI_UART_RESET_ON_INIT) | 720 - BIT(HCI_UART_CREATE_AMP) | 721 725 BIT(HCI_UART_INIT_PENDING) | 722 726 BIT(HCI_UART_EXT_CONFIG) | 723 727 BIT(HCI_UART_VND_DETECT);
-5
drivers/bluetooth/hci_serdev.c
··· 366 366 if (test_bit(HCI_UART_EXT_CONFIG, &hu->hdev_flags)) 367 367 set_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks); 368 368 369 - if (test_bit(HCI_UART_CREATE_AMP, &hu->hdev_flags)) 370 - hdev->dev_type = HCI_AMP; 371 - else 372 - hdev->dev_type = HCI_PRIMARY; 373 - 374 369 if (test_bit(HCI_UART_INIT_PENDING, &hu->hdev_flags)) 375 370 return 0; 376 371
-1
drivers/bluetooth/hci_uart.h
··· 37 37 38 38 #define HCI_UART_RAW_DEVICE 0 39 39 #define HCI_UART_RESET_ON_INIT 1 40 - #define HCI_UART_CREATE_AMP 2 41 40 #define HCI_UART_INIT_PENDING 3 42 41 #define HCI_UART_EXT_CONFIG 4 43 42 #define HCI_UART_VND_DETECT 5
+1 -9
drivers/bluetooth/hci_vhci.c
··· 384 384 { 385 385 struct hci_dev *hdev; 386 386 struct sk_buff *skb; 387 - __u8 dev_type; 388 387 389 388 if (data->hdev) 390 389 return -EBADFD; 391 - 392 - /* bits 0-1 are dev_type (Primary or AMP) */ 393 - dev_type = opcode & 0x03; 394 - 395 - if (dev_type != HCI_PRIMARY && dev_type != HCI_AMP) 396 - return -EINVAL; 397 390 398 391 /* bits 2-5 are reserved (must be zero) */ 399 392 if (opcode & 0x3c) ··· 405 412 data->hdev = hdev; 406 413 407 414 hdev->bus = HCI_VIRTUAL; 408 - hdev->dev_type = dev_type; 409 415 hci_set_drvdata(hdev, data); 410 416 411 417 hdev->open = vhci_open_dev; ··· 626 634 struct vhci_data *data = container_of(work, struct vhci_data, 627 635 open_timeout.work); 628 636 629 - vhci_create_device(data, amp ? HCI_AMP : HCI_PRIMARY); 637 + vhci_create_device(data, 0x00); 630 638 } 631 639 632 640 static int vhci_open(struct inode *inode, struct file *file)
-2
drivers/bluetooth/virtio_bt.c
··· 274 274 275 275 switch (type) { 276 276 case VIRTIO_BT_CONFIG_TYPE_PRIMARY: 277 - case VIRTIO_BT_CONFIG_TYPE_AMP: 278 277 break; 279 278 default: 280 279 return -EINVAL; ··· 302 303 vbt->hdev = hdev; 303 304 304 305 hdev->bus = HCI_VIRTIO; 305 - hdev->dev_type = type; 306 306 hci_set_drvdata(hdev, vbt); 307 307 308 308 hdev->open = virtbt_open;
-114
include/net/bluetooth/hci.h
··· 33 33 #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) 34 34 35 35 #define HCI_LINK_KEY_SIZE 16 36 - #define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE) 37 - 38 - #define HCI_MAX_AMP_ASSOC_SIZE 672 39 36 40 37 #define HCI_MAX_CPB_DATA_SIZE 252 41 38 ··· 67 70 #define HCI_I2C 8 68 71 #define HCI_SMD 9 69 72 #define HCI_VIRTIO 10 70 - 71 - /* HCI controller types */ 72 - #define HCI_PRIMARY 0x00 73 - #define HCI_AMP 0x01 74 - 75 - /* First BR/EDR Controller shall have ID = 0 */ 76 - #define AMP_ID_BREDR 0x00 77 - 78 - /* AMP controller types */ 79 - #define AMP_TYPE_BREDR 0x00 80 - #define AMP_TYPE_80211 0x01 81 - 82 - /* AMP controller status */ 83 - #define AMP_STATUS_POWERED_DOWN 0x00 84 - #define AMP_STATUS_BLUETOOTH_ONLY 0x01 85 - #define AMP_STATUS_NO_CAPACITY 0x02 86 - #define AMP_STATUS_LOW_CAPACITY 0x03 87 - #define AMP_STATUS_MEDIUM_CAPACITY 0x04 88 - #define AMP_STATUS_HIGH_CAPACITY 0x05 89 - #define AMP_STATUS_FULL_CAPACITY 0x06 90 73 91 74 /* HCI device quirks */ 92 75 enum { ··· 504 527 #define ESCO_LINK 0x02 505 528 /* Low Energy links do not have defined link type. Use invented one */ 506 529 #define LE_LINK 0x80 507 - #define AMP_LINK 0x81 508 530 #define ISO_LINK 0x82 509 531 #define INVALID_LINK 0xff 510 532 ··· 917 941 struct hci_cp_io_capability_neg_reply { 918 942 bdaddr_t bdaddr; 919 943 __u8 reason; 920 - } __packed; 921 - 922 - #define HCI_OP_CREATE_PHY_LINK 0x0435 923 - struct hci_cp_create_phy_link { 924 - __u8 phy_handle; 925 - __u8 key_len; 926 - __u8 key_type; 927 - __u8 key[HCI_AMP_LINK_KEY_SIZE]; 928 - } __packed; 929 - 930 - #define HCI_OP_ACCEPT_PHY_LINK 0x0436 931 - struct hci_cp_accept_phy_link { 932 - __u8 phy_handle; 933 - __u8 key_len; 934 - __u8 key_type; 935 - __u8 key[HCI_AMP_LINK_KEY_SIZE]; 936 - } __packed; 937 - 938 - #define HCI_OP_DISCONN_PHY_LINK 0x0437 939 - struct hci_cp_disconn_phy_link { 940 - __u8 phy_handle; 941 - __u8 reason; 942 - } __packed; 943 - 944 - struct ext_flow_spec { 945 - __u8 id; 946 - __u8 stype; 947 - __le16 msdu; 948 - __le32 sdu_itime; 949 - __le32 acc_lat; 950 - __le32 flush_to; 951 - } __packed; 952 - 953 - #define HCI_OP_CREATE_LOGICAL_LINK 0x0438 954 - #define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439 955 - struct hci_cp_create_accept_logical_link { 956 - __u8 phy_handle; 957 - struct ext_flow_spec tx_flow_spec; 958 - struct ext_flow_spec rx_flow_spec; 959 - } __packed; 960 - 961 - #define HCI_OP_DISCONN_LOGICAL_LINK 0x043a 962 - struct hci_cp_disconn_logical_link { 963 - __le16 log_handle; 964 - } __packed; 965 - 966 - #define HCI_OP_LOGICAL_LINK_CANCEL 0x043b 967 - struct hci_cp_logical_link_cancel { 968 - __u8 phy_handle; 969 - __u8 flow_spec_id; 970 944 } __packed; 971 945 972 946 #define HCI_OP_ENHANCED_SETUP_SYNC_CONN 0x043d ··· 1538 1612 __u8 status; 1539 1613 __le16 handle; 1540 1614 __u8 key_size; 1541 - } __packed; 1542 - 1543 - #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 1544 - struct hci_rp_read_local_amp_info { 1545 - __u8 status; 1546 - __u8 amp_status; 1547 - __le32 total_bw; 1548 - __le32 max_bw; 1549 - __le32 min_latency; 1550 - __le32 max_pdu; 1551 - __u8 amp_type; 1552 - __le16 pal_cap; 1553 - __le16 max_assoc_size; 1554 - __le32 max_flush_to; 1555 - __le32 be_flush_to; 1556 - } __packed; 1557 - 1558 - #define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a 1559 - struct hci_cp_read_local_amp_assoc { 1560 - __u8 phy_handle; 1561 - __le16 len_so_far; 1562 - __le16 max_len; 1563 - } __packed; 1564 - struct hci_rp_read_local_amp_assoc { 1565 - __u8 status; 1566 - __u8 phy_handle; 1567 - __le16 rem_len; 1568 - __u8 frag[]; 1569 - } __packed; 1570 - 1571 - #define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b 1572 - struct hci_cp_write_remote_amp_assoc { 1573 - __u8 phy_handle; 1574 - __le16 len_so_far; 1575 - __le16 rem_len; 1576 - __u8 frag[]; 1577 - } __packed; 1578 - struct hci_rp_write_remote_amp_assoc { 1579 - __u8 status; 1580 - __u8 phy_handle; 1581 1615 } __packed; 1582 1616 1583 1617 #define HCI_OP_GET_MWS_TRANSPORT_CONFIG 0x140c
+1 -45
include/net/bluetooth/hci_core.h
··· 126 126 struct hci_conn_hash { 127 127 struct list_head list; 128 128 unsigned int acl_num; 129 - unsigned int amp_num; 130 129 unsigned int sco_num; 131 130 unsigned int iso_num; 132 131 unsigned int le_num; ··· 340 341 /* Default authenticated payload timeout 30s */ 341 342 #define DEFAULT_AUTH_PAYLOAD_TIMEOUT 0x0bb8 342 343 343 - struct amp_assoc { 344 - __u16 len; 345 - __u16 offset; 346 - __u16 rem_len; 347 - __u16 len_so_far; 348 - __u8 data[HCI_MAX_AMP_ASSOC_SIZE]; 349 - }; 350 - 351 344 #define HCI_MAX_PAGES 3 352 345 353 346 struct hci_dev { ··· 352 361 unsigned long flags; 353 362 __u16 id; 354 363 __u8 bus; 355 - __u8 dev_type; 356 364 bdaddr_t bdaddr; 357 365 bdaddr_t setup_addr; 358 366 bdaddr_t public_addr; ··· 457 467 __u16 sniff_min_interval; 458 468 __u16 sniff_max_interval; 459 469 460 - __u8 amp_status; 461 - __u32 amp_total_bw; 462 - __u32 amp_max_bw; 463 - __u32 amp_min_latency; 464 - __u32 amp_max_pdu; 465 - __u8 amp_type; 466 - __u16 amp_pal_cap; 467 - __u16 amp_assoc_size; 468 - __u32 amp_max_flush_to; 469 - __u32 amp_be_flush_to; 470 - 471 - struct amp_assoc loc_assoc; 472 - 473 - __u8 flow_ctl_mode; 474 - 475 470 unsigned int auto_accept_delay; 476 471 477 472 unsigned long quirks; ··· 475 500 unsigned int sco_pkts; 476 501 unsigned int le_pkts; 477 502 unsigned int iso_pkts; 478 - 479 - __u16 block_len; 480 - __u16 block_mtu; 481 - __u16 num_blocks; 482 - __u16 block_cnt; 483 503 484 504 unsigned long acl_last_tx; 485 505 unsigned long sco_last_tx; ··· 748 778 void *l2cap_data; 749 779 void *sco_data; 750 780 void *iso_data; 751 - struct amp_mgr *amp_mgr; 752 781 753 782 struct list_head link_list; 754 783 struct hci_conn *parent; ··· 774 805 struct sk_buff_head data_q; 775 806 unsigned int sent; 776 807 __u8 state; 777 - bool amp; 778 808 }; 779 809 780 810 struct hci_conn_params { ··· 982 1014 case ACL_LINK: 983 1015 h->acl_num++; 984 1016 break; 985 - case AMP_LINK: 986 - h->amp_num++; 987 - break; 988 1017 case LE_LINK: 989 1018 h->le_num++; 990 1019 if (c->role == HCI_ROLE_SLAVE) ··· 1008 1043 case ACL_LINK: 1009 1044 h->acl_num--; 1010 1045 break; 1011 - case AMP_LINK: 1012 - h->amp_num--; 1013 - break; 1014 1046 case LE_LINK: 1015 1047 h->le_num--; 1016 1048 if (c->role == HCI_ROLE_SLAVE) ··· 1029 1067 switch (type) { 1030 1068 case ACL_LINK: 1031 1069 return h->acl_num; 1032 - case AMP_LINK: 1033 - return h->amp_num; 1034 1070 case LE_LINK: 1035 1071 return h->le_num; 1036 1072 case SCO_LINK: ··· 1045 1085 { 1046 1086 struct hci_conn_hash *c = &hdev->conn_hash; 1047 1087 1048 - return c->acl_num + c->amp_num + c->sco_num + c->le_num + c->iso_num; 1088 + return c->acl_num + c->sco_num + c->le_num + c->iso_num; 1049 1089 } 1050 1090 1051 1091 static inline bool hci_conn_valid(struct hci_dev *hdev, struct hci_conn *conn) ··· 1568 1608 } else { 1569 1609 timeo = 0; 1570 1610 } 1571 - break; 1572 - 1573 - case AMP_LINK: 1574 - timeo = conn->disc_timeout; 1575 1611 break; 1576 1612 1577 1613 default:
-1
include/uapi/linux/virtio_bt.h
··· 13 13 14 14 enum virtio_bt_config_type { 15 15 VIRTIO_BT_CONFIG_TYPE_PRIMARY = 0, 16 - VIRTIO_BT_CONFIG_TYPE_AMP = 1, 17 16 }; 18 17 19 18 enum virtio_bt_config_vendor {
+1 -2
net/bluetooth/hci_conn.c
··· 1168 1168 1169 1169 list_for_each_entry(d, &hci_dev_list, list) { 1170 1170 if (!test_bit(HCI_UP, &d->flags) || 1171 - hci_dev_test_flag(d, HCI_USER_CHANNEL) || 1172 - d->dev_type != HCI_PRIMARY) 1171 + hci_dev_test_flag(d, HCI_USER_CHANNEL)) 1173 1172 continue; 1174 1173 1175 1174 /* Simple routing:
+10 -122
net/bluetooth/hci_core.c
··· 402 402 goto done; 403 403 } 404 404 405 - if (hdev->dev_type != HCI_PRIMARY) { 406 - err = -EOPNOTSUPP; 407 - goto done; 408 - } 409 - 410 405 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { 411 406 err = -EOPNOTSUPP; 412 407 goto done; ··· 754 759 goto done; 755 760 } 756 761 757 - if (hdev->dev_type != HCI_PRIMARY) { 758 - err = -EOPNOTSUPP; 759 - goto done; 760 - } 761 - 762 762 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { 763 763 err = -EOPNOTSUPP; 764 764 goto done; ··· 907 917 908 918 strscpy(di.name, hdev->name, sizeof(di.name)); 909 919 di.bdaddr = hdev->bdaddr; 910 - di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4); 920 + di.type = (hdev->bus & 0x0f); 911 921 di.flags = flags; 912 922 di.pkt_type = hdev->pkt_type; 913 923 if (lmp_bredr_capable(hdev)) { ··· 1023 1033 */ 1024 1034 if (hci_dev_test_flag(hdev, HCI_RFKILLED) || 1025 1035 hci_dev_test_flag(hdev, HCI_UNCONFIGURED) || 1026 - (hdev->dev_type == HCI_PRIMARY && 1027 - !bacmp(&hdev->bdaddr, BDADDR_ANY) && 1036 + (!bacmp(&hdev->bdaddr, BDADDR_ANY) && 1028 1037 !bacmp(&hdev->static_addr, BDADDR_ANY))) { 1029 1038 hci_dev_clear_flag(hdev, HCI_AUTO_OFF); 1030 1039 hci_dev_do_close(hdev); ··· 2631 2642 if (!hdev->open || !hdev->close || !hdev->send) 2632 2643 return -EINVAL; 2633 2644 2634 - /* Do not allow HCI_AMP devices to register at index 0, 2635 - * so the index can be used as the AMP controller ID. 2636 - */ 2637 - switch (hdev->dev_type) { 2638 - case HCI_PRIMARY: 2639 - id = ida_alloc_max(&hci_index_ida, HCI_MAX_ID - 1, GFP_KERNEL); 2640 - break; 2641 - case HCI_AMP: 2642 - id = ida_alloc_range(&hci_index_ida, 1, HCI_MAX_ID - 1, 2643 - GFP_KERNEL); 2644 - break; 2645 - default: 2646 - return -EINVAL; 2647 - } 2648 - 2645 + id = ida_alloc_max(&hci_index_ida, HCI_MAX_ID - 1, GFP_KERNEL); 2649 2646 if (id < 0) 2650 2647 return id; 2651 2648 ··· 2683 2708 hci_dev_set_flag(hdev, HCI_SETUP); 2684 2709 hci_dev_set_flag(hdev, HCI_AUTO_OFF); 2685 2710 2686 - if (hdev->dev_type == HCI_PRIMARY) { 2687 - /* Assume BR/EDR support until proven otherwise (such as 2688 - * through reading supported features during init. 2689 - */ 2690 - hci_dev_set_flag(hdev, HCI_BREDR_ENABLED); 2691 - } 2711 + /* Assume BR/EDR support until proven otherwise (such as 2712 + * through reading supported features during init. 2713 + */ 2714 + hci_dev_set_flag(hdev, HCI_BREDR_ENABLED); 2692 2715 2693 2716 write_lock(&hci_dev_list_lock); 2694 2717 list_add(&hdev->list, &hci_dev_list); ··· 3222 3249 3223 3250 hci_skb_pkt_type(skb) = HCI_ACLDATA_PKT; 3224 3251 3225 - switch (hdev->dev_type) { 3226 - case HCI_PRIMARY: 3227 - hci_add_acl_hdr(skb, conn->handle, flags); 3228 - break; 3229 - case HCI_AMP: 3230 - hci_add_acl_hdr(skb, chan->handle, flags); 3231 - break; 3232 - default: 3233 - bt_dev_err(hdev, "unknown dev_type %d", hdev->dev_type); 3234 - return; 3235 - } 3252 + hci_add_acl_hdr(skb, conn->handle, flags); 3236 3253 3237 3254 list = skb_shinfo(skb)->frag_list; 3238 3255 if (!list) { ··· 3381 3418 switch (conn->type) { 3382 3419 case ACL_LINK: 3383 3420 cnt = hdev->acl_cnt; 3384 - break; 3385 - case AMP_LINK: 3386 - cnt = hdev->block_cnt; 3387 3421 break; 3388 3422 case SCO_LINK: 3389 3423 case ESCO_LINK: ··· 3579 3619 3580 3620 } 3581 3621 3582 - static inline int __get_blocks(struct hci_dev *hdev, struct sk_buff *skb) 3583 - { 3584 - /* Calculate count of blocks used by this packet */ 3585 - return DIV_ROUND_UP(skb->len - HCI_ACL_HDR_SIZE, hdev->block_len); 3586 - } 3587 - 3588 3622 static void __check_timeout(struct hci_dev *hdev, unsigned int cnt, u8 type) 3589 3623 { 3590 3624 unsigned long last_tx; ··· 3692 3738 hci_prio_recalculate(hdev, ACL_LINK); 3693 3739 } 3694 3740 3695 - static void hci_sched_acl_blk(struct hci_dev *hdev) 3696 - { 3697 - unsigned int cnt = hdev->block_cnt; 3698 - struct hci_chan *chan; 3699 - struct sk_buff *skb; 3700 - int quote; 3701 - u8 type; 3702 - 3703 - BT_DBG("%s", hdev->name); 3704 - 3705 - if (hdev->dev_type == HCI_AMP) 3706 - type = AMP_LINK; 3707 - else 3708 - type = ACL_LINK; 3709 - 3710 - __check_timeout(hdev, cnt, type); 3711 - 3712 - while (hdev->block_cnt > 0 && 3713 - (chan = hci_chan_sent(hdev, type, &quote))) { 3714 - u32 priority = (skb_peek(&chan->data_q))->priority; 3715 - while (quote > 0 && (skb = skb_peek(&chan->data_q))) { 3716 - int blocks; 3717 - 3718 - BT_DBG("chan %p skb %p len %d priority %u", chan, skb, 3719 - skb->len, skb->priority); 3720 - 3721 - /* Stop if priority has changed */ 3722 - if (skb->priority < priority) 3723 - break; 3724 - 3725 - skb = skb_dequeue(&chan->data_q); 3726 - 3727 - blocks = __get_blocks(hdev, skb); 3728 - if (blocks > hdev->block_cnt) 3729 - return; 3730 - 3731 - hci_conn_enter_active_mode(chan->conn, 3732 - bt_cb(skb)->force_active); 3733 - 3734 - hci_send_frame(hdev, skb); 3735 - hdev->acl_last_tx = jiffies; 3736 - 3737 - hdev->block_cnt -= blocks; 3738 - quote -= blocks; 3739 - 3740 - chan->sent += blocks; 3741 - chan->conn->sent += blocks; 3742 - } 3743 - } 3744 - 3745 - if (cnt != hdev->block_cnt) 3746 - hci_prio_recalculate(hdev, type); 3747 - } 3748 - 3749 3741 static void hci_sched_acl(struct hci_dev *hdev) 3750 3742 { 3751 3743 BT_DBG("%s", hdev->name); 3752 3744 3753 3745 /* No ACL link over BR/EDR controller */ 3754 - if (!hci_conn_num(hdev, ACL_LINK) && hdev->dev_type == HCI_PRIMARY) 3746 + if (!hci_conn_num(hdev, ACL_LINK)) 3755 3747 return; 3756 3748 3757 - /* No AMP link over AMP controller */ 3758 - if (!hci_conn_num(hdev, AMP_LINK) && hdev->dev_type == HCI_AMP) 3759 - return; 3760 - 3761 - switch (hdev->flow_ctl_mode) { 3762 - case HCI_FLOW_CTL_MODE_PACKET_BASED: 3763 - hci_sched_acl_pkt(hdev); 3764 - break; 3765 - 3766 - case HCI_FLOW_CTL_MODE_BLOCK_BASED: 3767 - hci_sched_acl_blk(hdev); 3768 - break; 3769 - } 3749 + hci_sched_acl_pkt(hdev); 3770 3750 } 3771 3751 3772 3752 static void hci_sched_le(struct hci_dev *hdev)
-147
net/bluetooth/hci_event.c
··· 913 913 return rp->status; 914 914 } 915 915 916 - static u8 hci_cc_read_flow_control_mode(struct hci_dev *hdev, void *data, 917 - struct sk_buff *skb) 918 - { 919 - struct hci_rp_read_flow_control_mode *rp = data; 920 - 921 - bt_dev_dbg(hdev, "status 0x%2.2x", rp->status); 922 - 923 - if (rp->status) 924 - return rp->status; 925 - 926 - hdev->flow_ctl_mode = rp->mode; 927 - 928 - return rp->status; 929 - } 930 - 931 916 static u8 hci_cc_read_buffer_size(struct hci_dev *hdev, void *data, 932 917 struct sk_buff *skb) 933 918 { ··· 1056 1071 return rp->status; 1057 1072 } 1058 1073 1059 - static u8 hci_cc_read_data_block_size(struct hci_dev *hdev, void *data, 1060 - struct sk_buff *skb) 1061 - { 1062 - struct hci_rp_read_data_block_size *rp = data; 1063 - 1064 - bt_dev_dbg(hdev, "status 0x%2.2x", rp->status); 1065 - 1066 - if (rp->status) 1067 - return rp->status; 1068 - 1069 - hdev->block_mtu = __le16_to_cpu(rp->max_acl_len); 1070 - hdev->block_len = __le16_to_cpu(rp->block_len); 1071 - hdev->num_blocks = __le16_to_cpu(rp->num_blocks); 1072 - 1073 - hdev->block_cnt = hdev->num_blocks; 1074 - 1075 - BT_DBG("%s blk mtu %d cnt %d len %d", hdev->name, hdev->block_mtu, 1076 - hdev->block_cnt, hdev->block_len); 1077 - 1078 - return rp->status; 1079 - } 1080 - 1081 1074 static u8 hci_cc_read_clock(struct hci_dev *hdev, void *data, 1082 1075 struct sk_buff *skb) 1083 1076 { ··· 1087 1124 1088 1125 unlock: 1089 1126 hci_dev_unlock(hdev); 1090 - return rp->status; 1091 - } 1092 - 1093 - static u8 hci_cc_read_local_amp_info(struct hci_dev *hdev, void *data, 1094 - struct sk_buff *skb) 1095 - { 1096 - struct hci_rp_read_local_amp_info *rp = data; 1097 - 1098 - bt_dev_dbg(hdev, "status 0x%2.2x", rp->status); 1099 - 1100 - if (rp->status) 1101 - return rp->status; 1102 - 1103 - hdev->amp_status = rp->amp_status; 1104 - hdev->amp_total_bw = __le32_to_cpu(rp->total_bw); 1105 - hdev->amp_max_bw = __le32_to_cpu(rp->max_bw); 1106 - hdev->amp_min_latency = __le32_to_cpu(rp->min_latency); 1107 - hdev->amp_max_pdu = __le32_to_cpu(rp->max_pdu); 1108 - hdev->amp_type = rp->amp_type; 1109 - hdev->amp_pal_cap = __le16_to_cpu(rp->pal_cap); 1110 - hdev->amp_assoc_size = __le16_to_cpu(rp->max_assoc_size); 1111 - hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to); 1112 - hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to); 1113 - 1114 1127 return rp->status; 1115 1128 } 1116 1129 ··· 4059 4120 HCI_CC(HCI_OP_READ_PAGE_SCAN_TYPE, hci_cc_read_page_scan_type, 4060 4121 sizeof(struct hci_rp_read_page_scan_type)), 4061 4122 HCI_CC_STATUS(HCI_OP_WRITE_PAGE_SCAN_TYPE, hci_cc_write_page_scan_type), 4062 - HCI_CC(HCI_OP_READ_DATA_BLOCK_SIZE, hci_cc_read_data_block_size, 4063 - sizeof(struct hci_rp_read_data_block_size)), 4064 - HCI_CC(HCI_OP_READ_FLOW_CONTROL_MODE, hci_cc_read_flow_control_mode, 4065 - sizeof(struct hci_rp_read_flow_control_mode)), 4066 - HCI_CC(HCI_OP_READ_LOCAL_AMP_INFO, hci_cc_read_local_amp_info, 4067 - sizeof(struct hci_rp_read_local_amp_info)), 4068 4123 HCI_CC(HCI_OP_READ_CLOCK, hci_cc_read_clock, 4069 4124 sizeof(struct hci_rp_read_clock)), 4070 4125 HCI_CC(HCI_OP_READ_ENC_KEY_SIZE, hci_cc_read_enc_key_size, ··· 4394 4461 flex_array_size(ev, handles, ev->num))) 4395 4462 return; 4396 4463 4397 - if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_PACKET_BASED) { 4398 - bt_dev_err(hdev, "wrong event for mode %d", hdev->flow_ctl_mode); 4399 - return; 4400 - } 4401 - 4402 4464 bt_dev_dbg(hdev, "num %d", ev->num); 4403 4465 4404 4466 for (i = 0; i < ev->num; i++) { ··· 4449 4521 if (hdev->acl_cnt > hdev->acl_pkts) 4450 4522 hdev->acl_cnt = hdev->acl_pkts; 4451 4523 } 4452 - break; 4453 - 4454 - default: 4455 - bt_dev_err(hdev, "unknown type %d conn %p", 4456 - conn->type, conn); 4457 - break; 4458 - } 4459 - } 4460 - 4461 - queue_work(hdev->workqueue, &hdev->tx_work); 4462 - } 4463 - 4464 - static struct hci_conn *__hci_conn_lookup_handle(struct hci_dev *hdev, 4465 - __u16 handle) 4466 - { 4467 - struct hci_chan *chan; 4468 - 4469 - switch (hdev->dev_type) { 4470 - case HCI_PRIMARY: 4471 - return hci_conn_hash_lookup_handle(hdev, handle); 4472 - case HCI_AMP: 4473 - chan = hci_chan_lookup_handle(hdev, handle); 4474 - if (chan) 4475 - return chan->conn; 4476 - break; 4477 - default: 4478 - bt_dev_err(hdev, "unknown dev_type %d", hdev->dev_type); 4479 - break; 4480 - } 4481 - 4482 - return NULL; 4483 - } 4484 - 4485 - static void hci_num_comp_blocks_evt(struct hci_dev *hdev, void *data, 4486 - struct sk_buff *skb) 4487 - { 4488 - struct hci_ev_num_comp_blocks *ev = data; 4489 - int i; 4490 - 4491 - if (!hci_ev_skb_pull(hdev, skb, HCI_EV_NUM_COMP_BLOCKS, 4492 - flex_array_size(ev, handles, ev->num_hndl))) 4493 - return; 4494 - 4495 - if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_BLOCK_BASED) { 4496 - bt_dev_err(hdev, "wrong event for mode %d", 4497 - hdev->flow_ctl_mode); 4498 - return; 4499 - } 4500 - 4501 - bt_dev_dbg(hdev, "num_blocks %d num_hndl %d", ev->num_blocks, 4502 - ev->num_hndl); 4503 - 4504 - for (i = 0; i < ev->num_hndl; i++) { 4505 - struct hci_comp_blocks_info *info = &ev->handles[i]; 4506 - struct hci_conn *conn = NULL; 4507 - __u16 handle, block_count; 4508 - 4509 - handle = __le16_to_cpu(info->handle); 4510 - block_count = __le16_to_cpu(info->blocks); 4511 - 4512 - conn = __hci_conn_lookup_handle(hdev, handle); 4513 - if (!conn) 4514 - continue; 4515 - 4516 - conn->sent -= block_count; 4517 - 4518 - switch (conn->type) { 4519 - case ACL_LINK: 4520 - case AMP_LINK: 4521 - hdev->block_cnt += block_count; 4522 - if (hdev->block_cnt > hdev->num_blocks) 4523 - hdev->block_cnt = hdev->num_blocks; 4524 4524 break; 4525 4525 4526 4526 default: ··· 7376 7520 /* [0x3e = HCI_EV_LE_META] */ 7377 7521 HCI_EV_REQ_VL(HCI_EV_LE_META, hci_le_meta_evt, 7378 7522 sizeof(struct hci_ev_le_meta), HCI_MAX_EVENT_SIZE), 7379 - /* [0x48 = HCI_EV_NUM_COMP_BLOCKS] */ 7380 - HCI_EV(HCI_EV_NUM_COMP_BLOCKS, hci_num_comp_blocks_evt, 7381 - sizeof(struct hci_ev_num_comp_blocks)), 7382 7523 /* [0xff = HCI_EV_VENDOR] */ 7383 7524 HCI_EV_VL(HCI_EV_VENDOR, msft_vendor_evt, 0, HCI_MAX_EVENT_SIZE), 7384 7525 };
+1 -4
net/bluetooth/hci_sock.c
··· 485 485 return NULL; 486 486 487 487 ni = skb_put(skb, HCI_MON_NEW_INDEX_SIZE); 488 - ni->type = hdev->dev_type; 488 + ni->type = 0x00; /* Old hdev->dev_type */ 489 489 ni->bus = hdev->bus; 490 490 bacpy(&ni->bdaddr, &hdev->bdaddr); 491 491 memcpy_and_pad(ni->name, sizeof(ni->name), hdev->name, ··· 1005 1005 return -EBUSY; 1006 1006 1007 1007 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) 1008 - return -EOPNOTSUPP; 1009 - 1010 - if (hdev->dev_type != HCI_PRIMARY) 1011 1008 return -EOPNOTSUPP; 1012 1009 1013 1010 switch (cmd) {
+4 -108
net/bluetooth/hci_sync.c
··· 3511 3511 /* Read Local Supported Features. */ 3512 3512 static int hci_read_local_features_sync(struct hci_dev *hdev) 3513 3513 { 3514 - /* Not all AMP controllers support this command */ 3515 - if (hdev->dev_type == HCI_AMP && !(hdev->commands[14] & 0x20)) 3516 - return 0; 3517 - 3518 3514 return __hci_cmd_sync_status(hdev, HCI_OP_READ_LOCAL_FEATURES, 3519 3515 0, NULL, HCI_CMD_TIMEOUT); 3520 3516 } ··· 3545 3549 return 0; 3546 3550 } 3547 3551 3548 - /* Read Local AMP Info */ 3549 - static int hci_read_local_amp_info_sync(struct hci_dev *hdev) 3550 - { 3551 - return __hci_cmd_sync_status(hdev, HCI_OP_READ_LOCAL_AMP_INFO, 3552 - 0, NULL, HCI_CMD_TIMEOUT); 3553 - } 3554 - 3555 - /* Read Data Blk size */ 3556 - static int hci_read_data_block_size_sync(struct hci_dev *hdev) 3557 - { 3558 - return __hci_cmd_sync_status(hdev, HCI_OP_READ_DATA_BLOCK_SIZE, 3559 - 0, NULL, HCI_CMD_TIMEOUT); 3560 - } 3561 - 3562 - /* Read Flow Control Mode */ 3563 - static int hci_read_flow_control_mode_sync(struct hci_dev *hdev) 3564 - { 3565 - return __hci_cmd_sync_status(hdev, HCI_OP_READ_FLOW_CONTROL_MODE, 3566 - 0, NULL, HCI_CMD_TIMEOUT); 3567 - } 3568 - 3569 - /* Read Location Data */ 3570 - static int hci_read_location_data_sync(struct hci_dev *hdev) 3571 - { 3572 - return __hci_cmd_sync_status(hdev, HCI_OP_READ_LOCATION_DATA, 3573 - 0, NULL, HCI_CMD_TIMEOUT); 3574 - } 3575 - 3576 - /* AMP Controller init stage 1 command sequence */ 3577 - static const struct hci_init_stage amp_init1[] = { 3578 - /* HCI_OP_READ_LOCAL_VERSION */ 3579 - HCI_INIT(hci_read_local_version_sync), 3580 - /* HCI_OP_READ_LOCAL_COMMANDS */ 3581 - HCI_INIT(hci_read_local_cmds_sync), 3582 - /* HCI_OP_READ_LOCAL_AMP_INFO */ 3583 - HCI_INIT(hci_read_local_amp_info_sync), 3584 - /* HCI_OP_READ_DATA_BLOCK_SIZE */ 3585 - HCI_INIT(hci_read_data_block_size_sync), 3586 - /* HCI_OP_READ_FLOW_CONTROL_MODE */ 3587 - HCI_INIT(hci_read_flow_control_mode_sync), 3588 - /* HCI_OP_READ_LOCATION_DATA */ 3589 - HCI_INIT(hci_read_location_data_sync), 3590 - {} 3591 - }; 3592 - 3593 3552 static int hci_init1_sync(struct hci_dev *hdev) 3594 3553 { 3595 3554 int err; ··· 3558 3607 return err; 3559 3608 } 3560 3609 3561 - switch (hdev->dev_type) { 3562 - case HCI_PRIMARY: 3563 - hdev->flow_ctl_mode = HCI_FLOW_CTL_MODE_PACKET_BASED; 3564 - return hci_init_stage_sync(hdev, br_init1); 3565 - case HCI_AMP: 3566 - hdev->flow_ctl_mode = HCI_FLOW_CTL_MODE_BLOCK_BASED; 3567 - return hci_init_stage_sync(hdev, amp_init1); 3568 - default: 3569 - bt_dev_err(hdev, "Unknown device type %d", hdev->dev_type); 3570 - break; 3571 - } 3572 - 3573 - return 0; 3610 + return hci_init_stage_sync(hdev, br_init1); 3574 3611 } 3575 - 3576 - /* AMP Controller init stage 2 command sequence */ 3577 - static const struct hci_init_stage amp_init2[] = { 3578 - /* HCI_OP_READ_LOCAL_FEATURES */ 3579 - HCI_INIT(hci_read_local_features_sync), 3580 - {} 3581 - }; 3582 3612 3583 3613 /* Read Buffer Size (ACL mtu, max pkt, etc.) */ 3584 3614 static int hci_read_buffer_size_sync(struct hci_dev *hdev) ··· 3817 3885 int err; 3818 3886 3819 3887 bt_dev_dbg(hdev, ""); 3820 - 3821 - if (hdev->dev_type == HCI_AMP) 3822 - return hci_init_stage_sync(hdev, amp_init2); 3823 3888 3824 3889 err = hci_init_stage_sync(hdev, hci_init2); 3825 3890 if (err) ··· 4645 4716 if (err < 0) 4646 4717 return err; 4647 4718 4648 - /* HCI_PRIMARY covers both single-mode LE, BR/EDR and dual-mode 4649 - * BR/EDR/LE type controllers. AMP controllers only need the 4650 - * first two stages of init. 4651 - */ 4652 - if (hdev->dev_type != HCI_PRIMARY) 4653 - return 0; 4654 - 4655 4719 err = hci_init3_sync(hdev); 4656 4720 if (err < 0) 4657 4721 return err; ··· 4873 4951 * In case of user channel usage, it is not important 4874 4952 * if a public address or static random address is 4875 4953 * available. 4876 - * 4877 - * This check is only valid for BR/EDR controllers 4878 - * since AMP controllers do not have an address. 4879 4954 */ 4880 4955 if (!hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && 4881 - hdev->dev_type == HCI_PRIMARY && 4882 4956 !bacmp(&hdev->bdaddr, BDADDR_ANY) && 4883 4957 !bacmp(&hdev->static_addr, BDADDR_ANY)) { 4884 4958 ret = -EADDRNOTAVAIL; ··· 4909 4991 !hci_dev_test_flag(hdev, HCI_CONFIG) && 4910 4992 !hci_dev_test_flag(hdev, HCI_UNCONFIGURED) && 4911 4993 !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && 4912 - hci_dev_test_flag(hdev, HCI_MGMT) && 4913 - hdev->dev_type == HCI_PRIMARY) { 4994 + hci_dev_test_flag(hdev, HCI_MGMT)) { 4914 4995 ret = hci_powered_update_sync(hdev); 4915 4996 mgmt_power_on(hdev, ret); 4916 4997 } ··· 5054 5137 5055 5138 auto_off = hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF); 5056 5139 5057 - if (!auto_off && hdev->dev_type == HCI_PRIMARY && 5058 - !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && 5140 + if (!auto_off && !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && 5059 5141 hci_dev_test_flag(hdev, HCI_MGMT)) 5060 5142 __mgmt_power_off(hdev); 5061 5143 ··· 5116 5200 hdev->flags &= BIT(HCI_RAW); 5117 5201 hci_dev_clear_volatile_flags(hdev); 5118 5202 5119 - /* Controller radio is available but is currently powered down */ 5120 - hdev->amp_status = AMP_STATUS_POWERED_DOWN; 5121 - 5122 5203 memset(hdev->eir, 0, sizeof(hdev->eir)); 5123 5204 memset(hdev->dev_class, 0, sizeof(hdev->dev_class)); 5124 5205 bacpy(&hdev->random_addr, BDADDR_ANY); ··· 5152 5239 */ 5153 5240 if (hci_dev_test_flag(hdev, HCI_RFKILLED) || 5154 5241 hci_dev_test_flag(hdev, HCI_UNCONFIGURED) || 5155 - (hdev->dev_type == HCI_PRIMARY && 5156 - !bacmp(&hdev->bdaddr, BDADDR_ANY) && 5242 + (!bacmp(&hdev->bdaddr, BDADDR_ANY) && 5157 5243 !bacmp(&hdev->static_addr, BDADDR_ANY))) { 5158 5244 hci_dev_clear_flag(hdev, HCI_AUTO_OFF); 5159 5245 hci_dev_close_sync(hdev); ··· 5254 5342 return 0; 5255 5343 } 5256 5344 5257 - static int hci_disconnect_phy_link_sync(struct hci_dev *hdev, u16 handle, 5258 - u8 reason) 5259 - { 5260 - struct hci_cp_disconn_phy_link cp; 5261 - 5262 - memset(&cp, 0, sizeof(cp)); 5263 - cp.phy_handle = HCI_PHY_HANDLE(handle); 5264 - cp.reason = reason; 5265 - 5266 - return __hci_cmd_sync_status(hdev, HCI_OP_DISCONN_PHY_LINK, 5267 - sizeof(cp), &cp, HCI_CMD_TIMEOUT); 5268 - } 5269 - 5270 5345 static int hci_disconnect_sync(struct hci_dev *hdev, struct hci_conn *conn, 5271 5346 u8 reason) 5272 5347 { 5273 5348 struct hci_cp_disconnect cp; 5274 - 5275 - if (conn->type == AMP_LINK) 5276 - return hci_disconnect_phy_link_sync(hdev, conn->handle, reason); 5277 5349 5278 5350 if (test_bit(HCI_CONN_BIG_CREATED, &conn->flags)) { 5279 5351 /* This is a BIS connection, hci_conn_del will
+4 -17
net/bluetooth/l2cap_core.c
··· 3932 3932 } 3933 3933 3934 3934 static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, 3935 - u8 *data, u8 rsp_code, u8 amp_id) 3935 + u8 *data, u8 rsp_code) 3936 3936 { 3937 3937 struct l2cap_conn_req *req = (struct l2cap_conn_req *) data; 3938 3938 struct l2cap_conn_rsp rsp; ··· 4011 4011 status = L2CAP_CS_AUTHOR_PEND; 4012 4012 chan->ops->defer(chan); 4013 4013 } else { 4014 - /* Force pending result for AMP controllers. 4015 - * The connection will succeed after the 4016 - * physical link is up. 4017 - */ 4018 - if (amp_id == AMP_ID_BREDR) { 4019 - l2cap_state_change(chan, BT_CONFIG); 4020 - result = L2CAP_CR_SUCCESS; 4021 - } else { 4022 - l2cap_state_change(chan, BT_CONNECT2); 4023 - result = L2CAP_CR_PEND; 4024 - } 4014 + l2cap_state_change(chan, BT_CONNECT2); 4015 + result = L2CAP_CR_PEND; 4025 4016 status = L2CAP_CS_NO_INFO; 4026 4017 } 4027 4018 } else { ··· 4077 4086 mgmt_device_connected(hdev, hcon, NULL, 0); 4078 4087 hci_dev_unlock(hdev); 4079 4088 4080 - l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP, 0); 4089 + l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP); 4081 4090 return 0; 4082 4091 } 4083 4092 ··· 7481 7490 { 7482 7491 struct l2cap_conn *conn = hcon->l2cap_data; 7483 7492 int len; 7484 - 7485 - /* For AMP controller do not create l2cap conn */ 7486 - if (!conn && hcon->hdev->dev_type != HCI_PRIMARY) 7487 - goto drop; 7488 7493 7489 7494 if (!conn) 7490 7495 conn = l2cap_conn_add(hcon);
+27 -57
net/bluetooth/mgmt.c
··· 443 443 444 444 count = 0; 445 445 list_for_each_entry(d, &hci_dev_list, list) { 446 - if (d->dev_type == HCI_PRIMARY && 447 - !hci_dev_test_flag(d, HCI_UNCONFIGURED)) 446 + if (!hci_dev_test_flag(d, HCI_UNCONFIGURED)) 448 447 count++; 449 448 } 450 449 ··· 467 468 if (test_bit(HCI_QUIRK_RAW_DEVICE, &d->quirks)) 468 469 continue; 469 470 470 - if (d->dev_type == HCI_PRIMARY && 471 - !hci_dev_test_flag(d, HCI_UNCONFIGURED)) { 471 + if (!hci_dev_test_flag(d, HCI_UNCONFIGURED)) { 472 472 rp->index[count++] = cpu_to_le16(d->id); 473 473 bt_dev_dbg(hdev, "Added hci%u", d->id); 474 474 } ··· 501 503 502 504 count = 0; 503 505 list_for_each_entry(d, &hci_dev_list, list) { 504 - if (d->dev_type == HCI_PRIMARY && 505 - hci_dev_test_flag(d, HCI_UNCONFIGURED)) 506 + if (hci_dev_test_flag(d, HCI_UNCONFIGURED)) 506 507 count++; 507 508 } 508 509 ··· 525 528 if (test_bit(HCI_QUIRK_RAW_DEVICE, &d->quirks)) 526 529 continue; 527 530 528 - if (d->dev_type == HCI_PRIMARY && 529 - hci_dev_test_flag(d, HCI_UNCONFIGURED)) { 531 + if (hci_dev_test_flag(d, HCI_UNCONFIGURED)) { 530 532 rp->index[count++] = cpu_to_le16(d->id); 531 533 bt_dev_dbg(hdev, "Added hci%u", d->id); 532 534 } ··· 557 561 read_lock(&hci_dev_list_lock); 558 562 559 563 count = 0; 560 - list_for_each_entry(d, &hci_dev_list, list) { 561 - if (d->dev_type == HCI_PRIMARY || d->dev_type == HCI_AMP) 562 - count++; 563 - } 564 + list_for_each_entry(d, &hci_dev_list, list) 565 + count++; 564 566 565 567 rp = kmalloc(struct_size(rp, entry, count), GFP_ATOMIC); 566 568 if (!rp) { ··· 579 585 if (test_bit(HCI_QUIRK_RAW_DEVICE, &d->quirks)) 580 586 continue; 581 587 582 - if (d->dev_type == HCI_PRIMARY) { 583 - if (hci_dev_test_flag(d, HCI_UNCONFIGURED)) 584 - rp->entry[count].type = 0x01; 585 - else 586 - rp->entry[count].type = 0x00; 587 - } else if (d->dev_type == HCI_AMP) { 588 - rp->entry[count].type = 0x02; 589 - } else { 590 - continue; 591 - } 588 + if (hci_dev_test_flag(d, HCI_UNCONFIGURED)) 589 + rp->entry[count].type = 0x01; 590 + else 591 + rp->entry[count].type = 0x00; 592 592 593 593 rp->entry[count].bus = d->bus; 594 594 rp->entry[count++].index = cpu_to_le16(d->id); ··· 9319 9331 if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) 9320 9332 return; 9321 9333 9322 - switch (hdev->dev_type) { 9323 - case HCI_PRIMARY: 9324 - if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { 9325 - mgmt_index_event(MGMT_EV_UNCONF_INDEX_ADDED, hdev, 9326 - NULL, 0, HCI_MGMT_UNCONF_INDEX_EVENTS); 9327 - ev.type = 0x01; 9328 - } else { 9329 - mgmt_index_event(MGMT_EV_INDEX_ADDED, hdev, NULL, 0, 9330 - HCI_MGMT_INDEX_EVENTS); 9331 - ev.type = 0x00; 9332 - } 9333 - break; 9334 - case HCI_AMP: 9335 - ev.type = 0x02; 9336 - break; 9337 - default: 9338 - return; 9334 + if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { 9335 + mgmt_index_event(MGMT_EV_UNCONF_INDEX_ADDED, hdev, NULL, 0, 9336 + HCI_MGMT_UNCONF_INDEX_EVENTS); 9337 + ev.type = 0x01; 9338 + } else { 9339 + mgmt_index_event(MGMT_EV_INDEX_ADDED, hdev, NULL, 0, 9340 + HCI_MGMT_INDEX_EVENTS); 9341 + ev.type = 0x00; 9339 9342 } 9340 9343 9341 9344 ev.bus = hdev->bus; ··· 9343 9364 if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) 9344 9365 return; 9345 9366 9346 - switch (hdev->dev_type) { 9347 - case HCI_PRIMARY: 9348 - mgmt_pending_foreach(0, hdev, cmd_complete_rsp, &status); 9367 + mgmt_pending_foreach(0, hdev, cmd_complete_rsp, &status); 9349 9368 9350 - if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { 9351 - mgmt_index_event(MGMT_EV_UNCONF_INDEX_REMOVED, hdev, 9352 - NULL, 0, HCI_MGMT_UNCONF_INDEX_EVENTS); 9353 - ev.type = 0x01; 9354 - } else { 9355 - mgmt_index_event(MGMT_EV_INDEX_REMOVED, hdev, NULL, 0, 9356 - HCI_MGMT_INDEX_EVENTS); 9357 - ev.type = 0x00; 9358 - } 9359 - break; 9360 - case HCI_AMP: 9361 - ev.type = 0x02; 9362 - break; 9363 - default: 9364 - return; 9369 + if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { 9370 + mgmt_index_event(MGMT_EV_UNCONF_INDEX_REMOVED, hdev, NULL, 0, 9371 + HCI_MGMT_UNCONF_INDEX_EVENTS); 9372 + ev.type = 0x01; 9373 + } else { 9374 + mgmt_index_event(MGMT_EV_INDEX_REMOVED, hdev, NULL, 0, 9375 + HCI_MGMT_INDEX_EVENTS); 9376 + ev.type = 0x00; 9365 9377 } 9366 9378 9367 9379 ev.bus = hdev->bus;