-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
[DNM] [WiP] device: Introduce reference to parent device name. #13129
[DNM] [WiP] device: Introduce reference to parent device name. #13129
Conversation
Found the following issues, please fix and resubmit: Checkpatch issues
|
38d92f3
to
1ff014a
Compare
07d925c
to
2a351fc
Compare
This commit introduces a pointer to parent device name in the device_config structure. Such reference provides generic method to extract device hierarchy. Also, the DEVICE_* macros used to create device instances are updated in order to add new "parent_name" parameter. The changes are needed by planned Device-level Power Management infrastrcture. Signed-off-by: Piotr Zięcik <[email protected]>
This commit adds "SOC" label to /soc node. Such step allows to group all peripherals under single parent. Signed-off-by: Piotr Zięcik <[email protected]>
This commit adds the DEVICE_HIERARCHY option, which could be turned off when device hierarchy abstraction is not needed. Signed-off-by: Piotr Zięcik <[email protected]>
This commit reworks `device` commands. It extends the `device info` command in order to present some properties of the devices as well as implements `device tree` command, showing device hierarchy. Signed-off-by: Piotr Zięcik <[email protected]>
This commit adds matching _PARENT_NAME/PARENT_LABEL entry for each _NAME/_LABEL entry. Signed-off-by: Piotr Zięcik <[email protected]>
This commit adds reference to parent entity in DTS-based drivers. Such information allows for device hierarchy generation. Signed-off-by: Piotr Zięcik <[email protected]>
This commit adds information about dangling devices to the `device tree` command. Signed-off-by: Piotr Zięcik <[email protected]>
This commit adds the device_get_parent() API. It could be used to obtain parent device structure using any given device. Signed-off-by: Piotr Zięcik <[email protected]>
For nodes that have a parent with a 'label' propery set and also have a 'label' property set themselves. Signed-off-by: Andrzej Głąbek <[email protected]>
c8909c6
to
f4cb434
Compare
@pizi-nordic, I see interest in this but can you can you provide the big picture on why you're intrudocing this? and what it intents to solve? |
@@ -53,7 +53,7 @@ static const struct pwr_ctrl_cfg vdd_pwr_ctrl_cfg = { | |||
.pin = VDD_PWR_CTRL_GPIO_PIN, | |||
}; | |||
|
|||
DEVICE_INIT(vdd_pwr_ctrl_init, "", pwr_ctrl_init, NULL, &vdd_pwr_ctrl_cfg, | |||
DEVICE_INIT(NULL, vdd_pwr_ctrl_init, "", pwr_ctrl_init, NULL, &vdd_pwr_ctrl_cfg, |
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 have a basic question: Why not define a new macro and leave the old macro redefined to call the new macro with this extra NULL? That way you don't break the current usage of the macro.
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.
In order to have working really device power management, we have to have full information about device dependencies. By changing existing macro I tried to "suggest" changes in existing drivers as well as "enforce" providing parent information in newly created ones.
Major driver of this changes is #14309. |
This PR introduces a pointer to parent device name in
the device_config structure. Such reference provides generic
method to extract device hierarchy.
Also, the DEVICE_* macros used to create device instances
are updated in order to add new "parent_name" parameter.
Please note, that this PR only modifies data structures.
API for traversing the hierarchy as well as DT integration will follow.