* [PATCH v3 1/2] rust/drm: Fixup import styles
@ 2026-01-23 18:08 Lyude Paul
2026-01-23 18:08 ` [PATCH v3 2/2] rust/drm: Remove imports covered by prelude::* Lyude Paul
0 siblings, 1 reply; 2+ messages in thread
From: Lyude Paul @ 2026-01-23 18:08 UTC (permalink / raw)
To: linux-kernel, dri-devel, rust-for-linux, Danilo Krummrich
Cc: Ewan Chorynski, Miguel Ojeda, Simona Vetter, Alice Ryhl,
Shankari Anand, David Airlie, Asahi Lina, 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>
---
V3:
* Make sure // is on the last import item always (Gary Guo)
rust/kernel/drm/device.rs | 31 ++++++++++++++++++++++++-------
rust/kernel/drm/driver.rs | 12 +++++++++---
rust/kernel/drm/file.rs | 14 +++++++++++---
rust/kernel/drm/gem/mod.rs | 25 ++++++++++++++++++++-----
4 files changed, 64 insertions(+), 18 deletions(-)
diff --git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs
index 3ce8f62a00569..ae123ffece790 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},
- types::Opaque,
+ sync::aref::{
+ ARef,
+ AlwaysRefCounted, //
+ },
+ types::Opaque, //
+};
+use core::{
+ alloc::Layout,
+ mem,
+ ops::Deref,
+ ptr::{
+ self,
+ NonNull, //
+ },
};
-use core::{alloc::Layout, mem, ops::Deref, ptr, ptr::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..24e81afb04f58 100644
--- a/rust/kernel/drm/driver.rs
+++ b/rust/kernel/drm/driver.rs
@@ -5,10 +5,16 @@
//! 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,
+ sync::aref::ARef, //
};
use macros::vtable;
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 [flat|nested] 2+ messages in thread
* [PATCH v3 2/2] rust/drm: Remove imports covered by prelude::*
2026-01-23 18:08 [PATCH v3 1/2] rust/drm: Fixup import styles Lyude Paul
@ 2026-01-23 18:08 ` Lyude Paul
0 siblings, 0 replies; 2+ messages in thread
From: Lyude Paul @ 2026-01-23 18:08 UTC (permalink / raw)
To: linux-kernel, dri-devel, rust-for-linux, Danilo Krummrich
Cc: Ewan Chorynski, Miguel Ojeda, Alice Ryhl, Simona Vetter,
Shankari Anand, David Airlie, Asahi Lina, Atharv Dubey,
Daniel Almeida, Lyude Paul
This just removes any explicit imports of items in files that are already
being pulled in by `use prelude::*;`.
There should be no functional changes in this patch.
Signed-off-by: Lyude Paul <lyude@redhat.com>
---
rust/kernel/drm/device.rs | 5 +----
rust/kernel/drm/driver.rs | 6 +-----
rust/kernel/drm/file.rs | 6 +-----
rust/kernel/drm/gem/mod.rs | 6 +-----
4 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs
index ae123ffece790..629ef0bd1188e 100644
--- a/rust/kernel/drm/device.rs
+++ b/rust/kernel/drm/device.rs
@@ -12,10 +12,7 @@
self,
driver::AllocImpl, //
},
- error::{
- from_err_ptr,
- Result, //
- },
+ error::from_err_ptr,
prelude::*,
sync::aref::{
ARef,
diff --git a/rust/kernel/drm/driver.rs b/rust/kernel/drm/driver.rs
index 24e81afb04f58..2940fece7d59e 100644
--- a/rust/kernel/drm/driver.rs
+++ b/rust/kernel/drm/driver.rs
@@ -9,14 +9,10 @@
device,
devres,
drm,
- error::{
- to_result,
- Result, //
- },
+ error::to_result,
prelude::*,
sync::aref::ARef, //
};
-use macros::vtable;
/// Driver use the GEM memory manager. This should be set for all modern drivers.
pub(crate) const FEAT_GEM: u32 = bindings::drm_driver_feature_DRIVER_GEM;
diff --git a/rust/kernel/drm/file.rs b/rust/kernel/drm/file.rs
index 7dade6dfa1ba2..10160601ce5af 100644
--- a/rust/kernel/drm/file.rs
+++ b/rust/kernel/drm/file.rs
@@ -7,14 +7,10 @@
use crate::{
bindings,
drm,
- error::Result,
prelude::*,
types::Opaque, //
};
-use core::{
- marker::PhantomData,
- pin::Pin, //
-};
+use core::marker::PhantomData;
/// 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 56b7641b1405e..b4199945db378 100644
--- a/rust/kernel/drm/gem/mod.rs
+++ b/rust/kernel/drm/gem/mod.rs
@@ -5,7 +5,6 @@
//! C header: [`include/drm/drm_gem.h`](srctree/include/drm/drm_gem.h)
use crate::{
- alloc::flags::*,
bindings,
drm::{
self,
@@ -14,10 +13,7 @@
AllocOps, //
},
},
- error::{
- to_result,
- Result, //
- },
+ error::to_result,
prelude::*,
sync::aref::{
ARef,
--
2.52.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-23 18:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-23 18:08 [PATCH v3 1/2] rust/drm: Fixup import styles Lyude Paul
2026-01-23 18:08 ` [PATCH v3 2/2] rust/drm: Remove imports covered by prelude::* Lyude Paul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®