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: driver core: platform: count references to all kinds of firmware nodes
Date: Mon, 25 May 2026 20:33:08 +1000	[thread overview]
Message-ID: <review-patch23-20260521-pdev-fwnode-ref-v1-23-88c324a1b8d2@oss.qualcomm.com> (raw)
In-Reply-To: <20260521-pdev-fwnode-ref-v1-23-88c324a1b8d2@oss.qualcomm.com>

Patch Review

This is the payoff patch. Three key changes:

**Release function**:
```c
-	of_node_put(pa->pdev.dev.of_node);
+	fwnode_handle_put(pa->pdev.dev.fwnode);
```
Correct. For OF nodes, `fwnode_handle_put()` calls through to `of_node_put()` via the fwnode ops. For non-OF fwnodes, this now properly drops the reference that patch 23's updated helpers take.

**`platform_device_set_fwnode()` becomes the canonical implementation**:
```c
 void platform_device_set_fwnode(struct platform_device *pdev,
 				struct fwnode_handle *fwnode)
 {
-	if (is_of_node(fwnode))
-		platform_device_set_of_node(pdev, to_of_node(fwnode));
-	else
-		pdev->dev.fwnode = fwnode;
+	fwnode_handle_put(pdev->dev.fwnode);
+	pdev->dev.fwnode = fwnode_handle_get(fwnode);
+	pdev->dev.of_node = to_of_node(fwnode);
 }
```
Clean. Unified get/put for all fwnode types. `to_of_node()` returns NULL for non-OF fwnodes, correctly clearing `of_node`.

**`platform_device_set_of_node()` becomes a thin wrapper**:
```c
 void platform_device_set_of_node(struct platform_device *pdev,
 				 struct device_node *np)
 {
-	of_node_put(pdev->dev.of_node);
-	pdev->dev.of_node = of_node_get(np);
-	pdev->dev.fwnode = of_fwnode_handle(np);
+	platform_device_set_fwnode(pdev, of_fwnode_handle(np));
 }
```
Correct inversion of the delegation — `set_of_node` now calls `set_fwnode` instead of the reverse.

**`platform_device_register_full()`**:
```c
-	pdev->dev.fwnode = pdevinfo->fwnode;
-	pdev->dev.of_node = of_node_get(to_of_node(pdev->dev.fwnode));
+	pdev->dev.fwnode = fwnode_handle_get(pdevinfo->fwnode);
+	pdev->dev.of_node = to_of_node(pdev->dev.fwnode);
```
Correct. Takes a generic fwnode ref instead of only an OF ref. The `dev_assign_of_node_reused` call on the next line is not in the current tree — this needs a dependency note.

**Overall**: The refcounting is balanced. Every `fwnode_handle_get()` in the set functions is matched by the `fwnode_handle_put()` in `platform_device_release()`. The `platform_device_set_of_node_from_dev()` path works because for OF nodes, `of_node_get()` and `fwnode_handle_put()` operate on the same underlying refcount.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-25 10:33 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  8:36 [PATCH 00/23] driver core: count references of the platform device's fwnode, not OF node Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 01/23] mfd: tps6586x: fix OF node refcount Bartosz Golaszewski
2026-05-25 10:33   ` Claude review: " Claude Code Review Bot
2026-05-21  8:36 ` [PATCH 02/23] net: mv643xx: " Bartosz Golaszewski
2026-05-25 10:33   ` Claude review: " Claude Code Review Bot
2026-05-21  8:36 ` [PATCH 03/23] slimbus: qcom-ngd-ctrl: " Bartosz Golaszewski
2026-05-25 10:33   ` Claude review: " Claude Code Review Bot
2026-05-21  8:36 ` [PATCH 04/23] pmdomain: imx: " Bartosz Golaszewski
2026-05-25 10:33   ` Claude review: " Claude Code Review Bot
2026-05-21  8:36 ` [PATCH 05/23] powerpc/powermac: " Bartosz Golaszewski
2026-05-25 10:33   ` Claude review: " Claude Code Review Bot
2026-05-21  8:36 ` [PATCH 06/23] driver core: platform: provide platform_device_set_of_node() Bartosz Golaszewski
2026-05-25 10:33   ` Claude review: " Claude Code Review Bot
2026-05-21  8:36 ` [PATCH 07/23] driver core: platform: provide platform_device_set_fwnode() Bartosz Golaszewski
2026-05-25 10:33   ` Claude review: " Claude Code Review Bot
2026-05-21  8:36 ` [PATCH 08/23] driver core: platform: provide platform_device_set_of_node_from_dev() Bartosz Golaszewski
2026-05-25 10:33   ` Claude review: " Claude Code Review Bot
2026-05-21  8:36 ` [PATCH 09/23] of: platform: use platform_device_set_of_node() Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 10/23] powerpc/powermac: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 11/23] i2c: pxa-pci: " Bartosz Golaszewski
2026-05-21  9:13   ` Wolfram Sang
2026-05-21  8:36 ` [PATCH 12/23] iommu/fsl: " Bartosz Golaszewski
2026-05-21  9:44   ` Robin Murphy
2026-05-21  8:36 ` [PATCH 13/23] net: bcmgenet: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 14/23] pmdomain: imx: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 15/23] mfd: tps6586: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 16/23] slimbus: qcom-ngd-ctrl: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 17/23] net: mv643xx: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 18/23] drm/xe/i2c: use platform_device_set_fwnode() Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 19/23] platform/surface: gpe: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 20/23] usb: chipidea: use platform_device_set_of_node_from_dev() Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 21/23] usb: musb: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 22/23] reset: rzg2l: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 23/23] driver core: platform: count references to all kinds of firmware nodes Bartosz Golaszewski
2026-05-25 10:33   ` Claude Code Review Bot [this message]
2026-05-25 10:33 ` Claude review: driver core: count references of the platform device's fwnode, not OF node 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-patch23-20260521-pdev-fwnode-ref-v1-23-88c324a1b8d2@oss.qualcomm.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