Skip to content

Conversation

ydamigos
Copy link
Contributor

Deprecate bt_hci_bus enumeration as discussed in #94810 (comment).

@@ -87,7 +87,7 @@ enum bt_hci_bus {
#define BT_DT_HCI_NAME_GET(node_id) DT_PROP_OR(node_id, bt_hci_name, "HCI")
#define BT_DT_HCI_NAME_INST_GET(inst) BT_DT_HCI_NAME_GET(DT_DRV_INST(inst))

#define BT_DT_HCI_BUS_GET(node_id) DT_ENUM_IDX_OR(node_id, bt_hci_bus, BT_HCI_BUS_VIRTUAL)
#define BT_DT_HCI_BUS_GET(node_id) DT_ENUM_IDX_OR(node_id, bt_hci_bus, 0)
Copy link
Contributor

@alwa-nordic alwa-nordic Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of 0 here, I expect that DT has generated defines for the enum? Something like DT_PROP__BT_HCI_BUS__ENUM__VIRTUAL. But I can't find anything like this. @jhedberg Do you know?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the easiest thing be to just add default: "virtual" to the binding?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did try this initially, but it raise a device tree error. Every yaml file, that includes bt-hci.yaml, has already a default.

devicetree error: renesas,bt-hci-da1469x.yaml (in 'bt-hci-bus'): 'default' from included file overwritten ('virtual' replaced with 'ipc')

I could remove every default from the bindings and make sure that it is included in the dts files but it will introduce a lot of changes which are not related to PR's goal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I didn't realize that since I just tried to build combo where both were "virtual". How about required: true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that will work. Let me update the PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to go to migration guide though, in case someone has an out of tree binding that didn't specify a bus.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spoke too soon. It seems that required: doesn't take into account default: from the bindings.
Also this one will introduce a lot of changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh.. ok. Then I'd just leave a single define for the virtual value in the header rather than a hard-coded 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define added.

@Thalley Thalley removed their request for review August 27, 2025 14:47
@ydamigos ydamigos force-pushed the bluetooth-deprecate-bt-hci-bus-enum branch from 6877804 to 9b604a7 Compare August 28, 2025 09:53
@@ -87,6 +87,7 @@ enum bt_hci_bus {
#define BT_DT_HCI_NAME_GET(node_id) DT_PROP_OR(node_id, bt_hci_name, "HCI")
#define BT_DT_HCI_NAME_INST_GET(inst) BT_DT_HCI_NAME_GET(DT_DRV_INST(inst))

#define BT_HCI_BUS_VIRTUAL (0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, isn't there a risk of some static analyzer warning about this since the enum has the same name? Another option would have been:

/* Fallback default when there's no property, same as "virtual" */
#define BT_HCI_BUS_DEFAULT 0

Copy link
Member

@jhedberg jhedberg Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also use the _PRIV_ infix, which will eventually become a guideline for private APIs (see #89765), so #define BT_PRIV_HCI_BUS_DEFAULT (not sure if that's overkill, but the idea is that this define is really only supposed to be for the DT macro in this header file and for nothing else.

Copy link
Contributor Author

@ydamigos ydamigos Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I forgot that I only deprecated it and I did not remove it.

@ydamigos ydamigos force-pushed the bluetooth-deprecate-bt-hci-bus-enum branch from 9b604a7 to 29caf1e Compare August 28, 2025 10:38
bt_hci_bus enumeration is not used anymore.
This commit deprecates it.

Signed-off-by: Ioannis Damigos <[email protected]>
Document deprecation of bt_hci_bus enumeration in v4.3
release notes.

Signed-off-by: Ioannis Damigos <[email protected]>
@ydamigos ydamigos force-pushed the bluetooth-deprecate-bt-hci-bus-enum branch from 29caf1e to 649ff9a Compare August 28, 2025 10:45
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth HCI Bluetooth HCI Driver area: Bluetooth Release Notes To be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants