[PATCH v8 0/8] drm: writeback: clean up writeback connector initialization

John Harrison <[email protected]> Wed, 22 Jul 2026 17:31:55 -0700
Newsgroups org.kernel.vger.linux-renesas-soc,org.freedesktop.lists.amd-gfx,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Drivers using drm_writeback_connector_init() / _with_encoder() don't
perform cleanup in a manner similar to drmm_writeback_connector_init()
(see drm_writeback_connector_cleanup()). Migrate all existing drivers
to use drmm_writeback_connector_init(), drop
drm_writeback_connector_init() and drm_writeback_connector::encoder
(it's unused afterwards).

NB: Patch set written by Dmitry B but taken over by John H at v7 due to
time pressures.

---
Changes in v8 (by John Harrison):
- Fix up the AMD KUnit test
- Drop the error path drmm_kfree calls that are post DRM hand off
  They are unnecessary as the memory will get freed when the drm
  device is disconnected. More importantly, the DRM layer now has
  a pointer to the memory and may call a cleanup function that
  references it during disconnection.
- Drop drm_writeback_connector_init_with_encoder() completely. It is
  not used by any current driver and the very strong recommendation
  for any new addition is to use the new drmm equivalent.
- Update some documentation comments with the new drmm naming.

Changes in v7 (by John Harrison):
- Fix missing parameter in drmm_kfree
- Fix leaking error paths
- Fix kernel docs
- Add typecast to drmm_zalloc_obj(s)
- Drop extra obsolete cleanup call in vc4

Changes in v6:
- Dropped applied patch
- Implemented suggestion by Alex to use drmm allocation for the
  writeback connector.
- Link to v5: https://patch.msgid.link/[email protected]

Changes in v5:
- Rebased on top of drm-misc-next
- Expanded commit message for msm patch, describing devm vs drmm issues (Laurent)
- Expanded commit messages, describing why the drivers are converted to
  drmm_writeback_connector_init() (Laurent)
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Rebase on top of drm-misc-next, dropping applied patch.
- Added a note regarding memory leak in the AMDGPU driver.
- Fixed a devm vs drmm issue in the msm/dpu driver.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Fixed subject prefix for the rcar-du patch (Jessica Zhang)
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Switched to drm_crtc_mask() where applicable (Louis Chauvet)
- Link to v1: https://lore.kernel.org/r/[email protected]

To: Maarten Lankhorst <[email protected]>
To: Maxime Ripard <[email protected]>
To: Thomas Zimmermann <[email protected]>
To: David Airlie <[email protected]>
To: Simona Vetter <[email protected]>
To: Harry Wentland <[email protected]>
To: Leo Li <[email protected]>
To: Rodrigo Siqueira <[email protected]>
To: Alex Deucher <[email protected]>
To: Christian König <[email protected]>
To: Liviu Dudau <[email protected]>
To: Laurent Pinchart <[email protected]>
To: Tomi Valkeinen <[email protected]>
To: Kieran Bingham <[email protected]>
To: Geert Uytterhoeven <[email protected]>
To: Magnus Damm <[email protected]>
To: Dave Stevenson <[email protected]>
To: Maíra Canal <[email protected]>
To: Raspberry Pi Kernel Maintenance <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Dmitry Baryshkov (8):
  drm/managed: implement managed versions of kzalloc_obj/objs()
  drm/amd/display: use drmm allocation for writeback connector
  drm/amd/display: use drmm_writeback_connector_init()
  drm/komeda: use drmm_writeback_connector_init()
  drm/mali: use drmm_writeback_connector_init()
  drm: renesas: rcar-du: use drmm_writeback_connector_init()
  drm/vc4: use drmm_writeback_connector_init()
  drm: writeback: drop excess connector initialization functions

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   6 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c  |  18 ++-
 .../amdgpu_dm/tests/amdgpu_dm_wb_test.c       |   2 -
 .../arm/display/komeda/komeda_wb_connector.c  |  39 ++++---
 drivers/gpu/drm/arm/malidp_mw.c               |  26 +++--
 drivers/gpu/drm/drm_writeback.c               | 107 ------------------
 .../drm/renesas/rcar-du/rcar_du_writeback.c   |  22 ++--
 drivers/gpu/drm/vc4/vc4_txp.c                 |  18 +--
 include/drm/drm_managed.h                     |  23 ++++
 include/drm/drm_mode_config.h                 |   6 +-
 include/drm/drm_writeback.h                   |  26 +----
 11 files changed, 99 insertions(+), 194 deletions(-)

-- 
2.43.0