Re: [PATCH v10 2/5] rust: support formatting of foreign types

2025-05-27 Thread Benno Lossin
On Tue May 27, 2025 at 5:02 PM CEST, Tamir Duberstein wrote: > On Mon, May 26, 2025 at 7:01 PM Benno Lossin wrote: >> On Tue May 27, 2025 at 12:17 AM CEST, Tamir Duberstein wrote: >> > On Mon, May 26, 2025 at 10:48 AM Benno Lossin wrote: >> >> On Sat May 24

Re: [PATCH v10 5/5] rust: remove core::ffi::CStr reexport

2025-05-26 Thread Benno Lossin
On Tue May 27, 2025 at 12:30 AM CEST, Tamir Duberstein wrote: > On Mon, May 26, 2025 at 11:05 AM Benno Lossin wrote: >> >> On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote: >> > Clean up references to `kernel::str::CStr`. >> > >

Re: [PATCH v10 4/5] rust: replace `kernel::c_str!` with C-Strings

2025-05-26 Thread Benno Lossin
On Tue May 27, 2025 at 12:29 AM CEST, Tamir Duberstein wrote: > On Mon, May 26, 2025 at 11:04 AM Benno Lossin wrote: >> On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote: >> > +macro_rules! c_str_avoid_literals { >> >> I don't like this n

Re: [PATCH v10 3/5] rust: replace `CStr` with `core::ffi::CStr`

2025-05-26 Thread Benno Lossin
On Tue May 27, 2025 at 12:24 AM CEST, Tamir Duberstein wrote: > On Mon, May 26, 2025 at 10:56 AM Benno Lossin wrote: >> >> On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote: >> > `std::ffi::CStr` was moved to `core::ffi::CStr` in Rust 1.64. Replace >> &g

Re: [PATCH v10 2/5] rust: support formatting of foreign types

2025-05-26 Thread Benno Lossin
On Tue May 27, 2025 at 12:17 AM CEST, Tamir Duberstein wrote: > On Mon, May 26, 2025 at 10:48 AM Benno Lossin wrote: >> On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote: >> > Introduce a `fmt!` macro which wraps all arguments in >> > `kernel::fmt::Adapter`

Re: [PATCH v10 5/5] rust: remove core::ffi::CStr reexport

2025-05-26 Thread Benno Lossin
On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote: > Clean up references to `kernel::str::CStr`. > > Signed-off-by: Tamir Duberstein > --- > drivers/gpu/drm/drm_panic_qr.rs | 3 ++- > drivers/gpu/nova-core/firmware.rs | 2 +- > drivers/net/phy/ax88796b_rust.rs | 1 + > drivers/ne

Re: [PATCH v10 4/5] rust: replace `kernel::c_str!` with C-Strings

2025-05-26 Thread Benno Lossin
On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote: > -/// Creates a new [`CStr`] from a string literal. > +/// Creates a static C string wrapper at compile time. > /// > -/// The string literal should not contain any `NUL` bytes. > +/// Rust supports C string literals since Rust 1.77, a

Re: [PATCH v10 3/5] rust: replace `CStr` with `core::ffi::CStr`

2025-05-26 Thread Benno Lossin
On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote: > `std::ffi::CStr` was moved to `core::ffi::CStr` in Rust 1.64. Replace > `kernel::str::CStr` with `core::ffi::CStr` now that we can. What's this supposed to mean? > C-String literals were added in Rust 1.77. Opportunistically replace

Re: [PATCH v10 2/5] rust: support formatting of foreign types

2025-05-26 Thread Benno Lossin
On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote: > Introduce a `fmt!` macro which wraps all arguments in > `kernel::fmt::Adapter` This enables formatting of foreign types (like > `core::ffi::CStr`) that do not implement `fmt::Display` due to concerns > around lossy conversions which do

Re: [PATCH v10 1/5] rust: retitle "Example" section as "Examples"

2025-05-26 Thread Benno Lossin
On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote: > This title is consistent with all other macros' documentation, > regardless of the number of examples contained in their "Examples" > sections. > > Signed-off-by: Tamir Duberstein Reviewed-by: Benno Lossin --- Cheers, Benno

Re: [PATCH v4 02/20] rust: make ETIMEDOUT error available

2025-05-21 Thread Benno Lossin
On Wed May 21, 2025 at 8:44 AM CEST, Alexandre Courbot wrote: > We will use this error in the nova-core driver. > > Signed-off-by: Alexandre Courbot > --- > rust/kernel/error.rs | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Benno Lossin --- Cheers, Benno

Re: [PATCH v8 6/6] rust: enable `clippy::ref_as_ptr` lint

2025-04-14 Thread Benno Lossin
> conversions easier to scrutinize. It also has the slight benefit of > removing a degree of freedom on which to bikeshed. Thus apply the > changes and enable the lint -- no functional change intended. > > Link: https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr [1

Re: [PATCH v7 7/7] rust: enable `clippy::ref_as_ptr` lint

2025-03-27 Thread Benno Lossin
On Thu Mar 27, 2025 at 8:44 PM CET, Tamir Duberstein wrote: > On Thu, Mar 27, 2025 at 10:15 AM Tamir Duberstein wrote: >> On Wed, Mar 26, 2025 at 6:15 PM Benno Lossin wrote: >> > On Wed Mar 26, 2025 at 11:09 PM CET, Tamir Duberstein wrote: >> > > On Wed, Mar 26

Re: [PATCH v7 7/7] rust: enable `clippy::ref_as_ptr` lint

2025-03-26 Thread Benno Lossin
On Wed Mar 26, 2025 at 11:09 PM CET, Tamir Duberstein wrote: > On Wed, Mar 26, 2025 at 5:09 PM Benno Lossin wrote: >> On Wed Mar 26, 2025 at 8:06 PM CET, Tamir Duberstein wrote: >> > On Wed, Mar 26, 2025 at 1:36 PM Benno Lossin >> > wrote: >> >> On

Re: [PATCH v7 7/7] rust: enable `clippy::ref_as_ptr` lint

2025-03-26 Thread Benno Lossin
On Wed Mar 26, 2025 at 8:06 PM CET, Tamir Duberstein wrote: > On Wed, Mar 26, 2025 at 1:36 PM Benno Lossin wrote: >> On Wed Mar 26, 2025 at 5:57 PM CET, Tamir Duberstein wrote: >> > In the current code you're looking at, yes. But in the code I have >> > locally

Re: [PATCH v7 7/7] rust: enable `clippy::ref_as_ptr` lint

2025-03-26 Thread Benno Lossin
On Wed Mar 26, 2025 at 5:57 PM CET, Tamir Duberstein wrote: > On Wed, Mar 26, 2025 at 12:43 PM Benno Lossin wrote: >> On Wed Mar 26, 2025 at 11:35 AM CET, Tamir Duberstein wrote: >> > On Wed, Mar 26, 2025 at 6:31 AM Benno Lossin >> > wrote: >> >> On

Re: [PATCH v7 7/7] rust: enable `clippy::ref_as_ptr` lint

2025-03-26 Thread Benno Lossin
On Wed Mar 26, 2025 at 11:35 AM CET, Tamir Duberstein wrote: > On Wed, Mar 26, 2025 at 6:31 AM Benno Lossin wrote: >> On Wed Mar 26, 2025 at 12:54 AM CET, Tamir Duberstein wrote: >> > On Tue, Mar 25, 2025 at 6:40 PM Benno Lossin >> > wrote: >> >> On

Re: [PATCH v7 7/7] rust: enable `clippy::ref_as_ptr` lint

2025-03-26 Thread Benno Lossin
On Wed Mar 26, 2025 at 12:54 AM CET, Tamir Duberstein wrote: > On Tue, Mar 25, 2025 at 6:40 PM Benno Lossin wrote: >> On Tue Mar 25, 2025 at 11:33 PM CET, Tamir Duberstein wrote: >> > On Tue, Mar 25, 2025 at 6:11 PM Benno Lossin >> > wrote: >> >> On

Re: [PATCH v7 7/7] rust: enable `clippy::ref_as_ptr` lint

2025-03-25 Thread Benno Lossin
On Tue Mar 25, 2025 at 11:33 PM CET, Tamir Duberstein wrote: > On Tue, Mar 25, 2025 at 6:11 PM Benno Lossin wrote: >> >> On Tue Mar 25, 2025 at 9:07 PM CET, Tamir Duberstein wrote: >> > diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs >> > index 40034f77fc2

Re: [PATCH v7 7/7] rust: enable `clippy::ref_as_ptr` lint

2025-03-25 Thread Benno Lossin
On Tue Mar 25, 2025 at 9:07 PM CET, Tamir Duberstein wrote: > diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs > index 40034f77fc2f..6233af50bab7 100644 > --- a/rust/kernel/str.rs > +++ b/rust/kernel/str.rs > @@ -29,7 +29,7 @@ pub const fn is_empty(&self) -> bool { > #[inline] > pub c

Re: [PATCH v6 6/6] rust: enable `clippy::cast_lossless` lint

2025-03-25 Thread Benno Lossin
ust-lang.github.io/rust-clippy/master/index.html#cast_lossless > [1] > Suggested-by: Benno Lossin > Link: https://lore.kernel.org/all/d8ortxsutkgl.1kojagbm8f...@proton.me/ > Signed-off-by: Tamir Duberstein One nit below, but you may add: Reviewed-by: Benno Lossin > --- > Makefile

Re: [PATCH 2/2] rust: drm: Add GPUVM abstraction

2025-03-24 Thread Benno Lossin
On Mon Mar 24, 2025 at 8:25 PM CET, Daniel Almeida wrote: >> On 24 Mar 2025, at 14:36, Miguel Ojeda >> wrote: >> >> Hi Daniel, >> >> A few quick notes for future versions on style/docs to try to keep >> things consistent upstream -- not an actual review. >> >> On Mon, Mar 24, 2025 at 4:14 PM D

Re: [PATCH v2 2/3] rust: alloc: add Vec::resize method

2025-03-19 Thread Benno Lossin
On Wed Mar 19, 2025 at 2:42 PM CET, Tamir Duberstein wrote: > On Tue, Mar 18, 2025 at 8:50 PM Benno Lossin wrote: >> >> On Tue Mar 18, 2025 at 9:12 PM CET, Tamir Duberstein wrote: >> > On Sun, Mar 16, 2025 at 7:17 AM Andrew Ballance >> > wrote: >> >>

Re: [PATCH v2 2/3] rust: alloc: add Vec::resize method

2025-03-18 Thread Benno Lossin
On Tue Mar 18, 2025 at 9:12 PM CET, Tamir Duberstein wrote: > On Sun, Mar 16, 2025 at 7:17 AM Andrew Ballance > wrote: >> +pub fn resize(&mut self, new_len: usize, value: T, flags: Flags) -> >> Result<(), AllocError> { >> +if new_len > self.len() { >> +self.extend_with(new

Re: [PATCH v2 2/3] rust: alloc: add Vec::resize method

2025-03-16 Thread Benno Lossin
On Sun Mar 16, 2025 at 12:16 PM CET, Andrew Ballance wrote: > implement the equivalent of the rust std's Vec::resize > on the kernel's Vec type. > > Signed-off-by: Andrew Ballance Reviewed-by: Benno Lossin --- Cheers, Benno > --- > ru

Re: [PATCH 1/3] rust: alloc: add Vec::truncate method

2025-03-15 Thread Benno Lossin
On Sat Mar 15, 2025 at 12:15 PM CET, Andrew Ballance wrote: > On Sat, Mar 15, 2025 at 10:09:26AM +0000, Benno Lossin wrote: >> On Sat Mar 15, 2025 at 3:42 AM CET, Andrew Ballance wrote: >> > implements the equivalent to the std's Vec::truncate >> > on the kernel

Re: [PATCH 2/3] rust: alloc: add Vec::resize method

2025-03-15 Thread Benno Lossin
On Sat Mar 15, 2025 at 3:42 AM CET, Andrew Ballance wrote: > implemnts the equivalent of the rust std's Vec::resize > on the kernel's Vec type. > > Signed-off-by: Andrew Ballance Reviewed-by: Benno Lossin --- Cheers, Benno > --- > rust/kernel/alloc/kvec.rs | 25 ++

Re: [PATCH 1/3] rust: alloc: add Vec::truncate method

2025-03-15 Thread Benno Lossin
On Sat Mar 15, 2025 at 3:42 AM CET, Andrew Ballance wrote: > implements the equivalent to the std's Vec::truncate > on the kernel's Vec type. > > Signed-off-by: Andrew Ballance > --- > rust/kernel/alloc/kvec.rs | 36 > 1 file changed, 36 insertions(+) > > diff

Re: [PATCH RFC 0/3] Initial work for Rust abstraction for HID device driver development

2025-03-13 Thread Benno Lossin
On Thu Mar 13, 2025 at 5:02 PM CET, Rahul Rameshbabu wrote: > Hello, > > I am a hobbyist developer who has been working on a project to create a new > Rust > HID device driver and the needed core abstractions for writing more HID device > drivers in Rust. My goal is to support the USB Monitor Cont

Re: [PATCH v5 3/5] rust: firmware: add `module_firmware!` macro

2025-03-05 Thread Benno Lossin
On Thu Mar 6, 2025 at 2:38 AM CET, Danilo Krummrich wrote: > On Thu, Mar 06, 2025 at 01:27:19AM +0000, Benno Lossin wrote: >> On Thu Mar 6, 2025 at 2:04 AM CET, Danilo Krummrich wrote: >> > On Thu, Mar 06, 2025 at 12:31:14AM +, Benno Lossin wrote: >> >> On

Re: [PATCH v5 2/5] rust: firmware: introduce `firmware::ModInfoBuilder`

2025-03-05 Thread Benno Lossin
On Thu Mar 6, 2025 at 2:29 AM CET, Danilo Krummrich wrote: > On Thu, Mar 06, 2025 at 12:24:21AM +0000, Benno Lossin wrote: >> On Thu Mar 6, 2025 at 12:57 AM CET, Danilo Krummrich wrote: >> > On Wed, Mar 05, 2025 at 11:36:54PM +, Benno Lossin wrote: >> >> On W

Re: [PATCH v5 3/5] rust: firmware: add `module_firmware!` macro

2025-03-05 Thread Benno Lossin
On Thu Mar 6, 2025 at 2:04 AM CET, Danilo Krummrich wrote: > On Thu, Mar 06, 2025 at 12:31:14AM +0000, Benno Lossin wrote: >> On Tue Mar 4, 2025 at 6:34 PM CET, Danilo Krummrich wrote: >> >> > +#[macro_export] >> > +macro_rules! module_firmware { >> > +

Re: [PATCH v5 3/5] rust: firmware: add `module_firmware!` macro

2025-03-05 Thread Benno Lossin
On Tue Mar 4, 2025 at 6:34 PM CET, Danilo Krummrich wrote: > Analogous to the `module!` macro `module_firmware!` adds additional > firmware path strings to the .modinfo section. > > In contrast to `module!`, where path strings need to be string literals, > path strings can be composed with the `fir

Re: [PATCH v5 2/5] rust: firmware: introduce `firmware::ModInfoBuilder`

2025-03-05 Thread Benno Lossin
On Thu Mar 6, 2025 at 12:57 AM CET, Danilo Krummrich wrote: > On Wed, Mar 05, 2025 at 11:36:54PM +0000, Benno Lossin wrote: >> On Wed Mar 5, 2025 at 11:38 PM CET, Danilo Krummrich wrote: >> > On Wed, Mar 05, 2025 at 10:30:31PM +, Benno Lossin wrote: >> >> On

Re: [PATCH v5 2/5] rust: firmware: introduce `firmware::ModInfoBuilder`

2025-03-05 Thread Benno Lossin
On Wed Mar 5, 2025 at 11:38 PM CET, Danilo Krummrich wrote: > On Wed, Mar 05, 2025 at 10:30:31PM +0000, Benno Lossin wrote: >> On Tue Mar 4, 2025 at 6:34 PM CET, Danilo Krummrich wrote: >> > +/// Push an additional path component. >> > +/// >> > +

Re: [PATCH v5 2/5] rust: firmware: introduce `firmware::ModInfoBuilder`

2025-03-05 Thread Benno Lossin
On Tue Mar 4, 2025 at 6:34 PM CET, Danilo Krummrich wrote: > The `firmware` field of the `module!` only accepts literal strings, > which is due to the fact that it is implemented as a proc macro. > > Some drivers require a lot of firmware files (such as nova-core) and > hence benefit from more flex

Re: [PATCH v3 2/2] gpu: nova-core: add initial documentation

2025-02-12 Thread Benno Lossin
On 13.02.25 00:27, Alistair Popple wrote: > On Sun, Feb 09, 2025 at 06:30:25PM +0100, Danilo Krummrich wrote: > > [...] > >> +FromPrimitive API >> +- >> + >> +Sometimes the need arises to convert a number to a value of an enum or a >> +structure. >> + >> +A good example from nova-

Re: [PATCH 1/4] WIP: rust: Add basic KMS bindings

2024-04-25 Thread Benno Lossin
On 22.04.24 03:47, Lyude Paul wrote: > On Wed, 2024-03-27 at 20:50 +0000, Benno Lossin wrote: >> Hi, >> >> I just took a quick look and commented on the things that stuck >> out to me. Some general things: >> - several `unsafe` blocks have missing SAFETY comment

Re: [PATCH 2/4] WIP: drm: Introduce rvkms

2024-04-25 Thread Benno Lossin
On 22.04.24 03:54, Lyude Paul wrote: > On Wed, 2024-03-27 at 21:06 +0000, Benno Lossin wrote: >> On 22.03.24 23:03, Lyude Paul wrote: >>> + >>> +pub(crate) type Connector = connector::Connector; >>> + >>> +impl connector::DriverConnector for Drive

Re: [PATCH 1/4] WIP: rust: Add basic KMS bindings

2024-03-28 Thread Benno Lossin
Hi, I just took a quick look and commented on the things that stuck out to me. Some general things: - several `unsafe` blocks have missing SAFETY comments, - missing documentation and examples. On 22.03.24 23:03, Lyude Paul wrote: > Signed-off-by: Lyude Paul > --- > rust/bindings/bindings_helpe

Re: [PATCH 2/4] WIP: drm: Introduce rvkms

2024-03-28 Thread Benno Lossin
On 22.03.24 23:03, Lyude Paul wrote: > diff --git a/drivers/gpu/drm/rvkms/connector.rs > b/drivers/gpu/drm/rvkms/connector.rs > new file mode 100644 > index 0..40f84d38437ee > --- /dev/null > +++ b/drivers/gpu/drm/rvkms/connector.rs > @@ -0,0 +1,55 @@ > +// TODO: License and stuff > +/