From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: moduleparam: Route DEFINE_KERNEL_PARAM_OPS get pointer via _Generic
Date: Mon, 25 May 2026 20:11:17 +1000 [thread overview]
Message-ID: <review-patch7-20260521133326.2465264-7-kees@kernel.org> (raw)
In-Reply-To: <20260521133326.2465264-7-kees@kernel.org>
Patch Review
This is the key migration enabler. The `_Generic` dispatch:
```c
+#define _KERNEL_PARAM_OPS_GET(_get) \
+ _Generic((_get), \
+ int (*)(char *, const struct kernel_param *): NULL, \
+ default: (_get))
```
When `_get` has the legacy `char *` signature, `_KERNEL_PARAM_OPS_GET` yields NULL (and `_KERNEL_PARAM_OPS_GET_STR` yields the pointer via `default`). When `_get` has the new `seq_buf *` signature, the opposite. If `_get` matches neither signature, the `default` branch still fires but the assignment to the struct field produces a type mismatch compile error.
**Minor observation:** The `_Generic` selectors use two explicit types plus `default`. If someone passes a `NULL` literal for `_get`, `_Generic` on a null pointer constant may have implementation-defined behavior across compilers. However, passing NULL for `_get` in these macros is unlikely in practice (you'd just omit `.get`), and the existing uses all pass actual function pointers.
**Verdict: Clever and correct approach for the migration period.**
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-25 10:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 13:33 [PATCH 00/11] Convert moduleparams to seq_buf Kees Cook
2026-05-21 13:33 ` [PATCH 01/11] params: bound array element output to the caller's page buffer Kees Cook
2026-05-21 16:46 ` David Laight
2026-05-25 10:11 ` Claude review: " Claude Code Review Bot
2026-05-21 13:33 ` [PATCH 02/11] panic: Replace panic_print_get() with generic helper Kees Cook
2026-05-25 10:11 ` Claude review: " Claude Code Review Bot
2026-05-21 13:33 ` [PATCH 03/11] moduleparam: Add DEFINE_KERNEL_PARAM_OPS macro family Kees Cook
2026-05-25 10:11 ` Claude review: " Claude Code Review Bot
2026-05-21 13:33 ` [PATCH 04/11] treewide: Convert struct kernel_param_ops initializers to DEFINE_KERNEL_PARAM_OPS Kees Cook
2026-05-21 13:59 ` Sean Christopherson
2026-05-22 17:01 ` Rafael J. Wysocki
2026-05-23 0:38 ` SeongJae Park
2026-05-25 10:11 ` Claude review: " Claude Code Review Bot
2026-05-21 13:33 ` [PATCH 05/11] moduleparam: Rename .get field to .get_str Kees Cook
2026-05-25 10:11 ` Claude review: " Claude Code Review Bot
2026-05-21 13:33 ` [PATCH 06/11] moduleparam: Add seq_buf-based .get callback alongside .get_str Kees Cook
2026-05-25 10:11 ` Claude review: " Claude Code Review Bot
2026-05-21 13:33 ` [PATCH 07/11] moduleparam: Route DEFINE_KERNEL_PARAM_OPS get pointer via _Generic Kees Cook
2026-05-25 10:11 ` Claude Code Review Bot [this message]
2026-05-21 13:33 ` [PATCH 08/11] params: Convert generic kernel_param_ops .get helpers to seq_buf Kees Cook
2026-05-25 10:11 ` Claude review: " Claude Code Review Bot
2026-05-21 13:33 ` [PATCH 09/11] treewide: Convert custom kernel_param_ops .get callbacks to seq_buf via cocci Kees Cook
2026-05-21 13:45 ` Sean Christopherson
2026-05-22 17:03 ` Rafael J. Wysocki
2026-05-23 0:45 ` SeongJae Park
2026-05-25 10:11 ` Claude review: " Claude Code Review Bot
2026-05-21 13:33 ` [PATCH 10/11] treewide: Manually convert custom kernel_param_ops .get callbacks Kees Cook
2026-05-21 17:44 ` Jani Nikula
2026-05-22 17:05 ` Rafael J. Wysocki
2026-05-25 10:11 ` Claude review: " Claude Code Review Bot
2026-05-21 13:33 ` [PATCH 11/11] moduleparam: Drop legacy kernel_param_ops .get_str field and dispatch logic Kees Cook
2026-05-25 10:11 ` Claude review: " Claude Code Review Bot
2026-05-25 10:11 ` Claude review: Convert moduleparams to seq_buf 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-20260521133326.2465264-7-kees@kernel.org \
--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