Skip to content
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

usb: xhci: Avoid use xhci_plat_phytium_pe220x when OF disabled #151

Merged

Conversation

Avenger-285714
Copy link
Collaborator

xhci_plat_phytium_pe220x is only defined when OF is enabled. This would cause a compile error:

drivers/usb/host/xhci-plat.c:532:33: error: ‘xhci_plat_phytium_pe220x’ undeclared here (not in a function); did you mean ‘xhci_plat_runtime_resume’?
{ "PHYT0039", (kernel_ulong_t)&xhci_plat_phytium_pe220x },
^~~~~~~~~~~~~~~~~~~~~~~~
xhci_plat_runtime_resume
CC [M] drivers/usb/dwc3/core.o

It should be moved.

xhci_plat_phytium_pe220x is only defined when OF is enabled.
This would cause a compile error:

drivers/usb/host/xhci-plat.c:532:33: error: ‘xhci_plat_phytium_pe220x’ undeclared here (not in a function); did you mean ‘xhci_plat_runtime_resume’?
  { "PHYT0039", (kernel_ulong_t)&xhci_plat_phytium_pe220x },
                                 ^~~~~~~~~~~~~~~~~~~~~~~~
                                 xhci_plat_runtime_resume
  CC [M]  drivers/usb/dwc3/core.o

It should be moved.

Reported-by: jianghaoa <[email protected]>
Signed-off-by: guanwentao <[email protected]>
Signed-off-by: WangYuli <[email protected]>
@opsiff
Copy link
Member

opsiff commented May 16, 2024

/ok-to-test

@Avenger-285714
Copy link
Collaborator Author

deepin pr auto review

关键摘要:

  • 代码重构导致xhci_plat_phytium_pe220x结构体被移动到了#ifdef CONFIG_OF的上下文之外,这可能会导致在非CONFIG_OF环境中该结构体不再被定义。

合并相似的问题是否建议立即修改:

Syntax and logical errors:

  • 无明显的语法或逻辑错误。

Code refactoring and quality:

  • 考虑将xhci_plat_phytium_pe220x结构体的定义移回#ifdef CONFIG_OF块内,以确保在非CONFIG_OF环境中它被正确忽略。

Performance optimization:

  • 当前提交的更改不会对性能产生直接影响。

Security vulnerabilities:

  • 当前提交的更改不会直接影响安全性。

Best practices:

  • 确保所有更改都有相应的注释说明,解释为什么需要进行这样的重构。
  • 检查是否有其他代码依赖于xhci_plat_phytium_pe220x结构体的位置,以确保移动后的位置不会破坏现有功能。

幽默,这个大模型好像不太聪明

@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • 代码重构导致的重复代码:在xhci_plat_phytium_pe220xxhci_plat_marvell_armada结构体中,.quirks成员都设置为XHCI_RESET_ON_RESUME,这是重复代码的一个例子。

是否建议立即修改:

建议的修改:

  • 提取公共代码到一个单独的函数或宏中,以减少重复并提高代码的可维护性。例如,可以创建一个函数init_xhci_plat_priv,接受struct xhci_plat_priv作为参数,并根据需要设置quirks成员。然后在所有需要设置quirks的地方调用这个函数。
  • 如果xhci_plat_phytium_pe220xxhci_plat_marvell_armada是不同的硬件实例,那么应该提供一个初始化它们的函数,并在需要时调用该函数。这样可以避免重复设置相同的quirks值。

@Avenger-285714
Copy link
Collaborator Author

/approve

@Avenger-285714 Avenger-285714 merged commit 6859ff1 into deepin-community:linux-6.6.y May 16, 2024
2 of 3 checks passed
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Avenger-285714
Once this PR has been reviewed and has the lgtm label, please assign zeno-sole for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Avenger-285714
Once this PR has been reviewed and has the lgtm label, please assign zeno-sole for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants