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

Bluetooth: Rename HCI_BREDR into HCI_PRIMARY

The HCI_BREDR naming is confusing since it actually stands for Primary
Bluetooth Controller. Which is a term that has been used in the latest
standard. However from a legacy point of view there only really have
been Basic Rate (BR) and Enhanced Data Rate (EDR). Recent versions of
Bluetooth introduced Low Energy (LE) and made this terminology a little
bit confused since Dual Mode Controllers include BR/EDR and LE. To
simplify this the name HCI_PRIMARY stands for the Primary Controller
which can be a single mode or dual mode controller.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>

authored by

Marcel Holtmann and committed by
Johan Hedberg
ca8bee5d e14dbe72

+33 -35
+1 -1
drivers/bluetooth/btmrvl_main.c
··· 138 138 if (event->length > 3 && event->data[3]) 139 139 priv->btmrvl_dev.dev_type = HCI_AMP; 140 140 else 141 - priv->btmrvl_dev.dev_type = HCI_BREDR; 141 + priv->btmrvl_dev.dev_type = HCI_PRIMARY; 142 142 143 143 BT_DBG("dev_type: %d", priv->btmrvl_dev.dev_type); 144 144 } else if (priv->btmrvl_dev.sendcmdflag &&
+1 -1
drivers/bluetooth/btsdio.c
··· 311 311 if (id->class == SDIO_CLASS_BT_AMP) 312 312 hdev->dev_type = HCI_AMP; 313 313 else 314 - hdev->dev_type = HCI_BREDR; 314 + hdev->dev_type = HCI_PRIMARY; 315 315 316 316 data->hdev = hdev; 317 317
+1 -1
drivers/bluetooth/btusb.c
··· 2832 2832 if (id->driver_info & BTUSB_AMP) 2833 2833 hdev->dev_type = HCI_AMP; 2834 2834 else 2835 - hdev->dev_type = HCI_BREDR; 2835 + hdev->dev_type = HCI_PRIMARY; 2836 2836 2837 2837 data->hdev = hdev; 2838 2838
+1 -1
drivers/bluetooth/hci_ldisc.c
··· 609 609 if (test_bit(HCI_UART_CREATE_AMP, &hu->hdev_flags)) 610 610 hdev->dev_type = HCI_AMP; 611 611 else 612 - hdev->dev_type = HCI_BREDR; 612 + hdev->dev_type = HCI_PRIMARY; 613 613 614 614 if (test_bit(HCI_UART_INIT_PENDING, &hu->hdev_flags)) 615 615 return 0;
+3 -3
drivers/bluetooth/hci_vhci.c
··· 97 97 if (data->hdev) 98 98 return -EBADFD; 99 99 100 - /* bits 0-1 are dev_type (BR/EDR or AMP) */ 100 + /* bits 0-1 are dev_type (Primary or AMP) */ 101 101 dev_type = opcode & 0x03; 102 102 103 - if (dev_type != HCI_BREDR && dev_type != HCI_AMP) 103 + if (dev_type != HCI_PRIMARY && dev_type != HCI_AMP) 104 104 return -EINVAL; 105 105 106 106 /* bits 2-5 are reserved (must be zero) */ ··· 316 316 struct vhci_data *data = container_of(work, struct vhci_data, 317 317 open_timeout.work); 318 318 319 - vhci_create_device(data, amp ? HCI_AMP : HCI_BREDR); 319 + vhci_create_device(data, amp ? HCI_AMP : HCI_PRIMARY); 320 320 } 321 321 322 322 static int vhci_open(struct inode *inode, struct file *file)
+1 -1
include/net/bluetooth/hci.h
··· 65 65 #define HCI_I2C 8 66 66 67 67 /* HCI controller types */ 68 - #define HCI_BREDR 0x00 68 + #define HCI_PRIMARY 0x00 69 69 #define HCI_AMP 0x01 70 70 71 71 /* First BR/EDR Controller shall have ID = 0 */
+1 -1
net/bluetooth/hci_conn.c
··· 625 625 list_for_each_entry(d, &hci_dev_list, list) { 626 626 if (!test_bit(HCI_UP, &d->flags) || 627 627 hci_dev_test_flag(d, HCI_USER_CHANNEL) || 628 - d->dev_type != HCI_BREDR) 628 + d->dev_type != HCI_PRIMARY) 629 629 continue; 630 630 631 631 /* Simple routing:
+13 -15
net/bluetooth/hci_core.c
··· 260 260 hci_reset_req(req, 0); 261 261 262 262 switch (hdev->dev_type) { 263 - case HCI_BREDR: 263 + case HCI_PRIMARY: 264 264 bredr_init(req); 265 265 break; 266 - 267 266 case HCI_AMP: 268 267 amp_init1(req); 269 268 break; 270 - 271 269 default: 272 270 BT_ERR("Unknown device type %d", hdev->dev_type); 273 271 break; ··· 789 791 if (err < 0) 790 792 return err; 791 793 792 - /* HCI_BREDR covers both single-mode LE, BR/EDR and dual-mode 794 + /* HCI_PRIMARY covers both single-mode LE, BR/EDR and dual-mode 793 795 * BR/EDR/LE type controllers. AMP controllers only need the 794 796 * first two stages of init. 795 797 */ 796 - if (hdev->dev_type != HCI_BREDR) 798 + if (hdev->dev_type != HCI_PRIMARY) 797 799 return 0; 798 800 799 801 err = __hci_req_sync(hdev, hci_init3_req, 0, HCI_INIT_TIMEOUT, NULL); ··· 1200 1202 goto done; 1201 1203 } 1202 1204 1203 - if (hdev->dev_type != HCI_BREDR) { 1205 + if (hdev->dev_type != HCI_PRIMARY) { 1204 1206 err = -EOPNOTSUPP; 1205 1207 goto done; 1206 1208 } ··· 1305 1307 * since AMP controllers do not have an address. 1306 1308 */ 1307 1309 if (!hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && 1308 - hdev->dev_type == HCI_BREDR && 1310 + hdev->dev_type == HCI_PRIMARY && 1309 1311 !bacmp(&hdev->bdaddr, BDADDR_ANY) && 1310 1312 !bacmp(&hdev->static_addr, BDADDR_ANY)) { 1311 1313 ret = -EADDRNOTAVAIL; ··· 1400 1402 !hci_dev_test_flag(hdev, HCI_UNCONFIGURED) && 1401 1403 !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && 1402 1404 hci_dev_test_flag(hdev, HCI_MGMT) && 1403 - hdev->dev_type == HCI_BREDR) { 1405 + hdev->dev_type == HCI_PRIMARY) { 1404 1406 ret = __hci_req_hci_power_on(hdev); 1405 1407 mgmt_power_on(hdev, ret); 1406 1408 } ··· 1561 1563 1562 1564 auto_off = hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF); 1563 1565 1564 - if (!auto_off && hdev->dev_type == HCI_BREDR && 1566 + if (!auto_off && hdev->dev_type == HCI_PRIMARY && 1565 1567 hci_dev_test_flag(hdev, HCI_MGMT)) 1566 1568 __mgmt_power_off(hdev); 1567 1569 ··· 1800 1802 goto done; 1801 1803 } 1802 1804 1803 - if (hdev->dev_type != HCI_BREDR) { 1805 + if (hdev->dev_type != HCI_PRIMARY) { 1804 1806 err = -EOPNOTSUPP; 1805 1807 goto done; 1806 1808 } ··· 2041 2043 */ 2042 2044 if (hci_dev_test_flag(hdev, HCI_RFKILLED) || 2043 2045 hci_dev_test_flag(hdev, HCI_UNCONFIGURED) || 2044 - (hdev->dev_type == HCI_BREDR && 2046 + (hdev->dev_type == HCI_PRIMARY && 2045 2047 !bacmp(&hdev->bdaddr, BDADDR_ANY) && 2046 2048 !bacmp(&hdev->static_addr, BDADDR_ANY))) { 2047 2049 hci_dev_clear_flag(hdev, HCI_AUTO_OFF); ··· 3028 3030 * so the index can be used as the AMP controller ID. 3029 3031 */ 3030 3032 switch (hdev->dev_type) { 3031 - case HCI_BREDR: 3033 + case HCI_PRIMARY: 3032 3034 id = ida_simple_get(&hci_index_ida, 0, 0, GFP_KERNEL); 3033 3035 break; 3034 3036 case HCI_AMP: ··· 3088 3090 hci_dev_set_flag(hdev, HCI_SETUP); 3089 3091 hci_dev_set_flag(hdev, HCI_AUTO_OFF); 3090 3092 3091 - if (hdev->dev_type == HCI_BREDR) { 3093 + if (hdev->dev_type == HCI_PRIMARY) { 3092 3094 /* Assume BR/EDR support until proven otherwise (such as 3093 3095 * through reading supported features during init. 3094 3096 */ ··· 3413 3415 hci_skb_pkt_type(skb) = HCI_ACLDATA_PKT; 3414 3416 3415 3417 switch (hdev->dev_type) { 3416 - case HCI_BREDR: 3418 + case HCI_PRIMARY: 3417 3419 hci_add_acl_hdr(skb, conn->handle, flags); 3418 3420 break; 3419 3421 case HCI_AMP: ··· 3824 3826 BT_DBG("%s", hdev->name); 3825 3827 3826 3828 /* No ACL link over BR/EDR controller */ 3827 - if (!hci_conn_num(hdev, ACL_LINK) && hdev->dev_type == HCI_BREDR) 3829 + if (!hci_conn_num(hdev, ACL_LINK) && hdev->dev_type == HCI_PRIMARY) 3828 3830 return; 3829 3831 3830 3832 /* No AMP link over AMP controller */
+1 -1
net/bluetooth/hci_event.c
··· 3249 3249 struct hci_chan *chan; 3250 3250 3251 3251 switch (hdev->dev_type) { 3252 - case HCI_BREDR: 3252 + case HCI_PRIMARY: 3253 3253 return hci_conn_hash_lookup_handle(hdev, handle); 3254 3254 case HCI_AMP: 3255 3255 chan = hci_chan_lookup_handle(hdev, handle);
+1 -1
net/bluetooth/hci_sock.c
··· 676 676 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) 677 677 return -EOPNOTSUPP; 678 678 679 - if (hdev->dev_type != HCI_BREDR) 679 + if (hdev->dev_type != HCI_PRIMARY) 680 680 return -EOPNOTSUPP; 681 681 682 682 switch (cmd) {
+1 -1
net/bluetooth/l2cap_core.c
··· 7468 7468 int len; 7469 7469 7470 7470 /* For AMP controller do not create l2cap conn */ 7471 - if (!conn && hcon->hdev->dev_type != HCI_BREDR) 7471 + if (!conn && hcon->hdev->dev_type != HCI_PRIMARY) 7472 7472 goto drop; 7473 7473 7474 7474 if (!conn)
+8 -8
net/bluetooth/mgmt.c
··· 359 359 360 360 count = 0; 361 361 list_for_each_entry(d, &hci_dev_list, list) { 362 - if (d->dev_type == HCI_BREDR && 362 + if (d->dev_type == HCI_PRIMARY && 363 363 !hci_dev_test_flag(d, HCI_UNCONFIGURED)) 364 364 count++; 365 365 } ··· 384 384 if (test_bit(HCI_QUIRK_RAW_DEVICE, &d->quirks)) 385 385 continue; 386 386 387 - if (d->dev_type == HCI_BREDR && 387 + if (d->dev_type == HCI_PRIMARY && 388 388 !hci_dev_test_flag(d, HCI_UNCONFIGURED)) { 389 389 rp->index[count++] = cpu_to_le16(d->id); 390 390 BT_DBG("Added hci%u", d->id); ··· 419 419 420 420 count = 0; 421 421 list_for_each_entry(d, &hci_dev_list, list) { 422 - if (d->dev_type == HCI_BREDR && 422 + if (d->dev_type == HCI_PRIMARY && 423 423 hci_dev_test_flag(d, HCI_UNCONFIGURED)) 424 424 count++; 425 425 } ··· 444 444 if (test_bit(HCI_QUIRK_RAW_DEVICE, &d->quirks)) 445 445 continue; 446 446 447 - if (d->dev_type == HCI_BREDR && 447 + if (d->dev_type == HCI_PRIMARY && 448 448 hci_dev_test_flag(d, HCI_UNCONFIGURED)) { 449 449 rp->index[count++] = cpu_to_le16(d->id); 450 450 BT_DBG("Added hci%u", d->id); ··· 479 479 480 480 count = 0; 481 481 list_for_each_entry(d, &hci_dev_list, list) { 482 - if (d->dev_type == HCI_BREDR || d->dev_type == HCI_AMP) 482 + if (d->dev_type == HCI_PRIMARY || d->dev_type == HCI_AMP) 483 483 count++; 484 484 } 485 485 ··· 503 503 if (test_bit(HCI_QUIRK_RAW_DEVICE, &d->quirks)) 504 504 continue; 505 505 506 - if (d->dev_type == HCI_BREDR) { 506 + if (d->dev_type == HCI_PRIMARY) { 507 507 if (hci_dev_test_flag(d, HCI_UNCONFIGURED)) 508 508 rp->entry[count].type = 0x01; 509 509 else ··· 6366 6366 return; 6367 6367 6368 6368 switch (hdev->dev_type) { 6369 - case HCI_BREDR: 6369 + case HCI_PRIMARY: 6370 6370 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { 6371 6371 mgmt_index_event(MGMT_EV_UNCONF_INDEX_ADDED, hdev, 6372 6372 NULL, 0, HCI_MGMT_UNCONF_INDEX_EVENTS); ··· 6399 6399 return; 6400 6400 6401 6401 switch (hdev->dev_type) { 6402 - case HCI_BREDR: 6402 + case HCI_PRIMARY: 6403 6403 mgmt_pending_foreach(0, hdev, cmd_complete_rsp, &status); 6404 6404 6405 6405 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) {