public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/tyr: Use vertical style for imports
@ 2026-02-23 20:38 Deborah Brouwer
  2026-02-23 23:40 ` Claude review: " Claude Code Review Bot
  2026-02-23 23:40 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Deborah Brouwer @ 2026-02-23 20:38 UTC (permalink / raw)
  To: dri-devel, rust-for-linux
  Cc: daniel.almeida, aliceryhl, boris.brezillon, deborah.brouwer

Currently Tyr uses rustfmt style for imports, but the kernel uses a
vertical layout that makes it easier to resolve conflicts and rebase.

Import guidelines are documented here:
	https://docs.kernel.org/rust/coding-guidelines.html#imports

Change all of Tyr's imports to use the vertical layout. This will
ease the introduction of additional Tyr patches upstream.

There should be no functional changes in this patch.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
---
Changes in v2:
- Add import io::Io import in regs.rs to resolve conflict with v6.19.
- Pick up Reviewed-by tag

Link to v1: https://lore.kernel.org/rust-for-linux/20260204013331.427210-1-deborah.brouwer@collabora.com/

 drivers/gpu/drm/tyr/driver.rs | 62 ++++++++++++++++++++---------------
 drivers/gpu/drm/tyr/file.rs   | 18 ++++++----
 drivers/gpu/drm/tyr/gem.rs    | 13 +++++---
 drivers/gpu/drm/tyr/gpu.rs    | 38 ++++++++++++---------
 drivers/gpu/drm/tyr/regs.rs   | 16 +++++----
 5 files changed, 89 insertions(+), 58 deletions(-)

diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs
index beeffe36b6cb..259a5157eb47 100644
--- a/drivers/gpu/drm/tyr/driver.rs
+++ b/drivers/gpu/drm/tyr/driver.rs
@@ -1,31 +1,41 @@
 // SPDX-License-Identifier: GPL-2.0 or MIT
 
-use kernel::clk::Clk;
-use kernel::clk::OptionalClk;
-use kernel::device::Bound;
-use kernel::device::Core;
-use kernel::device::Device;
-use kernel::devres::Devres;
-use kernel::drm;
-use kernel::drm::ioctl;
-use kernel::io::poll;
-use kernel::new_mutex;
-use kernel::of;
-use kernel::platform;
-use kernel::prelude::*;
-use kernel::regulator;
-use kernel::regulator::Regulator;
-use kernel::sizes::SZ_2M;
-use kernel::sync::aref::ARef;
-use kernel::sync::Arc;
-use kernel::sync::Mutex;
-use kernel::time;
-
-use crate::file::File;
-use crate::gem::TyrObject;
-use crate::gpu;
-use crate::gpu::GpuInfo;
-use crate::regs;
+use kernel::{
+    clk::{
+        Clk,
+        OptionalClk, //
+    },
+    device::{
+        Bound,
+        Core,
+        Device, //
+    },
+    devres::Devres,
+    drm,
+    drm::ioctl,
+    io::poll,
+    new_mutex,
+    of,
+    platform,
+    prelude::*,
+    regulator,
+    regulator::Regulator,
+    sizes::SZ_2M,
+    sync::{
+        aref::ARef,
+        Arc,
+        Mutex, //
+    },
+    time, //
+};
+
+use crate::{
+    file::File,
+    gem::TyrObject,
+    gpu,
+    gpu::GpuInfo,
+    regs, //
+};
 
 pub(crate) type IoMem = kernel::io::mem::IoMem<SZ_2M>;
 
diff --git a/drivers/gpu/drm/tyr/file.rs b/drivers/gpu/drm/tyr/file.rs
index 0ef432947b73..48bff4476d74 100644
--- a/drivers/gpu/drm/tyr/file.rs
+++ b/drivers/gpu/drm/tyr/file.rs
@@ -1,12 +1,16 @@
 // SPDX-License-Identifier: GPL-2.0 or MIT
 
-use kernel::drm;
-use kernel::prelude::*;
-use kernel::uaccess::UserSlice;
-use kernel::uapi;
-
-use crate::driver::TyrDevice;
-use crate::TyrDriver;
+use kernel::{
+    drm,
+    prelude::*,
+    uaccess::UserSlice,
+    uapi, //
+};
+
+use crate::{
+    driver::TyrDevice,
+    TyrDriver, //
+};
 
 #[pin_data]
 pub(crate) struct File {}
diff --git a/drivers/gpu/drm/tyr/gem.rs b/drivers/gpu/drm/tyr/gem.rs
index 1273bf89dbd5..8f2d23e3c093 100644
--- a/drivers/gpu/drm/tyr/gem.rs
+++ b/drivers/gpu/drm/tyr/gem.rs
@@ -1,9 +1,14 @@
 // SPDX-License-Identifier: GPL-2.0 or MIT
 
-use crate::driver::TyrDevice;
-use crate::driver::TyrDriver;
-use kernel::drm::gem;
-use kernel::prelude::*;
+use kernel::{
+    drm::gem,
+    prelude::*, //
+};
+
+use crate::driver::{
+    TyrDevice,
+    TyrDriver, //
+};
 
 /// GEM Object inner driver data
 #[pin_data]
diff --git a/drivers/gpu/drm/tyr/gpu.rs b/drivers/gpu/drm/tyr/gpu.rs
index ca2a6309e760..a88775160f98 100644
--- a/drivers/gpu/drm/tyr/gpu.rs
+++ b/drivers/gpu/drm/tyr/gpu.rs
@@ -1,20 +1,28 @@
 // SPDX-License-Identifier: GPL-2.0 or MIT
 
-use core::ops::Deref;
-use core::ops::DerefMut;
-use kernel::bits::genmask_u32;
-use kernel::device::Bound;
-use kernel::device::Device;
-use kernel::devres::Devres;
-use kernel::io::poll;
-use kernel::platform;
-use kernel::prelude::*;
-use kernel::time::Delta;
-use kernel::transmute::AsBytes;
-use kernel::uapi;
-
-use crate::driver::IoMem;
-use crate::regs;
+use core::ops::{
+    Deref,
+    DerefMut, //
+};
+use kernel::{
+    bits::genmask_u32,
+    device::{
+        Bound,
+        Device, //
+    },
+    devres::Devres,
+    io::poll,
+    platform,
+    prelude::*,
+    time::Delta,
+    transmute::AsBytes,
+    uapi, //
+};
+
+use crate::{
+    driver::IoMem,
+    regs, //
+};
 
 /// Struct containing information that can be queried by userspace. This is read from
 /// the GPU's registers.
diff --git a/drivers/gpu/drm/tyr/regs.rs b/drivers/gpu/drm/tyr/regs.rs
index d3a541cb37c6..611870c2e6af 100644
--- a/drivers/gpu/drm/tyr/regs.rs
+++ b/drivers/gpu/drm/tyr/regs.rs
@@ -7,12 +7,16 @@
 // does.
 #![allow(dead_code)]
 
-use kernel::bits::bit_u32;
-use kernel::device::Bound;
-use kernel::device::Device;
-use kernel::devres::Devres;
-use kernel::io::Io;
-use kernel::prelude::*;
+use kernel::{
+    bits::bit_u32,
+    device::{
+        Bound,
+        Device, //
+    },
+    devres::Devres,
+    io::Io,
+    prelude::*, //
+};
 
 use crate::driver::IoMem;
 
-- 
2.52.0


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

* Claude review: drm/tyr: Use vertical style for imports
  2026-02-23 20:38 [PATCH v2] drm/tyr: Use vertical style for imports Deborah Brouwer
  2026-02-23 23:40 ` Claude review: " Claude Code Review Bot
