-
Notifications
You must be signed in to change notification settings - Fork 7.9k
include: bluetooth: Deprecate bt_hci_bus enumeration #95062
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
include: bluetooth: Deprecate bt_hci_bus enumeration #95062
Conversation
include/zephyr/drivers/bluetooth.h
Outdated
@@ -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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define added.
6877804
to
9b604a7
Compare
include/zephyr/drivers/bluetooth.h
Outdated
@@ -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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
9b604a7
to
29caf1e
Compare
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]>
29caf1e
to
649ff9a
Compare
|
Deprecate
bt_hci_bus
enumeration as discussed in #94810 (comment).