-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
[bsp/allwinner] feat: porting to RT_USING_DEVICE_OPS #9142
Conversation
@ylyamin you could check the PR message or the commit log for details 😉 |
This patch ports the codebase to use the RT_USING_DEVICE_OPS structure, which is required by v5.1.0 Smart kernel, improves modularity and makes it easier to manage device operations by consolidating them into a single structure, enhancing maintainability and future scalability. Changes: - Added RT_USING_DEVICE_OPS conditionals to partition.c and drv_sdmmc.c. - Defined rt_device_ops structures for partition and sdmmc drivers. - Updated device initialization to use the ops structure if defined. - Replaced direct function calls with rt_dev_control, rt_dev_read, and rt_dev_write macros where applicable. - Removed redundant us_delay function from os.c. Signed-off-by: Shell <smokewood@qq.com>
@@ -27,4 +27,18 @@ struct dev_sdmmc | |||
void sd_mmc1_init(void); | |||
void sd_mmc1_deinit(void); | |||
|
|||
#ifdef RT_USING_DEVICE_OPS | |||
#define rt_dev_has_control(dev) (dev)->ops->control |
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.
这些使用rt_device_* API是否更合适些?
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.
rt_device API 有特殊的操作协议 (open, init),但是 allwinner HAL 实现 API 没有遵循这种协议。这就导致对接后驱动工作异常(驱动内部直接 read 没有 open,无法通过引用计数检查。也可以理解为驱动内部是通过 dev-ops 调内部 API 的,因此不遵循外部操作协议)。
因此建议是建个 issue,后续工作中继续推进驱动的 API 对接问题。本 PR 还是保留宏的形式。
tested with commit c7e1982 on 柿饼 M7 |
* [bsp/allwinner] feat: porting to RT_USING_DEVICE_OPS This patch ports the codebase to use the RT_USING_DEVICE_OPS structure, which is required by v5.1.0 Smart kernel, improves modularity and makes it easier to manage device operations by consolidating them into a single structure, enhancing maintainability and future scalability. Changes: - Added RT_USING_DEVICE_OPS conditionals to partition.c and drv_sdmmc.c. - Defined rt_device_ops structures for partition and sdmmc drivers. - Updated device initialization to use the ops structure if defined. - Replaced direct function calls with rt_dev_control, rt_dev_read, and rt_dev_write macros where applicable. - Removed redundant us_delay function from os.c. Signed-off-by: Shell <smokewood@qq.com> * feat: update configuration * feat: fixup compiler warning --------- Signed-off-by: Shell <smokewood@qq.com>
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
This patch ports the codebase to use the RT_USING_DEVICE_OPS structure, which is required by v5.1.0 Smart kernel, improves modularity and makes it easier to manage device operations by consolidating them into a single structure, enhancing maintainability and future scalability.
你的解决方案是什么 (what is your solution)
Changes:
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up