]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
samples: rust: auxiliary: misc cleanup of ParentDriver::connect()
authorDanilo Krummrich <dakr@kernel.org>
Mon, 20 Oct 2025 22:34:29 +0000 (00:34 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Wed, 29 Oct 2025 17:29:32 +0000 (18:29 +0100)
In ParentDriver::connect() rename parent to dev, use it for the
dev_info!() call, call pdev.vendor_() directly in the print statement
and remove the unnecessary generic type of Result.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
samples/rust/rust_driver_auxiliary.rs

index 95c552ee948996c1633f21ee36c3123bc8dcb956..a5d67d4d9e83503a3055a45450a078e9cc4fe323 100644 (file)
@@ -70,16 +70,15 @@ impl pci::Driver for ParentDriver {
 }
 
 impl ParentDriver {
-    fn connect(adev: &auxiliary::Device) -> Result<()> {
-        let parent = adev.parent();
-        let pdev: &pci::Device = parent.try_into()?;
+    fn connect(adev: &auxiliary::Device) -> Result {
+        let dev = adev.parent();
+        let pdev: &pci::Device = dev.try_into()?;
 
-        let vendor = pdev.vendor_id();
         dev_info!(
-            adev.as_ref(),
+            dev,
             "Connect auxiliary {} with parent: VendorID={}, DeviceID={:#x}\n",
             adev.id(),
-            vendor,
+            pdev.vendor_id(),
             pdev.device_id()
         );