From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/amd/display: Wire up dcn10_dio_construct() for all pre-DCN401 generations Date: Wed, 25 Mar 2026 07:19:08 +1000 Message-ID: In-Reply-To: <20260323211343.263909-1-sunlightlinux@gmail.com> References: <20260323211343.263909-1-sunlightlinux@gmail.com> <20260323211343.263909-1-sunlightlinux@gmail.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Bug: DCN21 shift/mask are zero-initialized** In `dcn21_resource.c`, the patch uses: ```c static const struct dcn_dio_shift dio_shift =3D { 0 }; static const struct dcn_dio_mask dio_mask =3D { 0 }; ``` Every other generation properly defines: ```c #define DIO_MASK_SH_LIST(mask_sh)\ HWS_SF(, DIO_MEM_PWR_CTRL, I2C_LIGHT_SLEEP_FORCE, mask_sh) static const struct dcn_dio_shift dio_shift =3D { DIO_MASK_SH_LIST(__SHIFT) }; static const struct dcn_dio_mask dio_mask =3D { DIO_MASK_SH_LIST(_MASK) }; ``` With mask =3D 0, the `REG_UPDATE(DIO_MEM_PWR_CTRL, I2C_LIGHT_SLEEP_FORCE, 1= )` call in `dcn10_dio_mem_pwr_ctrl()` (at `dcn10_dio.c:27`) becomes a no-op= . The initial `REG_WRITE(DIO_MEM_PWR_CTRL, 0)` at line 24 still clears the = register, but I2C light sleep force will never be re-enabled. DCN21 covers = Renoir/Cezanne APUs =E2=80=94 the hardware specifically called out in the c= ommit message as affected =E2=80=94 so this is particularly bad. This must = be fixed before merging. **Massive code duplication** The exact same boilerplate (~30 lines: register struct, shift/mask definiti= ons, `_dio_create()` function) is copy-pasted into 17 resource files. The o= nly variation is the SR macro style (designator-init for older gens vs `REG= _STRUCT` assignment for dcn32+). This could be significantly reduced: - The `_dio_create()` function body is identical across all generations (al= locate `dcn10_dio`, call `dcn10_dio_construct`). A single shared factory fu= nction could handle this. - Similarly, the destruction code (`kfree(TO_DCN10_DIO(pool->base.dio))`) i= s identical everywhere. Consider adding a common `dcn10_dio_destroy()` func= tion, or handling it in a shared resource pool teardown path. Even for the SR macro split, only two shared helpers would be needed: one f= or the initializer-style generations and one for the `REG_STRUCT` assignmen= t-style generations. **Single patch is too large for bisection** At 699 insertions across 17 files, this should ideally be split into at lea= st a few patches (e.g., grouped by DCN generation family), or better yet, i= ntroduce a shared helper first and then wire it up. A single monolithic pat= ch makes review harder and provides no bisection granularity if one generat= ion has problems. **Minor style inconsistency: blank line before `if (pool->base.dio)`** In dcn31, dcn314, dcn315, dcn316, the destruction block lacks the blank lin= e separator present in the other generations: ```c } if (pool->base.dio !=3D NULL) { // no blank line before this ``` vs. the other files which have: ```c } if (pool->base.dio !=3D NULL) { // blank line separator ``` This is cosmetic but inconsistent within the same patch. **Summary of required changes:** 1. **Fix DCN21 shift/mask** =E2=80=94 use the same `DIO_MASK_SH_LIST` / `HW= S_SF` pattern as all other generations. 2. **Strongly consider** factoring out the common code into a shared helper= to reduce the duplication. 3. **Consider splitting** into multiple patches for reviewability. --- Generated by Claude Code Patch Reviewer