Skip to content

Conversation

@roma-jam
Copy link
Collaborator

@roma-jam roma-jam commented Oct 10, 2025

Description

Removed parent device handle from the device tree node. Device tree node has the void* pointer to the parent (which is NULL when the port is part of the Root Hub, and external hub handle when the port is a part of external hub).
As the device tree node doesn't contain parent information and contain the external hub handle, we don't need to convert usb_device_handle_t to ext_hub_handle_t.
Added the possibility to get the external hub device speed to compare it with the speed of the port.

Related

Testing

USB Host target tests.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@roma-jam roma-jam force-pushed the refactor/usb_host_parent_child_deps_part2 branch from 29e1f99 to 47292e8 Compare October 10, 2025 13:50
@roma-jam roma-jam changed the title refactor(usb_host): Removed parent device handle from device tree node in Hub Driver refactor(usb_host): Removed parent_dev_hdl from device tree node in Hub Driver Oct 10, 2025
@roma-jam roma-jam changed the title refactor(usb_host): Removed parent_dev_hdl from device tree node in Hub Driver refactor(usb_host): Removed parent_dev_hdl from device tree node in Hub Driver (part1/4) Oct 10, 2025
@roma-jam roma-jam changed the title refactor(usb_host): Removed parent_dev_hdl from device tree node in Hub Driver (part1/4) refactor(usb_host): Removed parent_dev_hdl from device tree node in Hub Driver (part2/4) Oct 10, 2025
@roma-jam roma-jam self-assigned this Oct 10, 2025
@roma-jam roma-jam marked this pull request as ready for review October 10, 2025 14:28
@roma-jam roma-jam added the Component: usb_host Issue affects usb_host component label Oct 10, 2025
Copy link
Collaborator

@igi540 igi540 left a comment

Choose a reason for hiding this comment

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

LGTM. Only one point - in ext_hub_get_speed(), there's a potential race condition around the dev_is_in_list() check and the subsequent dereference of ext_hub_hdl.

Currently, the function exits the critical section after checking p_ext_hub_driver, but before verifying if the hub is still valid and before accessing its dev_hdl. If the hub were removed concurrently (e.g., from another task), this could lead to a use-after-free or undefined behavior.

@roma-jam roma-jam force-pushed the refactor/usb_host_parent_child_deps_part1 branch from 138be1b to 37de6d7 Compare October 14, 2025 09:00
@roma-jam roma-jam changed the base branch from refactor/usb_host_parent_child_deps_part1 to refactor/usb_host_parent_child_deps October 14, 2025 09:20
@roma-jam roma-jam force-pushed the refactor/usb_host_parent_child_deps_part2 branch from 47292e8 to 55150bf Compare October 14, 2025 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: usb_host Issue affects usb_host component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants