public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/amd/display: Deduplicate DCN DDC register assignment
Date: Sun, 22 Mar 2026 03:15:10 +1000	[thread overview]
Message-ID: <review-patch1-20260321015654.105059-1-guilhermeivob@gmail.com> (raw)
In-Reply-To: <20260321015654.105059-1-guilhermeivob@gmail.com>

Patch Review

**Critical: Wrong parameter types — will not compile**

In `hw_factory_dcn_ddc.h:14-15`, the helper declares:
```c
const struct ddc_shift *shift,
const struct ddc_mask *mask)
```

The types `struct ddc_shift` and `struct ddc_mask` **do not exist** anywhere in the kernel tree. The correct type for both is `struct ddc_sh_mask`, as defined in `ddc_regs.h:130` and used by all the caller arrays (e.g. `hw_factory_dcn20.c:137`):
```c
static const struct ddc_sh_mask ddc_shift[] = { ... };
static const struct ddc_sh_mask ddc_mask[] = { ... };
```

And the `hw_ddc` struct (`hw_ddc.h:34-35`) stores them as:
```c
const struct ddc_sh_mask *shifts;
const struct ddc_sh_mask *masks;
```

The fix is to change both parameters to `const struct ddc_sh_mask *`.

**Minor: Copyright year**

The new header (`hw_factory_dcn_ddc.h:4`) says `Copyright 2024` but this is new code written in 2026. Should be `2026`.

**Minor: Missing include guard for dependencies**

The new header `hw_factory_dcn_ddc.h` uses `struct hw_gpio_pin`, `struct ddc_registers`, `struct hw_ddc`, `HW_DDC_FROM_BASE`, `GPIO_ID_DDC_DATA`, `GPIO_ID_DDC_CLOCK`, and `ASSERT_CRITICAL` without including any headers. It relies entirely on the including `.c` file having already included the right headers in the right order. This is fragile — a comment at the top noting the required includes, or explicit includes, would be more robust. This is a pre-existing pattern in the codebase though, so it's not a blocker.

**Design: `static inline` in a header**

Using `static inline` is reasonable for this small helper. Each translation unit gets its own copy, but the function is small enough that the compiler will inline it, so there's no code size penalty.

**Correctness of the transformation (modulo the type bug)**

The logic in the helper faithfully reproduces the original `switch`/assignment pattern from all 6 files. The `en` index, the `ASSERT_CRITICAL(false)` default case, and the shift/mask assignment after the switch are all preserved correctly.

**Summary:** Fix the `struct ddc_shift`/`struct ddc_mask` → `struct ddc_sh_mask` type error, update the copyright year, and this is a clean, correct deduplication patch.

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-03-21 17:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21  1:56 [PATCH] drm/amd/display: Deduplicate DCN DDC register assignment guilhermeivo
2026-03-21 17:15 ` Claude review: " Claude Code Review Bot
2026-03-21 17:15 ` Claude Code Review Bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=review-patch1-20260321015654.105059-1-guilhermeivob@gmail.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox