From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: samples: rust: add Rust serial device bus sample device driver Date: Tue, 28 Apr 2026 14:14:45 +1000 Message-ID: In-Reply-To: <20260427-rust_serdev-v6-4-173798d5e1a3@posteo.de> References: <20260427-rust_serdev-v6-0-173798d5e1a3@posteo.de> <20260427-rust_serdev-v6-4-173798d5e1a3@posteo.de> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review The sample is clean and demonstrates the key API surface well. **One issue with the sample probe:** ```rust fn probe( sdev: &serdev::Device, _info: Option<&Self::IdInfo>, ) -> impl PinInit { ... if sdev.set_baudrate(...).is_err() { return Err(EINVAL); } ``` The `set_baudrate` method is on `Device`, but `sdev` is `&Device`. This works via the deref coercion chain, which is correct but could be surprising to readers. A brief comment in the abstraction's module-level docs explaining the device context hierarchy and auto-deref would help (though this is a broader Rust-for-Linux documentation issue, not specific to this patch). **The receive callback echoes data back:** ```rust fn receive(sdev: &serdev::Device, _this: Pin<&Self>, data: &[u8]) -> usize { let _ = sdev.write_all(data, serdev::Timeout::Max); data.len() } ``` This is fine for a sample. The `let _ =` discards the write result, which is acceptable for demonstration purposes. Note that this always returns `data.len()` (claiming all data was consumed) regardless of whether `write_all` succeeded, which is the right behavior for a simple echo. **The `SampleDriver` stores an `ARef` but only uses it in `Drop`** for a debug message. This is fine as a sample demonstrating how to keep a reference to the device. No blocking issues with this patch. --- Generated by Claude Code Patch Reviewer