Commit 9268834b authored by Tedd Ho-Jeong An's avatar Tedd Ho-Jeong An Committed by Marcel Holtmann

Bluetooth: Use switch statement for Intel hardware variants

Multiple new hardware variants are planned and the simple if statement
would get really complicated and unreadable. So instead replace it with
a simple switch statement.

The change is applied to both USB and UART.
Based-on-patch-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarTedd Ho-Jeong An <tedd.an@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent d8edd9ed
...@@ -2024,13 +2024,17 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2024,13 +2024,17 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
return -EINVAL; return -EINVAL;
} }
/* At the moment the iBT 3.0 hardware variants 0x0b (LnP/SfP) /* Check for supported iBT hardware variants of this firmware
* and 0x0c (WsP) are supported by this firmware loading method. * loading method.
* *
* This check has been put in place to ensure correct forward * This check has been put in place to ensure correct forward
* compatibility options when newer hardware variants come along. * compatibility options when newer hardware variants come along.
*/ */
if (ver.hw_variant != 0x0b && ver.hw_variant != 0x0c) { switch (ver.hw_variant) {
case 0x0b: /* SfP */
case 0x0c: /* WsP */
break;
default:
BT_ERR("%s: Unsupported Intel hardware variant (%u)", BT_ERR("%s: Unsupported Intel hardware variant (%u)",
hdev->name, ver.hw_variant); hdev->name, ver.hw_variant);
return -EINVAL; return -EINVAL;
......
...@@ -601,12 +601,17 @@ static int intel_setup(struct hci_uart *hu) ...@@ -601,12 +601,17 @@ static int intel_setup(struct hci_uart *hu)
return -EINVAL; return -EINVAL;
} }
/* At the moment only the hardware variant iBT 3.0 (LnP/SfP) is /* Check for supported iBT hardware variants of this firmware
* supported by this firmware loading method. This check has been * loading method.
* put in place to ensure correct forward compatibility options *
* when newer hardware variants come along. * This check has been put in place to ensure correct forward
*/ * compatibility options when newer hardware variants come along.
if (ver.hw_variant != 0x0b) { */
switch (ver.hw_variant) {
case 0x0b: /* LnP */
case 0x0c: /* WsP */
break;
default:
bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)", bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)",
ver.hw_variant); ver.hw_variant);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment