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: Thu, 23 Apr 2026 09:21:39 +1000 Message-ID: In-Reply-To: <20260420-rust_serdev-v5-4-57e8ba0519f3@posteo.de> References: <20260420-rust_serdev-v5-0-57e8ba0519f3@posteo.de> <20260420-rust_serdev-v5-4-57e8ba0519f3@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 Clean and functional sample driver. A few observations: **Echoing data in receive callback:** ```rust + fn receive(sdev: &serdev::Device, _this: Pin<&Self>, data: &[u8]) -> usize { + let _ = sdev.write_all(data, serdev::Timeout::Max); + data.len() + } ``` The `write_all` with `Timeout::Max` could block indefinitely if the device can't accept data. For a sample this is acceptable, but a brief comment noting this is intentional would be helpful. Also, `let _ =` silently discards write errors, which is fine for a sample. **Baudrate handling:** ```rust + if sdev + .set_baudrate( + dev.fwnode() + .and_then(|fwnode| fwnode.property_read(c"baudrate").optional()) + .unwrap_or(115200), + ) + .is_err() + { + return Err(EINVAL); + } ``` Reading a `baudrate` property from firmware and falling back to 115200 is a reasonable pattern. The `set_baudrate` error (which contains the actual baudrate set) is discarded and replaced with `EINVAL`, which is appropriate. **Kconfig entry properly uses `select`:** ``` + select RUST_SERIAL_DEV_BUS_ABSTRACTIONS ``` This ensures the abstraction is compiled when the sample is enabled. Correct. The sample effectively demonstrates OF and ACPI device table setup, probe/remove lifecycle, baudrate/flow-control/parity configuration, and the receive callback -- good coverage for a sample driver. --- Generated by Claude Code Patch Reviewer