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: zorro: Simplify storing pointers in device id struct
Date: Wed, 27 May 2026 14:47:33 +1000	[thread overview]
Message-ID: <review-patch6-49576a7501128c93ef318566ed7faefce163f1fd.1779803053.git.u.kleine-koenig@baylibre.com> (raw)
In-Reply-To: <49576a7501128c93ef318566ed7faefce163f1fd.1779803053.git.u.kleine-koenig@baylibre.com>

Patch Review

**Status: Looks good.**

The core change in `include/linux/mod_devicetable.h`:

```c
 struct zorro_device_id {
 	__u32 id;			/* Device ID or ZORRO_WILDCARD */
-	kernel_ulong_t driver_data;	/* Data private to the driver */
+	union {
+		/* Data private to the driver */
+		kernel_ulong_t driver_data;
+		const void *driver_data_ptr;
+	};
 };
```

This is clean and backward compatible. Key observations:

1. **Union sizing:** `kernel_ulong_t` is `unsigned long long` on 32-bit arches (for cross-compilation with file2alias), so the union is at least 8 bytes. On all current architectures, `sizeof(void *)` <= `sizeof(kernel_ulong_t)`, so the union doesn't change struct size or layout. On CHERI, pointers would be larger, but that's exactly the scenario this enables.

2. **Anonymous union:** Correct choice — it allows `ent->driver_data` and `ent->driver_data_ptr` to be used interchangeably without changing any syntax at call sites.

3. **Backward compatibility:** All existing users that set `.driver_data = (unsigned long)&foo` continue to compile and work. The patches 7 and 8 then convert them to `.driver_data_ptr` at their own pace. This is the right incremental approach.

4. **const correctness:** Using `const void *` is appropriate — it preserves const-ness of the pointed-to data, which the `(unsigned long)` cast was losing.

One minor note: the commit message says "no adaptions are needed" for existing users — this is correct because all current initializers use `.driver_data = ...` named syntax or positional syntax that maps to `.id` (the first field), and `driver_data` remains accessible at the same name.

No concerns.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-27  4:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 14:17 [PATCH v1 0/8] zorro: Improve handling of pointers in zorro_device_id::driver_data Uwe Kleine-König (The Capable Hub)
2026-05-26 14:17 ` [PATCH v1 5/8] video: fm2fb: Use named initializer for zorro_device_id array Uwe Kleine-König (The Capable Hub)
2026-05-27  4:47   ` Claude review: " Claude Code Review Bot
2026-05-26 14:17 ` [PATCH v1 6/8] zorro: Simplify storing pointers in device id struct Uwe Kleine-König (The Capable Hub)
2026-05-27  4:47   ` Claude Code Review Bot [this message]
2026-05-26 14:17 ` [PATCH v1 8/8] video: cirrusfb: Make use of struct zorro_device_id::driver_data_ptr Uwe Kleine-König (The Capable Hub)
2026-05-27  4:47   ` Claude review: " Claude Code Review Bot
2026-05-26 15:01 ` [PATCH v1 0/8] zorro: Improve handling of pointers in zorro_device_id::driver_data Geert Uytterhoeven
2026-05-26 16:38   ` Uwe Kleine-König (The Capable Hub)
2026-05-27  4:47 ` Claude review: " 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-patch6-49576a7501128c93ef318566ed7faefce163f1fd.1779803053.git.u.kleine-koenig@baylibre.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