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: soc/tegra: pmc: Create PMC context dynamically
Date: Thu, 07 May 2026 13:29:35 +1000	[thread overview]
Message-ID: <review-patch7-20260506-pmc-v1-7-a6de5da7216b@nvidia.com> (raw)
In-Reply-To: <20260506-pmc-v1-7-a6de5da7216b@nvidia.com>

Patch Review

This is the most substantial patch. It renames the global `pmc` to `early_pmc`, allocates a new `struct tegra_pmc` dynamically in `tegra_pmc_probe()`, and extracts a `tegra_pmc_init_common()` helper shared between early init and probe.

The `tegra_pmc_detect_tz_only()` function is moved from `__init` to non-`__init` since it's now called from both early init and probe. This is correct.

In `tegra_pmc_probe()`, the new dynamic PMC's `base` is remapped via `devm_platform_ioremap_resource()`, and the `early_pmc->base` is updated to point to the new mapping (under `powergates_lock`). The early ioremap'd region is freed. This ensures legacy callers that still go through `early_pmc` continue to work.

One observation: `tegra_pmc_init_common()` unconditionally calls `tegra_pmc_detect_tz_only()`, but in the early init path, the original code only did so when `pmc->soc->maybe_tz_only` was true:

```c
-		if (pmc->soc->maybe_tz_only)
-			pmc->tz_only = tegra_pmc_detect_tz_only(pmc);
```

The new `tegra_pmc_init_common()` does not check `maybe_tz_only`:

```c
+static void tegra_pmc_init_common(struct tegra_pmc *pmc)
+{
+	pmc->tz_only = tegra_pmc_detect_tz_only(pmc);
```

This means on SoCs where `maybe_tz_only` is false, the scratch register probe-by-write will now be executed unnecessarily. For most SoCs this is harmless (the write-readback test is benign), but it's a behavioral change worth noting. If scratch0 is protected on some SoC where `maybe_tz_only` was intentionally false, this could cause unexpected side effects.

The whitespace fix aligning `"scratch"` in the platform_get_resource_byname call is fine as a drive-by cleanup.

Also, `tegra_pmc_sync_state()` correctly retrieves the dynamically allocated PMC via `dev_get_drvdata()` instead of using the old global.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-07  3:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 13:41 [PATCH 0/9] soc/tegra: pmc: Clean up legacy code Thierry Reding
2026-05-06 13:41 ` [PATCH 1/9] ata: ahci_tegra: Explicitly specify PMC instance to use Thierry Reding
2026-05-06 13:54   ` Damien Le Moal
2026-05-07  3:29   ` Claude review: " Claude Code Review Bot
2026-05-06 13:41 ` [PATCH 2/9] drm/nouveau: tegra: " Thierry Reding
2026-05-07  3:29   ` Claude review: " Claude Code Review Bot
2026-05-06 13:41 ` [PATCH 3/9] drm/tegra: " Thierry Reding
2026-05-07  3:29   ` Claude review: " Claude Code Review Bot
2026-05-06 13:41 ` [PATCH 4/9] media: vde: " Thierry Reding
2026-05-07  3:29   ` Claude review: " Claude Code Review Bot
2026-05-06 13:41 ` [PATCH 5/9] PCI: tegra: " Thierry Reding
2026-05-07  3:29   ` Claude review: " Claude Code Review Bot
2026-05-06 13:41 ` [PATCH 6/9] usb: xhci: " Thierry Reding
2026-05-07  3:29   ` Claude review: " Claude Code Review Bot
2026-05-06 13:41 ` [PATCH 7/9] soc/tegra: pmc: Create PMC context dynamically Thierry Reding
2026-05-07  3:29   ` Claude Code Review Bot [this message]
2026-05-06 13:41 ` [PATCH 8/9] soc/tegra: pmc: Remove unused legacy functions Thierry Reding
2026-05-07  3:29   ` Claude review: " Claude Code Review Bot
2026-05-06 13:42 ` [PATCH 9/9] soc/tegra: pmc: Move legacy code behind CONFIG_ARM guard Thierry Reding
2026-05-07  3:29   ` Claude review: " Claude Code Review Bot
2026-05-07  3:29 ` Claude review: soc/tegra: pmc: Clean up legacy code Claude Code Review Bot

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-patch7-20260506-pmc-v1-7-a6de5da7216b@nvidia.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