From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: rust: io: use pointer types instead of address Date: Thu, 23 Apr 2026 08:25:45 +1000 Message-ID: In-Reply-To: <20260421-io_projection-v2-3-4c251c692ef4@garyguo.net> References: <20260421-io_projection-v2-0-4c251c692ef4@garyguo.net> <20260421-io_projection-v2-3-4c251c692ef4@garyguo.net> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review The biggest refactor: replaces `addr() -> usize` / `maxsize() -> usize` with `as_ptr() -> *mut Self::Type` on the `Io` trait, and makes `IoCapable` take `*mut T` instead of `usize`. This eliminates `IoKnownSize` (kept as a blanket impl for compatibility). The PCI config space handling is notable. Since PCI config space uses offsets not real pointers, null pointers with size metadata are used: ```rust fn null_ptr_from_size(size: ConfigSpaceSize) -> *mut Self::Region { core::ptr::slice_from_raw_parts_mut(core::ptr::null_mut::(), size.into_raw()) as *mut Self::Region } ``` This is documented as intentional since `IoCapable` impls for PCI config space only use `address.addr()` (the offset), never dereferencing the pointer. The `io_addr` method now uses `wrapping_byte_add` which is appropriate for potentially-null pointers. One minor observation: the `io_addr_assert` method now uses `build_assert!` with `Self::Type::MIN_SIZE` -- this means it checks against the compile-time minimum, while `io_addr` checks against the runtime `KnownSize::size(ptr)`. This is consistent with the intent (compile-time vs runtime bounds checking). The `IoKnownSize` deprecation is handled gracefully with a blanket impl and `#[doc(hidden)]`. --- Generated by Claude Code Patch Reviewer