diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2015-03-13 13:20:35 -0400 |
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@intel.com> | 2015-03-13 13:28:36 -0400 |
| commit | b7cb93e52839ee44959adabc17c2a17422e6bd4b (patch) | |
| tree | 8e00a2b40ace2987f34295f3084edd7fc126181c | |
| parent | eacb44dff98559d4682072c0061e1ecb63687e9c (diff) | |
Bluetooth: Merge hdev->dbg_flags fields into hdev->dev_flags
With the extension of hdev->dev_flags utilizing a bitmap now, the space
is no longer restricted. Merge the hdev->dbg_flags into hdev->dev_flags
to save space on 64-bit architectures. On 32-bit architectures no size
reduction happens.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
| -rw-r--r-- | include/net/bluetooth/hci.h | 14 | ||||
| -rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
| -rw-r--r-- | net/bluetooth/hci_core.c | 8 | ||||
| -rw-r--r-- | net/bluetooth/hci_debugfs.c | 6 | ||||
| -rw-r--r-- | net/bluetooth/hci_request.c | 2 | ||||
| -rw-r--r-- | net/bluetooth/l2cap_core.c | 2 | ||||
| -rw-r--r-- | net/bluetooth/mgmt.c | 2 | ||||
| -rw-r--r-- | net/bluetooth/smp.c | 10 |
8 files changed, 20 insertions, 25 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 7a0272a6f0ba..d942fedbaedd 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -179,15 +179,6 @@ enum { | |||
| 179 | HCI_RESET, | 179 | HCI_RESET, |
| 180 | }; | 180 | }; |
| 181 | 181 | ||
| 182 | /* BR/EDR and/or LE controller flags: the flags defined here should represent | ||
| 183 | * states configured via debugfs for debugging and testing purposes only. | ||
| 184 | */ | ||
| 185 | enum { | ||
| 186 | HCI_DUT_MODE, | ||
| 187 | HCI_FORCE_BREDR_SMP, | ||
| 188 | HCI_FORCE_STATIC_ADDR, | ||
| 189 | }; | ||
| 190 | |||
| 191 | /* | 182 | /* |
| 192 | * BR/EDR and/or LE controller flags: the flags defined here should represent | 183 | * BR/EDR and/or LE controller flags: the flags defined here should represent |
| 193 | * states from the controller. | 184 | * states from the controller. |
| @@ -226,6 +217,11 @@ enum { | |||
| 226 | HCI_FAST_CONNECTABLE, | 217 | HCI_FAST_CONNECTABLE, |
| 227 | HCI_BREDR_ENABLED, | 218 | HCI_BREDR_ENABLED, |
| 228 | HCI_LE_SCAN_INTERRUPTED, | 219 | HCI_LE_SCAN_INTERRUPTED, |
| 220 | |||
| 221 | HCI_DUT_MODE, | ||
| 222 | HCI_FORCE_BREDR_SMP, | ||
| 223 | HCI_FORCE_STATIC_ADDR, | ||
| 224 | |||
| 229 | __HCI_NUM_FLAGS, | 225 | __HCI_NUM_FLAGS, |
| 230 | }; | 226 | }; |
| 231 | 227 | ||
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 889a489d913f..6afbf5b014a1 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -353,7 +353,6 @@ struct hci_dev { | |||
| 353 | 353 | ||
| 354 | struct rfkill *rfkill; | 354 | struct rfkill *rfkill; |
| 355 | 355 | ||
| 356 | unsigned long dbg_flags; | ||
| 357 | DECLARE_BITMAP(dev_flags, __HCI_NUM_FLAGS); | 356 | DECLARE_BITMAP(dev_flags, __HCI_NUM_FLAGS); |
| 358 | 357 | ||
| 359 | struct delayed_work le_scan_disable; | 358 | struct delayed_work le_scan_disable; |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 23a43ca98785..750d3445f2d2 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
| @@ -80,7 +80,7 @@ static ssize_t dut_mode_read(struct file *file, char __user *user_buf, | |||
| 80 | struct hci_dev *hdev = file->private_data; | 80 | struct hci_dev *hdev = file->private_data; |
| 81 | char buf[3]; | 81 | char buf[3]; |
| 82 | 82 | ||
| 83 | buf[0] = test_bit(HCI_DUT_MODE, &hdev->dbg_flags) ? 'Y': 'N'; | 83 | buf[0] = hci_dev_test_flag(hdev, HCI_DUT_MODE) ? 'Y': 'N'; |
| 84 | buf[1] = '\n'; | 84 | buf[1] = '\n'; |
| 85 | buf[2] = '\0'; | 85 | buf[2] = '\0'; |
| 86 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); | 86 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); |
| @@ -106,7 +106,7 @@ static ssize_t dut_mode_write(struct file *file, const char __user *user_buf, | |||
| 106 | if (strtobool(buf, &enable)) | 106 | if (strtobool(buf, &enable)) |
| 107 | return -EINVAL; | 107 | return -EINVAL; |
| 108 | 108 | ||
| 109 | if (enable == test_bit(HCI_DUT_MODE, &hdev->dbg_flags)) | 109 | if (enable == hci_dev_test_flag(hdev, HCI_DUT_MODE)) |
| 110 | return -EALREADY; | 110 | return -EALREADY; |
| 111 | 111 | ||
| 112 | hci_req_lock(hdev); | 112 | hci_req_lock(hdev); |
| @@ -127,7 +127,7 @@ static ssize_t dut_mode_write(struct file *file, const char __user *user_buf, | |||
| 127 | if (err < 0) | 127 | if (err < 0) |
| 128 | return err; | 128 | return err; |
| 129 | 129 | ||
| 130 | change_bit(HCI_DUT_MODE, &hdev->dbg_flags); | 130 | hci_dev_change_flag(hdev, HCI_DUT_MODE); |
| 131 | 131 | ||
| 132 | return count; | 132 | return count; |
| 133 | } | 133 | } |
| @@ -3019,7 +3019,7 @@ static void le_scan_restart_work(struct work_struct *work) | |||
| 3019 | void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr, | 3019 | void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr, |
| 3020 | u8 *bdaddr_type) | 3020 | u8 *bdaddr_type) |
| 3021 | { | 3021 | { |
| 3022 | if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) || | 3022 | if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) || |
| 3023 | !bacmp(&hdev->bdaddr, BDADDR_ANY) || | 3023 | !bacmp(&hdev->bdaddr, BDADDR_ANY) || |
| 3024 | (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && | 3024 | (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && |
| 3025 | bacmp(&hdev->static_addr, BDADDR_ANY))) { | 3025 | bacmp(&hdev->static_addr, BDADDR_ANY))) { |
diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c index 3c025ee5572c..bc801e9db834 100644 --- a/net/bluetooth/hci_debugfs.c +++ b/net/bluetooth/hci_debugfs.c | |||
| @@ -679,7 +679,7 @@ static ssize_t force_static_address_read(struct file *file, | |||
| 679 | struct hci_dev *hdev = file->private_data; | 679 | struct hci_dev *hdev = file->private_data; |
| 680 | char buf[3]; | 680 | char buf[3]; |
| 681 | 681 | ||
| 682 | buf[0] = test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) ? 'Y': 'N'; | 682 | buf[0] = hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ? 'Y': 'N'; |
| 683 | buf[1] = '\n'; | 683 | buf[1] = '\n'; |
| 684 | buf[2] = '\0'; | 684 | buf[2] = '\0'; |
| 685 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); | 685 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); |
| @@ -704,10 +704,10 @@ static ssize_t force_static_address_write(struct file *file, | |||
| 704 | if (strtobool(buf, &enable)) | 704 | if (strtobool(buf, &enable)) |
| 705 | return -EINVAL; | 705 | return -EINVAL; |
| 706 | 706 | ||
| 707 | if (enable == test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags)) | 707 | if (enable == hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR)) |
| 708 | return -EALREADY; | 708 | return -EALREADY; |
| 709 | 709 | ||
| 710 | change_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags); | 710 | hci_dev_change_flag(hdev, HCI_FORCE_STATIC_ADDR); |
| 711 | 711 | ||
| 712 | return count; | 712 | return count; |
| 713 | } | 713 | } |
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index e85f9ec9f73a..55e096d20a0f 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c | |||
| @@ -383,7 +383,7 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy, | |||
| 383 | * and a static address has been configured, then use that | 383 | * and a static address has been configured, then use that |
| 384 | * address instead of the public BR/EDR address. | 384 | * address instead of the public BR/EDR address. |
| 385 | */ | 385 | */ |
| 386 | if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) || | 386 | if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) || |
| 387 | !bacmp(&hdev->bdaddr, BDADDR_ANY) || | 387 | !bacmp(&hdev->bdaddr, BDADDR_ANY) || |
| 388 | (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && | 388 | (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && |
| 389 | bacmp(&hdev->static_addr, BDADDR_ANY))) { | 389 | bacmp(&hdev->static_addr, BDADDR_ANY))) { |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index af30d8240c80..d69861c89bb5 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
| @@ -6992,7 +6992,7 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) | |||
| 6992 | 6992 | ||
| 6993 | if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) && | 6993 | if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) && |
| 6994 | (bredr_sc_enabled(hcon->hdev) || | 6994 | (bredr_sc_enabled(hcon->hdev) || |
| 6995 | test_bit(HCI_FORCE_BREDR_SMP, &hcon->hdev->dbg_flags))) | 6995 | hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP))) |
| 6996 | conn->local_fixed_chan |= L2CAP_FC_SMP_BREDR; | 6996 | conn->local_fixed_chan |= L2CAP_FC_SMP_BREDR; |
| 6997 | 6997 | ||
| 6998 | mutex_init(&conn->ident_lock); | 6998 | mutex_init(&conn->ident_lock); |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index d97719d04be0..c58908652519 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
| @@ -659,7 +659,7 @@ static u32 get_current_settings(struct hci_dev *hdev) | |||
| 659 | * with BR/EDR disabled, the existence of the static address will | 659 | * with BR/EDR disabled, the existence of the static address will |
| 660 | * be evaluated. | 660 | * be evaluated. |
| 661 | */ | 661 | */ |
| 662 | if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) || | 662 | if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) || |
| 663 | !hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) || | 663 | !hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) || |
| 664 | !bacmp(&hdev->bdaddr, BDADDR_ANY)) { | 664 | !bacmp(&hdev->bdaddr, BDADDR_ANY)) { |
| 665 | if (bacmp(&hdev->static_addr, BDADDR_ANY)) | 665 | if (bacmp(&hdev->static_addr, BDADDR_ANY)) |
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 81975f274c2b..9155840068cf 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
| @@ -1679,7 +1679,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
| 1679 | if (conn->hcon->type == ACL_LINK) { | 1679 | if (conn->hcon->type == ACL_LINK) { |
| 1680 | /* We must have a BR/EDR SC link */ | 1680 | /* We must have a BR/EDR SC link */ |
| 1681 | if (!test_bit(HCI_CONN_AES_CCM, &conn->hcon->flags) && | 1681 | if (!test_bit(HCI_CONN_AES_CCM, &conn->hcon->flags) && |
| 1682 | !test_bit(HCI_FORCE_BREDR_SMP, &hdev->dbg_flags)) | 1682 | !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) |
| 1683 | return SMP_CROSS_TRANSP_NOT_ALLOWED; | 1683 | return SMP_CROSS_TRANSP_NOT_ALLOWED; |
| 1684 | 1684 | ||
