Skip to content

rockchip64: fix clang -Wincompatible-pointer-types-discards-qualifiers in carried patches#10140

Merged
iav merged 2 commits into
armbian:mainfrom
iav:rockchip64-panel-simple-dsi-clang-const
Jul 10, 2026
Merged

rockchip64: fix clang -Wincompatible-pointer-types-discards-qualifiers in carried patches#10140
iav merged 2 commits into
armbian:mainfrom
iav:rockchip64-panel-simple-dsi-clang-const

Conversation

@iav

@iav iav commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Description

Two carried rockchip64 kernel patches assign a const pointer to a non-const one, which clang rejects under -Werror,-Wincompatible-pointer-types-discards-qualifiers:

  • general-add-panel-simple-dsi.patch: of_get_drm_display_mode(..., &p->desc->bus_format, ...)desc is const.
  • rk3399-usbc-notify-typec-dp-hpd-state-through-extcon.patch: const struct device *dev = &dp->alt->dev; is passed to extcon_get_edev_by_phandle(), which takes a non-const struct device *.

Fix:

  • panel-simple-dsi: cast (u32 *)&p->desc->bus_format — the pointed-to memory is writable (a devm_kmemdup copy), only the pointer type is const. Replicated to rockchip64-{6.6,6.12,6.18,7.1} (7.2 has the patch .disabled).
  • displayport extcon: drop the needless const on the local dev (6.18 only; 6.6/6.12 don't carry this patch, 7.1/7.2 already use the non-const form).

Behaviour-preserving; GCC was already silent on both.

How Has This Been Tested?

rockchip64 clang build (armsom-sige5) — both files compile clean under clang.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings

Summary by CodeRabbit

  • New Features
    • Added support for simple MIPI-DSI DRM display panels, with device-tree driven initialization/exit command sequences.
    • Added device-tree configurable panel power, reset, and enable GPIO handling, plus automatic mode/physical size, preferred mode selection, orientation, and timing reporting.
  • Bug Fixes
    • Improved DisplayPort HPD hotplug state propagation to external hotplug signaling for more reliable display event updates.
    • Enhanced display mode probing behavior to set preferred mode and physical dimensions more consistently.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updates repeated kernel patch files to cast bus_format in of_get_drm_display_mode(), and adds extcon-based DisplayPort HPD propagation in the rockchip64-6.18 altmode patch.

Changes

bus_format cast fix

Layer / File(s) Summary
bus_format pointer cast across kernel versions
patch/kernel/archive/rockchip64-6.6/general-add-panel-simple-dsi.patch, patch/kernel/archive/rockchip64-6.12/general-add-panel-simple-dsi.patch, patch/kernel/archive/rockchip64-6.18/general-add-panel-simple-dsi.patch, patch/kernel/archive/rockchip64-7.1/general-add-panel-simple-dsi.patch
Each patch updates the of_get_drm_display_mode() call in panel_simple_get_modes() to pass bus_format with an explicit (u32 *) cast.

DisplayPort HPD extcon notification

Layer / File(s) Summary
Extcon discovery and HPD update helper
patch/kernel/archive/rockchip64-6.18/rk3399-usbc-notify-typec-dp-hpd-state-through-extcon.patch
Adds extcon/of headers and dp_altmode_update_extcon_hpd_status(), which skips redundant updates, locates an extcon device via the device/OF node chain, checks EXTCON_DISP_HPD support, and sets/syncs EXTCON_PROP_DISP_HPD.
Wiring HPD helper into status update and disconnect paths
patch/kernel/archive/rockchip64-6.18/rk3399-usbc-notify-typec-dp-hpd-state-through-extcon.patch
Calls the new helper from dp_altmode_status_update() when HPD changes, after the connector OOB hotplug event, and from dp_altmode_vdm() before clearing dp->hpd.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant dp_altmode_status_update as dp_altmode_status_update
  participant dp_altmode_update_extcon_hpd_status as dp_altmode_update_extcon_hpd_status
  participant OF device chain as OF device chain
  participant extcon device as extcon device

  dp_altmode_status_update->>dp_altmode_update_extcon_hpd_status: update HPD state
  dp_altmode_update_extcon_hpd_status->>dp_altmode_update_extcon_hpd_status: check cached dp->hpd
  dp_altmode_update_extcon_hpd_status->>OF device chain: walk parent OF nodes
  OF device chain-->>dp_altmode_update_extcon_hpd_status: extcon node / phandle
  dp_altmode_update_extcon_hpd_status->>extcon device: check EXTCON_DISP_HPD capability
  dp_altmode_update_extcon_hpd_status->>extcon device: set EXTCON_PROP_DISP_HPD and sync
Loading

Suggested reviewers: ColorfulRhino, JohnTheCoolingFan, TheSnowfield, Tonymac32, SuperKali, chainsx, pyavitz, igorpecovnik

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: fixing a clang qualifier-discard warning in carried rockchip64 patches.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added 08 Milestone: Third quarter release size/small PR with less then 50 lines Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Jul 7, 2026
@iav iav force-pushed the rockchip64-panel-simple-dsi-clang-const branch from 56210c1 to ed783ab Compare July 8, 2026 14:28
iav and others added 2 commits July 9, 2026 19:35
…discards-qualifiers

of_get_drm_display_mode() takes u32 *bus_format, but the patch passed
&p->desc->bus_format where desc is const struct panel_desc *. GCC
tolerates this; clang rejects it under -Werror since the removal of
the blanket -Wno-error=unknown-warning-option from KCFLAGS.

The pointed-to memory is actually writable (desc is allocated via
devm_kmemdup in this driver), so cast the constness away at the call
site. Applied to rockchip64-6.6/6.12/6.18/7.1; the 7.2 copy of the
patch is .disabled and left untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…pes-discards-qualifiers

extcon_get_edev_by_phandle() takes struct device * (non-const), but
the patch declared the local as const struct device *. Drop the const:
&dp->alt->dev is a non-const pointer anyway, and the 7.1/7.2 copies of
this patch already use the non-const form.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@iav iav force-pushed the rockchip64-panel-simple-dsi-clang-const branch from ed783ab to ee3f016 Compare July 9, 2026 16:35
@github-actions github-actions Bot added the Ready to merge Reviewed, tested and ready for merge label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot removed the Needs review Seeking for review label Jul 9, 2026
@iav iav merged commit cbab7d6 into armbian:main Jul 10, 2026
12 checks passed
@iav iav deleted the rockchip64-panel-simple-dsi-clang-const branch July 10, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 Milestone: Third quarter release Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

2 participants