* [PATCH] rust/drm: Fixup import styles
@ 2026-01-22 20:28 Lyude Paul
2026-01-22 20:30 ` Danilo Krummrich
0 siblings, 1 reply; 6+ messages in thread
From: Lyude Paul @ 2026-01-22 20:28 UTC (permalink / raw)
To: linux-kernel, dri-devel, rust-for-linux, Danilo Krummrich
Cc: Miguel Ojeda, Simona Vetter, Alice Ryhl, Shankari Anand,
David Airlie, Asahi Lina, Atharv Dubey, Daniel Almeida,
Lyude Paul
This is to match
https://docs.kernel.org/rust/coding-guidelines.html#imports
There should be no functional changes in this patch.
Signed-off-by: Lyude Paul <lyude@redhat.com>
---
rust/kernel/drm/device.rs | 29 +++++++++++++++++++++++------
rust/kernel/drm/driver.rs | 10 ++++++++--
rust/kernel/drm/file.rs | 14 +++++++++++---
rust/kernel/drm/gem/mod.rs | 25 ++++++++++++++++++++-----
4 files changed, 62 insertions(+), 16 deletions(-)
diff --git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs
index 3ce8f62a00569..23c457c90a6ab 100644
--- a/rust/kernel/drm/device.rs
+++ b/rust/kernel/drm/device.rs
@@ -6,15 +6,32 @@
use crate::{
alloc::allocator::Kmalloc,
- bindings, device, drm,
- drm::driver::AllocImpl,
- error::from_err_ptr,
- error::Result,
+ bindings,
+ device, //
+ drm::{
+ self,
+ driver::AllocImpl, //
+ },
+ error::{
+ from_err_ptr,
+ Result, //
+ },
prelude::*,
- sync::aref::{ARef, AlwaysRefCounted},
+ sync::aref::{
+ ARef,
+ AlwaysRefCounted, //
+ },
types::Opaque,
};
-use core::{alloc::Layout, mem, ops::Deref, ptr, ptr::NonNull};
+use core::{
+ alloc::Layout,
+ mem,
+ ops::Deref,
+ ptr::{
+ self,
+ NonNull, //
+ },
+};
#[cfg(CONFIG_DRM_LEGACY)]
macro_rules! drm_legacy_fields {
diff --git a/rust/kernel/drm/driver.rs b/rust/kernel/drm/driver.rs
index f30ee4c6245cd..c8ec5c0819a06 100644
--- a/rust/kernel/drm/driver.rs
+++ b/rust/kernel/drm/driver.rs
@@ -5,8 +5,14 @@
//! C header: [`include/drm/drm_drv.h`](srctree/include/drm/drm_drv.h)
use crate::{
- bindings, device, devres, drm,
- error::{to_result, Result},
+ bindings,
+ device,
+ devres,
+ drm, //
+ error::{
+ to_result,
+ Result, //
+ },
prelude::*,
sync::aref::ARef,
};
diff --git a/rust/kernel/drm/file.rs b/rust/kernel/drm/file.rs
index 8c46f8d519516..7dade6dfa1ba2 100644
--- a/rust/kernel/drm/file.rs
+++ b/rust/kernel/drm/file.rs
@@ -4,9 +4,17 @@
//!
//! C header: [`include/drm/drm_file.h`](srctree/include/drm/drm_file.h)
-use crate::{bindings, drm, error::Result, prelude::*, types::Opaque};
-use core::marker::PhantomData;
-use core::pin::Pin;
+use crate::{
+ bindings,
+ drm,
+ error::Result,
+ prelude::*,
+ types::Opaque, //
+};
+use core::{
+ marker::PhantomData,
+ pin::Pin, //
+};
/// Trait that must be implemented by DRM drivers to represent a DRM File (a client instance).
pub trait DriverFile {
diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
index d49a9ba026356..56b7641b1405e 100644
--- a/rust/kernel/drm/gem/mod.rs
+++ b/rust/kernel/drm/gem/mod.rs
@@ -6,14 +6,29 @@
use crate::{
alloc::flags::*,
- bindings, drm,
- drm::driver::{AllocImpl, AllocOps},
- error::{to_result, Result},
+ bindings,
+ drm::{
+ self,
+ driver::{
+ AllocImpl,
+ AllocOps, //
+ },
+ },
+ error::{
+ to_result,
+ Result, //
+ },
prelude::*,
- sync::aref::{ARef, AlwaysRefCounted},
+ sync::aref::{
+ ARef,
+ AlwaysRefCounted, //
+ },
types::Opaque,
};
-use core::{ops::Deref, ptr::NonNull};
+use core::{
+ ops::Deref,
+ ptr::NonNull, //
+};
/// A type alias for retrieving a [`Driver`]s [`DriverFile`] implementation from its
/// [`DriverObject`] implementation.
base-commit: 6ea52b6d8f33ae627f4dcf43b12b6e713a8b9331
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] rust/drm: Fixup import styles
2026-01-22 20:28 [PATCH] rust/drm: Fixup import styles Lyude Paul
@ 2026-01-22 20:30 ` Danilo Krummrich
2026-01-22 21:34 ` lyude
0 siblings, 1 reply; 6+ messages in thread
From: Danilo Krummrich @ 2026-01-22 20:30 UTC (permalink / raw)
To: Lyude Paul
Cc: linux-kernel, dri-devel, rust-for-linux, Miguel Ojeda,
Simona Vetter, Alice Ryhl, Shankari Anand, David Airlie,
Asahi Lina, Atharv Dubey, Daniel Almeida
On Thu Jan 22, 2026 at 9:28 PM CET, Lyude Paul wrote:
> This is to match
> https://docs.kernel.org/rust/coding-guidelines.html#imports
>
> There should be no functional changes in this patch.
Thanks! While at it, can you please drop imports that are in prelude and use
prelude instead?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust/drm: Fixup import styles
2026-01-22 20:30 ` Danilo Krummrich
@ 2026-01-22 21:34 ` lyude
2026-01-22 21:52 ` Miguel Ojeda
0 siblings, 1 reply; 6+ messages in thread
From: lyude @ 2026-01-22 21:34 UTC (permalink / raw)
To: Danilo Krummrich
Cc: linux-kernel, dri-devel, rust-for-linux, Miguel Ojeda,
Simona Vetter, Alice Ryhl, Shankari Anand, David Airlie,
Asahi Lina, Atharv Dubey, Daniel Almeida
On Thu, 2026-01-22 at 21:30 +0100, Danilo Krummrich wrote:
> On Thu Jan 22, 2026 at 9:28 PM CET, Lyude Paul wrote:
> > This is to match
> > https://docs.kernel.org/rust/coding-guidelines.html#imports
> >
> > There should be no functional changes in this patch.
>
> Thanks! While at it, can you please drop imports that are in prelude
> and use
> prelude instead?
Just a random musing - it would actually be quite nice if we could have
some sort of automated style check for this. I have to assume the linux
kernel probably isn't the only project out there with its own prelude…
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust/drm: Fixup import styles
2026-01-22 21:34 ` lyude
@ 2026-01-22 21:52 ` Miguel Ojeda
2026-01-22 23:01 ` Gary Guo
0 siblings, 1 reply; 6+ messages in thread
From: Miguel Ojeda @ 2026-01-22 21:52 UTC (permalink / raw)
To: lyude, Gary Guo
Cc: Danilo Krummrich, linux-kernel, dri-devel, rust-for-linux,
Miguel Ojeda, Simona Vetter, Alice Ryhl, Shankari Anand,
David Airlie, Asahi Lina, Atharv Dubey, Daniel Almeida
On Thu, Jan 22, 2026 at 10:34 PM <lyude@redhat.com> wrote:
>
> Just a random musing - it would actually be quite nice if we could have
> some sort of automated style check for this. I have to assume the linux
> kernel probably isn't the only project out there with its own prelude…
Yeah, that would be quite nice indeed -- we have discussed this a few
times (most recently a couple weeks ago, including whether Klint could
be used for that and for detecting "long import paths", i.e. when we
have a re-export we prefer, but that has edge cases; as well as
related bits like a `klint::moved` annotation -- Cc'ing Gary).
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust/drm: Fixup import styles
2026-01-22 21:52 ` Miguel Ojeda
@ 2026-01-22 23:01 ` Gary Guo
2026-01-23 9:37 ` Miguel Ojeda
0 siblings, 1 reply; 6+ messages in thread
From: Gary Guo @ 2026-01-22 23:01 UTC (permalink / raw)
To: Miguel Ojeda, lyude, Gary Guo
Cc: Danilo Krummrich, linux-kernel, dri-devel, rust-for-linux,
Miguel Ojeda, Simona Vetter, Alice Ryhl, Shankari Anand,
David Airlie, Asahi Lina, Atharv Dubey, Daniel Almeida
On Thu Jan 22, 2026 at 9:52 PM GMT, Miguel Ojeda wrote:
> On Thu, Jan 22, 2026 at 10:34 PM <lyude@redhat.com> wrote:
>>
>> Just a random musing - it would actually be quite nice if we could have
>> some sort of automated style check for this. I have to assume the linux
>> kernel probably isn't the only project out there with its own prelude…
>
> Yeah, that would be quite nice indeed -- we have discussed this a few
> times (most recently a couple weeks ago, including whether Klint could
> be used for that and for detecting "long import paths", i.e. when we
> have a re-export we prefer, but that has edge cases; as well as
> related bits like a `klint::moved` annotation -- Cc'ing Gary).
This is tracked in https://github.com/Rust-for-Linux/klint/issues/5.
Best,
Gary
>
> Cheers,
> Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust/drm: Fixup import styles
2026-01-22 23:01 ` Gary Guo
@ 2026-01-23 9:37 ` Miguel Ojeda
0 siblings, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2026-01-23 9:37 UTC (permalink / raw)
To: Gary Guo
Cc: lyude, Danilo Krummrich, linux-kernel, dri-devel, rust-for-linux,
Miguel Ojeda, Simona Vetter, Alice Ryhl, Shankari Anand,
David Airlie, Asahi Lina, Atharv Dubey, Daniel Almeida
On Fri, Jan 23, 2026 at 6:01 AM Gary Guo <gary@garyguo.net> wrote:
>
> This is tracked in https://github.com/Rust-for-Linux/klint/issues/5.
Linked, thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-01-23 9:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22 20:28 [PATCH] rust/drm: Fixup import styles Lyude Paul
2026-01-22 20:30 ` Danilo Krummrich
2026-01-22 21:34 ` lyude
2026-01-22 21:52 ` Miguel Ojeda
2026-01-22 23:01 ` Gary Guo
2026-01-23 9:37 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox