Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH 0/2] rust: use vertical import style in miscdevice
@ 2026-05-19  5:34 Alvin Sun
  2026-05-19  5:34 ` [PATCH 1/2] rust: miscdevice: use vertical import style Alvin Sun
  2026-05-19  5:34 ` [PATCH 2/2] samples: rust_misc_device: " Alvin Sun
  0 siblings, 2 replies; 5+ messages in thread
From: Alvin Sun @ 2026-05-19  5:34 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich
  Cc: rust-for-linux, Alvin Sun

Reformat `use` imports to vertical style for readability and to reduce
merge conflicts when imports are added or removed.

Signed-off-by: Alvin Sun <alvin.sun@linux.dev>
---
Alvin Sun (2):
      rust: miscdevice: use vertical import style
      samples: rust_misc_device: use vertical import style

 rust/kernel/miscdevice.rs        | 34 ++++++++++++++++++++++++++++------
 samples/rust/rust_misc_device.rs | 34 ++++++++++++++++++++++++++++------
 2 files changed, 56 insertions(+), 12 deletions(-)
---
base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8
change-id: 20260519-miscdev-use-format-9ab7e83b1c11

Best regards,
-- 
Alvin Sun <alvin.sun@linux.dev>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] rust: miscdevice: use vertical import style
  2026-05-19  5:34 [PATCH 0/2] rust: use vertical import style in miscdevice Alvin Sun
@ 2026-05-19  5:34 ` Alvin Sun
  2026-05-19  5:58   ` Miguel Ojeda
  2026-05-19  5:34 ` [PATCH 2/2] samples: rust_misc_device: " Alvin Sun
  1 sibling, 1 reply; 5+ messages in thread
From: Alvin Sun @ 2026-05-19  5:34 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich
  Cc: rust-for-linux, Alvin Sun

Convert `use` imports to vertical layout for better readability and
maintainability.

Signed-off-by: Alvin Sun <alvin.sun@linux.dev>
---
 rust/kernel/miscdevice.rs | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/rust/kernel/miscdevice.rs b/rust/kernel/miscdevice.rs
index c3c2052c92069..05a6b6b9770f2 100644
--- a/rust/kernel/miscdevice.rs
+++ b/rust/kernel/miscdevice.rs
@@ -11,16 +11,38 @@
 use crate::{
     bindings,
     device::Device,
-    error::{to_result, Error, Result, VTABLE_DEFAULT_ERROR},
-    ffi::{c_int, c_long, c_uint, c_ulong},
-    fs::{File, Kiocb},
-    iov::{IovIterDest, IovIterSource},
+    error::{
+        to_result,
+        Error,
+        Result,
+        VTABLE_DEFAULT_ERROR, //
+    },
+    ffi::{
+        c_int,
+        c_long,
+        c_uint,
+        c_ulong, //
+    },
+    fs::{
+        File,
+        Kiocb, //
+    },
+    iov::{
+        IovIterDest,
+        IovIterSource, //
+    },
     mm::virt::VmaNew,
     prelude::*,
     seq_file::SeqFile,
-    types::{ForeignOwnable, Opaque},
+    types::{
+        ForeignOwnable,
+        Opaque, //
+    },
+};
+use core::{
+    marker::PhantomData,
+    pin::Pin, //
 };
-use core::{marker::PhantomData, pin::Pin};
 
 /// Options for creating a misc device.
 #[derive(Copy, Clone)]

-- 
2.43.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] samples: rust_misc_device: use vertical import style
  2026-05-19  5:34 [PATCH 0/2] rust: use vertical import style in miscdevice Alvin Sun
  2026-05-19  5:34 ` [PATCH 1/2] rust: miscdevice: use vertical import style Alvin Sun
@ 2026-05-19  5:34 ` Alvin Sun
  1 sibling, 0 replies; 5+ messages in thread
From: Alvin Sun @ 2026-05-19  5:34 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich
  Cc: rust-for-linux, Alvin Sun

Convert `use` imports to vertical layout for better readability and
maintainability.

Signed-off-by: Alvin Sun <alvin.sun@linux.dev>
---
 samples/rust/rust_misc_device.rs | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/samples/rust/rust_misc_device.rs b/samples/rust/rust_misc_device.rs
index 87a1fe63533ae..41e26c825060b 100644
--- a/samples/rust/rust_misc_device.rs
+++ b/samples/rust/rust_misc_device.rs
@@ -97,14 +97,36 @@
 
 use kernel::{
     device::Device,
-    fs::{File, Kiocb},
-    ioctl::{_IO, _IOC_SIZE, _IOR, _IOW},
-    iov::{IovIterDest, IovIterSource},
-    miscdevice::{MiscDevice, MiscDeviceOptions, MiscDeviceRegistration},
+    fs::{
+        File,
+        Kiocb, //
+    },
+    ioctl::{
+        _IO,
+        _IOC_SIZE,
+        _IOR,
+        _IOW, //
+    },
+    iov::{
+        IovIterDest,
+        IovIterSource, //
+    },
+    miscdevice::{
+        MiscDevice,
+        MiscDeviceOptions,
+        MiscDeviceRegistration, //
+    },
     new_mutex,
     prelude::*,
-    sync::{aref::ARef, Mutex},
-    uaccess::{UserSlice, UserSliceReader, UserSliceWriter},
+    sync::{
+        aref::ARef,
+        Mutex, //
+    },
+    uaccess::{
+        UserSlice,
+        UserSliceReader,
+        UserSliceWriter, //
+    },
 };
 
 const RUST_MISC_DEV_HELLO: u32 = _IO('|' as u32, 0x80);

-- 
2.43.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] rust: miscdevice: use vertical import style
  2026-05-19  5:34 ` [PATCH 1/2] rust: miscdevice: use vertical import style Alvin Sun
@ 2026-05-19  5:58   ` Miguel Ojeda
  2026-05-19  6:37     ` Alvin Sun
  0 siblings, 1 reply; 5+ messages in thread
From: Miguel Ojeda @ 2026-05-19  5:58 UTC (permalink / raw)
  To: Alvin Sun
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, rust-for-linux

On Tue, May 19, 2026 at 7:35 AM Alvin Sun <alvin.sun@linux.dev> wrote:
>
> Convert `use` imports to vertical layout for better readability and
> maintainability.

A bunch of these are already available through the prelude, so I would
suggest taking the chance to clean those up too, possibly in a
separate commit.

Thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] rust: miscdevice: use vertical import style
  2026-05-19  5:58   ` Miguel Ojeda
@ 2026-05-19  6:37     ` Alvin Sun
  0 siblings, 0 replies; 5+ messages in thread
From: Alvin Sun @ 2026-05-19  6:37 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, rust-for-linux


On 5/19/26 13:58, Miguel Ojeda wrote:
> On Tue, May 19, 2026 at 7:35 AM Alvin Sun <alvin.sun@linux.dev> wrote:
>> Convert `use` imports to vertical layout for better readability and
>> maintainability.
> A bunch of these are already available through the prelude, so I would
> suggest taking the chance to clean those up too, possibly in a
> separate commit.

I'm working on it.

Best regards,
Alvin

>
> Thanks!
>
> Cheers,
> Miguel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-19  6:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19  5:34 [PATCH 0/2] rust: use vertical import style in miscdevice Alvin Sun
2026-05-19  5:34 ` [PATCH 1/2] rust: miscdevice: use vertical import style Alvin Sun
2026-05-19  5:58   ` Miguel Ojeda
2026-05-19  6:37     ` Alvin Sun
2026-05-19  5:34 ` [PATCH 2/2] samples: rust_misc_device: " Alvin Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox