Skip to content

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

Open
iav wants to merge 2 commits into
armbian:mainfrom
iav:rockchip64-panel-simple-dsi-clang-const
Open

rockchip64: fix clang -Wincompatible-pointer-types-discards-qualifiers in carried patches#10140
iav wants to merge 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, enabling device-tree driven initialization/exit command sequences.
    • Added device-tree configurable panel power, reset, and enable handling, plus automatic display mode and orientation setup.
  • Bug Fixes

    • Improved DisplayPort HPD hotplug state propagation to external hotplug notifications for more reliable display event updates.
    • Enhanced display mode probing so preferred mode selection and physical dimensions are set more consistently.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1c7d1482-5f14-49dd-ba79-1fe4518bb20b

📥 Commits

Reviewing files that changed from the base of the PR and between 56210c1 and ed783ab.

📒 Files selected for processing (5)
  • 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-6.18/rk3399-usbc-notify-typec-dp-hpd-state-through-extcon.patch
  • patch/kernel/archive/rockchip64-6.6/general-add-panel-simple-dsi.patch
  • patch/kernel/archive/rockchip64-7.1/general-add-panel-simple-dsi.patch
🚧 Files skipped from review as they are similar to previous changes (3)
  • patch/kernel/archive/rockchip64-6.18/general-add-panel-simple-dsi.patch
  • patch/kernel/archive/rockchip64-6.6/general-add-panel-simple-dsi.patch
  • patch/kernel/archive/rockchip64-6.18/rk3399-usbc-notify-typec-dp-hpd-state-through-extcon.patch

📝 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, HeyMeco, JohnTheCoolingFan, SuperKali, TheSnowfield, Tonymac32, ahoneybun, amazingfate, brentr, catalinii, chainsx, efectn, joekhoobyar, krachlatte, lanefu, paolosabatino, prahal, pyavitz, rpardini, schwar3kat, igorpecovnik

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the warning fix applied across carried rockchip64 patches.
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.
✨ 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 and others added 2 commits July 8, 2026 17:28
…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 56210c1 to ed783ab Compare July 8, 2026 14:28
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, ... Needs review Seeking for review Patches Patches related to kernel, U-Boot, ... size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

1 participant