【发布时间】:2021-05-31 10:43:00
【问题描述】:
我正在尝试找到一种方法来从 node_1 访问此设备树中 node_0 中的变量(参见下面的代码):
/ {
amba_pl: amba_pl@0 {
node_0: node@a8000000 {
node_id = <0x0>;
node0State = <0x0>;
};
};
node_1: node@a9000000 {
node1State = <node_0's node0State>;
};
};
};
主要目标是能够在内核模块之间共享状态。我知道我可以在写入节点中 EXPORT_SYMBOL(variable) ,然后在读取节点中使用 extern *variable ,但想看看我是否可以在设备树本身中完成此操作。 node_0 将始终是唯一设置 nodeState 的节点,而 node_1 只会读取。这可能吗?
【问题讨论】:
-
突然间我知道在 ACPI 中很容易,但在 DT 中可能你可以使用 C 预处理。我不确定在运行时是否可行(ACPI 再次可以做到这一切)。
标签: linux-kernel linux-device-driver kernel-module device-tree petalinux