@ 2026-02-23 23:40 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-02-23 23:40 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/tyr: Use vertical style for imports
Author: Deborah Brouwer <deborah.brouwer@collabora.com>
Patches: 1
Reviewed: 2026-02-24T09:40:14.454293

---

This is a single patch that converts Rust import statements in the Tyr DRM driver from flat/individual `use` statements to grouped vertical layout using nested braces. The motivation is to align with the kernel Rust coding guidelines documented at `docs.kernel.org/rust/coding-guidelines.html#imports`, which recommend the vertical style for easier conflict resolution during rebasing.

The change is purely mechanical and touches only import blocks across five files (`driver.rs`, `file.rs`, `gem.rs`, `gpu.rs`, `regs.rs`). I verified that the set of imported symbols is identical before and after the patch in all five files. No functional change is introduced.

No issues found. The patch is straightforward and correct.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: drm/tyr: Use vertical style for imports
  2026-02-23 20:38 [PATCH v2] drm/tyr: Use vertical style for imports Deborah Brouwer
@ 2026-02-23 23:40 ` Claude Code Review Bot
  2026-02-23 23:40 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-02-23 23:40 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

I compared the old flat imports against the new grouped imports in each of the five files and confirmed they are equivalent — every symbol imported before is still imported after, with no additions or omissions.

The trailing `//` comments on last items within brace groups (e.g., `Mutex, //`) follow the kernel Rust convention to force `rustfmt` to preserve the vertical layout. This is the expected pattern.

> ```
> +use kernel::{
> +    bits::bit_u32,
> +    device::{
> +        Bound,
> +        Device, //
> +    },
> +    devres::Devres,
> +    io::Io,
> +    prelude::*, //
> +};
> ```

The v2 changelog says "Add import io::Io import in regs.rs to resolve conflict with v6.19." Looking at the diff, `io::Io` was already present in the old flat imports for `regs.rs`, so this change just refers to ensuring it wasn't accidentally dropped during the v1 conversion — the v2 result correctly includes it.

In `gem.rs`, the old code had `crate::` imports before `kernel::` imports, which didn't follow the conventional ordering. The new version places `kernel::` before `crate::`, which is an improvement beyond just the grouping style.

No issues found. This is a clean, mechanical style change with no functional impact.

---
Generated by Claude Code Patch Reviewer

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

end of thread, other threads:[~2026-02-23 23:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 20:38 [PATCH v2] drm/tyr: Use vertical style for imports Deborah Brouwer
2026-02-23 23:40 ` Claude review: " Claude Code Review Bot
2026-02-23 23:40 ` Claude Code Review Bot

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