From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260506-pmc-v1-7-a6de5da7216b@nvidia.com> References: <20260506-pmc-v1-0-a6de5da7216b@nvidia.com> <20260506-pmc-v1-7-a6de5da7216b@nvidia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 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