Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7cb93e5 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg
Browse files

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: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent eacb44df
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -179,15 +179,6 @@ enum {
	HCI_RESET,
};

/* BR/EDR and/or LE controller flags: the flags defined here should represent
 * states configured via debugfs for debugging and testing purposes only.
 */
enum {
	HCI_DUT_MODE,
	HCI_FORCE_BREDR_SMP,
	HCI_FORCE_STATIC_ADDR,
};

/*
 * BR/EDR and/or LE controller flags: the flags defined here should represent
 * states from the controller.
@@ -226,6 +217,11 @@ enum {
	HCI_FAST_CONNECTABLE,
	HCI_BREDR_ENABLED,
	HCI_LE_SCAN_INTERRUPTED,

	HCI_DUT_MODE,
	HCI_FORCE_BREDR_SMP,
	HCI_FORCE_STATIC_ADDR,

	__HCI_NUM_FLAGS,
};

+0 −1
Original line number Diff line number Diff line
@@ -353,7 +353,6 @@ struct hci_dev {

	struct rfkill		*rfkill;

	unsigned long		dbg_flags;
	DECLARE_BITMAP(dev_flags, __HCI_NUM_FLAGS);

	struct delayed_work	le_scan_disable;
+4 −4
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ static ssize_t dut_mode_read(struct file *file, char __user *user_buf,
	struct hci_dev *hdev = file->private_data;
	char buf[3];

	buf[0] = test_bit(HCI_DUT_MODE, &hdev->dbg_flags) ? 'Y': 'N';
	buf[0] = hci_dev_test_flag(hdev, HCI_DUT_MODE) ? 'Y': 'N';
	buf[1] = '\n';
	buf[2] = '\0';
	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,
	if (strtobool(buf, &enable))
		return -EINVAL;

	if (enable == test_bit(HCI_DUT_MODE, &hdev->dbg_flags))
	if (enable == hci_dev_test_flag(hdev, HCI_DUT_MODE))
		return -EALREADY;

	hci_req_lock(hdev);
@@ -127,7 +127,7 @@ static ssize_t dut_mode_write(struct file *file, const char __user *user_buf,
	if (err < 0)
		return err;

	change_bit(HCI_DUT_MODE, &hdev->dbg_flags);
	hci_dev_change_flag(hdev, HCI_DUT_MODE);

	return count;
}
@@ -3019,7 +3019,7 @@ static void le_scan_restart_work(struct work_struct *work)
void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
			       u8 *bdaddr_type)
{
	if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) ||
	if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ||
	    !bacmp(&hdev->bdaddr, BDADDR_ANY) ||
	    (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) &&
	     bacmp(&hdev->static_addr, BDADDR_ANY))) {
+3 −3
Original line number Diff line number Diff line
@@ -679,7 +679,7 @@ static ssize_t force_static_address_read(struct file *file,
	struct hci_dev *hdev = file->private_data;
	char buf[3];

	buf[0] = test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) ? 'Y': 'N';
	buf[0] = hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ? 'Y': 'N';
	buf[1] = '\n';
	buf[2] = '\0';
	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,
	if (strtobool(buf, &enable))
		return -EINVAL;

	if (enable == test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags))
	if (enable == hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR))
		return -EALREADY;

	change_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags);
	hci_dev_change_flag(hdev, HCI_FORCE_STATIC_ADDR);

	return count;
}
+1 −1
Original line number Diff line number Diff line
@@ -383,7 +383,7 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
	 * and a static address has been configured, then use that
	 * address instead of the public BR/EDR address.
	 */
	if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) ||
	if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ||
	    !bacmp(&hdev->bdaddr, BDADDR_ANY) ||
	    (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) &&
	     bacmp(&hdev->static_addr, BDADDR_ANY))) {
Loading