rust: auxiliary: use "kernel vertical" style for imports
Subsystems (4)
Danilo Krummrich
maintainerPATCH 1/5 rust: auxiliary: use "kernel vertical" style for imports
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
--- rust/kernel/auxiliary.rs | 21 ++++++++++++++++----- samples/rust/rust_driver_auxiliary.rs | 8 +++++--- 2 files changed, 21 insertions(+), 8 deletions(-)
rust/kernel/auxiliary.rs +16 -5
@@ -5,19 +5,30 @@//! C header: [`include/linux/auxiliary_bus.h`](srctree/include/linux/auxiliary_bus.h) use crate ::{ - bindings, container_of, device, - device_id::{RawDeviceId ,RawDeviceIdIndex }, + bindings, + container_of, + device, + device_id::{ +RawDeviceId , +RawDeviceIdIndex ,// + }, devres::Devres , driver, - error::{from_result, to_result,Result }, + error::{ + from_result, + to_result,// + }, prelude::*, types::Opaque , -ThisModule , +ThisModule ,// };use core::{ marker::PhantomData , mem::offset_of, - ptr::{addr_of_mut,NonNull }, + ptr::{ + addr_of_mut, +NonNull ,// + }, };/// An adapter for the registration of auxiliary drivers.
samples/rust/rust_driver_auxiliary.rs +5 -3
@@ -6,13 +6,15 @@use kernel::{ auxiliary, - device::{Bound ,Core }, + device::{ +Bound , +Core ,// + }, devres::Devres , driver, - error::Error , pci, prelude::*, -InPlaceModule , +InPlaceModule ,// };use core::any::TypeId ;
base-commit: 7bf97992afa4e815f4ed84638340e2a93de65504
Signature · 1 line
2.52.0
Danilo Krummrich
maintainerPATCH 2/5 rust: platform: use "kernel vertical" style for imports
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
--- rust/kernel/platform.rs | 31 +++++++++++++++++++++------- samples/rust/rust_driver_platform.rs | 10 ++++++--- 2 files changed, 31 insertions(+), 10 deletions(-)
rust/kernel/platform.rs +24 -7
@@ -5,22 +5,39 @@//! C header: [`include/linux/platform_device.h`](srctree/include/linux/platform_device.h) use crate ::{ - acpi, bindings, container_of, - device::{self,Bound }, + acpi, + bindings, + container_of, + device::{ + self, +Bound ,// + }, driver, - error::{from_result, to_result,Result }, - io::{mem::IoRequest ,Resource }, - irq::{self,IrqRequest }, + error::{ + from_result, + to_result,// + }, + io::{ + mem::IoRequest , +Resource ,// + }, + irq::{ + self, +IrqRequest ,// + }, of, prelude::*, types::Opaque , -ThisModule , +ThisModule ,// };use core::{ marker::PhantomData , mem::offset_of, - ptr::{addr_of_mut,NonNull }, + ptr::{ + addr_of_mut, +NonNull ,// + }, };/// An adapter for the registration of platform drivers.
samples/rust/rust_driver_platform.rs +7 -3
@@ -66,13 +66,17 @@ acpi, device::{ self, - property::{FwNodeReferenceArgs, NArgs}, + property::{ + FwNodeReferenceArgs, + NArgs, // + }, Core, }, - of, platform, + of, + platform, prelude::*, str::CString, - sync::aref::ARef, + sync::aref::ARef, // };struct SampleDriver {
Signature · 1 line
2.52.0
Re: [PATCH 2/5] rust: platform: use "kernel vertical" style for imports
Quoted 9 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
Danilo Krummrich
maintainerRe: [PATCH 2/5] rust: platform: use "kernel vertical" style for imports
In reply to Danilo KrummrichQuoted 9 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
Applied to driver-core-testing, thanks!
Danilo Krummrich
maintainerPATCH 3/5 rust: driver-core: use "kernel vertical" style for imports
In reply to Danilo KrummrichConvert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
--- rust/kernel/device.rs | 14 +++++++++++--- rust/kernel/devres.rs | 25 +++++++++++++++++++------ rust/kernel/driver.rs | 12 ++++++++---- 3 files changed, 38 insertions(+), 13 deletions(-)
rust/kernel/device.rs +11 -3
@@ -5,12 +5,20 @@//! C header: [`include/linux/device.h`](srctree/include/linux/device.h) use crate ::{ - bindings, fmt, + bindings, + fmt, prelude::*, sync::aref::ARef , - types::{ForeignOwnable ,Opaque }, + types::{ +ForeignOwnable , +Opaque ,// + },// +}; +use core::{ + any::TypeId , + marker::PhantomData , + ptr,// }; -use core::{any::TypeId , marker::PhantomData , ptr};use crate ::str::CStrExt as _;
rust/kernel/devres.rs +19 -6
@@ -8,13 +8,26 @@use crate ::{ alloc::Flags , bindings, - device::{Bound ,Device }, - error::{to_result,Error ,Result }, - ffi::c_void, + device::{ +Bound , +Device ,// + }, + error::to_result, prelude::*, - revocable::{Revocable ,RevocableGuard }, - sync::{aref::ARef , rcu,Completion }, - types::{ForeignOwnable ,Opaque ,ScopeGuard }, + revocable::{ +Revocable , +RevocableGuard ,// + }, + sync::{ + aref::ARef , + rcu, +Completion ,// + }, + types::{ +ForeignOwnable , +Opaque , +ScopeGuard ,// + }, };use pin_init::Wrapper ;
rust/kernel/driver.rs +8 -4
@@ -90,10 +90,14 @@//! [`pci::Driver`]: kernel::pci::Driver //! [`platform::Driver`]: kernel::platform::Driver -use crate ::error::{Error ,Result }; -use crate ::{acpi, device, of, str::CStr , try_pin_init, types::Opaque ,ThisModule }; -use core::pin::Pin ; -use pin_init::{pin_data, pinned_drop,PinInit }; +use crate ::{ + acpi, + device, + of, + prelude::*, + types::Opaque , +ThisModule ,// +};/// The [`RegistrationOps`] trait serves as generic interface for subsystems (e.g., PCI, Platform, /// Amba, etc.) to provide the corresponding subsystem specific implementation to register /
Signature · 1 line
2.52.0
Re: [PATCH 3/5] rust: driver-core: use "kernel vertical" style for imports
Quoted 9 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
Danilo Krummrich
maintainerRe: [PATCH 3/5] rust: driver-core: use "kernel vertical" style for imports
In reply to Danilo KrummrichQuoted 9 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
Applied to driver-core-testing, thanks!
Danilo Krummrich
maintainerPATCH 4/5 rust: usb: use "kernel vertical" style for imports
In reply to Danilo KrummrichConvert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
---
@Greg: If you agree I will take this through the driver-core tree. I will have driver-core patches building on top of this.
--- rust/kernel/usb.rs | 21 +++++++++++++++------ samples/rust/rust_driver_usb.rs | 10 +++++++++- 2 files changed, 24 insertions(+), 7 deletions(-)
rust/kernel/usb.rs +15 -6
@@ -6,14 +6,23 @@//! C header: [`include/linux/usb.h`](srctree/include/linux/usb.h) use crate ::{ - bindings, device, - device_id::{RawDeviceId ,RawDeviceIdIndex }, + bindings, + device, + device_id::{ +RawDeviceId , +RawDeviceIdIndex ,// + }, driver, - error::{from_result, to_result,Result }, + error::{ + from_result, + to_result,// + }, prelude::*, - str::CStr , - types::{AlwaysRefCounted ,Opaque }, -ThisModule , + types::{ +AlwaysRefCounted , +Opaque ,// + }, +ThisModule ,// };use core::{ marker::PhantomData ,
samples/rust/rust_driver_usb.rs +9 -1
@@ -3,7 +3,15 @@//! Rust USB driver sample. -use kernel::{device, device::Core , prelude::*, sync::aref::ARef , usb}; +use kernel::{ + device::{ + self, +Core ,// + }, + prelude::*, + sync::aref::ARef , + usb,// +};struct SampleDriver { _intf:ARef <usb::Interface >,
Signature · 1 line
2.52.0
Re: [PATCH 4/5] rust: usb: use "kernel vertical" style for imports
Quoted 80 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
Signed-off-by Danilo Krummrich <[email protected]>---
@Greg: If you agree I will take this through the driver-core tree. I will have driver-core patches building on top of this.
---rust/kernel/usb.rs| 21 +++++++++++++++------samples/rust/rust_driver_usb.rs| 10 +++++++++-2 files changed, 24 insertions(+), 7 deletions(-)rust/kernel/usb.rs +15
-6@@ -6,14 +6,23 @@//! C header: [`include/linux/usb.h`](srctree/include/linux/usb.h) use crate ::{ - bindings, device, - device_id::{RawDeviceId ,RawDeviceIdIndex }, + bindings, + device, + device_id::{ +RawDeviceId , +RawDeviceIdIndex ,// + }, driver, - error::{from_result, to_result,Result }, + error::{ + from_result, + to_result,// + }, prelude::*, - str::CStr , - types::{AlwaysRefCounted ,Opaque }, -ThisModule , + types::{ +AlwaysRefCounted , +Opaque ,// + }, +ThisModule ,// };use core::{ marker::PhantomData ,samples/rust/rust_driver_usb.rs +9
-1@@ -3,7 +3,15 @@//! Rust USB driver sample. -use kernel::{device, device::Core , prelude::*, sync::aref::ARef , usb}; +use kernel::{ + device::{ + self, +Core ,// + }, + prelude::*, + sync::aref::ARef , + usb,// +};struct SampleDriver { _intf:ARef <usb::Interface >,Signature · 1 line
2.52.0
OOC: can rustfmt do this, or is it a manual process for the time being?
Re: [PATCH 4/5] rust: usb: use "kernel vertical" style for imports
Quoted 2 lines · Daniel Almeida
OOC: can rustfmt do this, or is it a manual process for the time being?
It does it if you add the //, but adding the // is manual, i.e. it will do what you want but you have to trigger it by having the //:
https://docs.kernel.org/rust/coding-guidelines.html#imports
The goal is that rustfmt does exactly this, but without having to write the // (and without needing/adding the // itself).
I hope that helps!
Cheers,
Miguel
Danilo Krummrich
maintainerRe: [PATCH 4/5] rust: usb: use "kernel vertical" style for imports
In reply to Danilo KrummrichQuoted 5 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
Quoted 7 lines
While at it, drop unnecessary imports covered by prelude::*.
Signed-off-by Danilo Krummrich <[email protected]>---
@Greg: If you agree I will take this through the driver-core tree. I will have driver-core patches building on top of this.
Nevermind, I don't need it in the driver-core tree after all. :)
Greg KH
maintainerRe: [PATCH 4/5] rust: usb: use "kernel vertical" style for imports
Quoted 8 lines · Danilo Krummrich
Quoted 7 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Danilo Krummrich <[email protected]>---
@Greg: If you agree I will take this through the driver-core tree. I will have driver-core patches building on top of this.Nevermind, I don't need it in the driver-core tree after all. :)
Ok, I'll take it through the usb one now, thanks.
greg k-h
Danilo Krummrich
maintainerPATCH 5/5 rust: faux: use "kernel vertical" style for imports
In reply to Danilo KrummrichConvert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
--- rust/kernel/faux.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
rust/kernel/faux.rs +11 -2
@@ -6,8 +6,17 @@//! //! C header: [`include/linux/device/faux.h`](srctree/include/linux/device/faux.h) -use crate ::{bindings, device, error::code::*, prelude::*}; -use core::ptr::{addr_of_mut, null, null_mut,NonNull }; +use crate ::{ + bindings, + device, + prelude::*,// +}; +use core::ptr::{ + addr_of_mut, + null, + null_mut, +NonNull ,// +};/// The registration of a faux device. ///
Signature · 1 line
2.52.0
Re: [PATCH 5/5] rust: faux: use "kernel vertical" style for imports
Quoted 40 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
Signed-off-by Danilo Krummrich <[email protected]>--- rust/kernel/faux.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)rust/kernel/faux.rs +11
-2@@ -6,8 +6,17 @@//! //! C header: [`include/linux/device/faux.h`](srctree/include/linux/device/faux.h) -use crate ::{bindings, device, error::code::*, prelude::*}; -use core::ptr::{addr_of_mut, null, null_mut,NonNull }; +use crate ::{ + bindings, + device, + prelude::*,// +}; +use core::ptr::{ + addr_of_mut, + null, + null_mut, +NonNull ,// +};/// The registration of a faux device. /// Signature · 1 line
2.52.0
Danilo Krummrich
maintainerRe: [PATCH 5/5] rust: faux: use "kernel vertical" style for imports
In reply to Danilo KrummrichQuoted 9 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
Applied to driver-core-testing, thanks!
Quoted 5 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
Quoted 8 lines
While at it, drop unnecessary imports covered by prelude::*.
Signed-off-by Danilo Krummrich <[email protected]>--- rust/kernel/auxiliary.rs | 21 ++++++++++++++++----- samples/rust/rust_driver_auxiliary.rs | 8 +++++--- 2 files changed, 21 insertions(+), 8 deletions(-)
Danilo Krummrich
maintainerQuoted 9 lines · Danilo Krummrich
Convert all imports to use "kernel vertical" style.
With this, subsequent patches neither introduce unrelated changes nor leave an inconsistent import pattern.
While at it, drop unnecessary imports covered by prelude::*.
Applied to driver-core-testing, thanks!