On Tue, Mar 25, 2025 at 6:40 AM Benno Lossin wrote:
>
> On Mon Mar 24, 2025 at 11:01 PM CET, Tamir Duberstein wrote:
> > Before Rust 1.29.0, Clippy introduced the `cast_lossless` lint [1]:
> >
> >> Rust’s `as` keyword will perform many kinds of conversions, in
us apply the
changes and enable the lint -- no functional change intended.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#as_underscore
[1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/kernel/block/mq/operati
x27;t missed. The first commit reduces the need for
pointer casts and is shared with another series[1].
As a late addition, `clippy::cast_lossless` is also enabled.
Link:
https://lore.kernel.org/all/20250307-no-offset-v1-0-0c728f63b...@gmail.com/ [1]
Signed-off-by: Tamir Duberstein
---
Changes
` is replaced with `let *mut *const T = (*mut *mut
T)`.cast();` since pointer to pointer can be confusing.
Apply these changes and enable the lint -- no functional change
intended.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_as_ptr [1]
Reviewed-by: Benno Lossin
Si
example of this was in the macro's own doctest.
Reviewed-by: Benno Lossin
Reviewed-by: Alice Ryhl
Signed-off-by: Tamir Duberstein
---
rust/kernel/lib.rs | 5 ++---
rust/kernel/pci.rs | 2 +-
rust/kernel/platform.rs | 2 +-
rust/kernel/rbtree.rs | 23 ++-
4
d8ortxsutkgl.1kojagbm8f...@proton.me/
Signed-off-by: Tamir Duberstein
---
Makefile| 1 +
drivers/gpu/drm/drm_panic_qr.rs | 10 +-
rust/bindings/lib.rs| 2 +-
rust/kernel/net/phy.rs | 4 ++--
4 files changed, 9 insertions(+), 8 deletions(-)
tml#as_ptr_cast_mut
[1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/kernel/devres.rs | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index c62bae2b107b..bb15b86182a3 100644
--- a/Makefile
+++ b/Makefile
@@
er/index.html#ptr_cast_constness [1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile| 1 +
rust/kernel/block/mq/request.rs | 5 +++--
rust/kernel/dma.rs | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Makefile b/M
C-String literals were added in Rust 1.77. Replace instances of
`kernel::c_str!` with C-String literals where possible and rename
`kernel::c_str!` to `c_str_avoid_literals` to clarify its intended use.
Closes: https://github.com/Rust-for-Linux/linux/issues/1075
Signed-off-by: Tamir Duberstein
Clean up references to `kernel::str::CStr`.
Signed-off-by: Tamir Duberstein
---
drivers/gpu/drm/drm_panic_qr.rs | 4 ++--
drivers/net/phy/ax88796b_rust.rs | 1 +
drivers/net/phy/qt2025.rs| 1 +
rust/kernel/device.rs| 3 +--
rust/kernel/driver.rs| 4
inux/linux/issues/1075
Signed-off-by: Tamir Duberstein
---
Changes in v9:
- Rebase on rust-next.
- Restore `impl Display for BStr` which exists upstream[1].
- Link:
https://doc.rust-lang.org/nightly/std/bstr/struct.ByteStr.html#impl-Display-for-ByteStr
[1]
- Link to v8:
https://lore.kernel.org/r/202
On Wed, Mar 19, 2025 at 12:06 PM Miguel Ojeda
wrote:
>
> On Wed, Mar 19, 2025 at 4:59 PM Tamir Duberstein wrote:
> >
> > If we're talking about the same thing then I think we're both wrong
> > and the correct phrasing would have been: "yo
On Wed, Mar 19, 2025 at 12:43 PM Miguel Ojeda
wrote:
>
> On Wed, Mar 19, 2025 at 5:13 PM Tamir Duberstein wrote:
> >
> > No, I meant avoiding the check. The existing code already explicitly
> > checks `new_len > self.len()` before evaluating `new_len -
> >
Some(n) => self.extend_with(n, value, flags),
None => {
self.truncate(new_len);
Ok(())
}
}
> }
>
> impl Drop for Vec
> --
> 2.48.1
>
>
Either way:
Reviewed-by: Tamir Duberstein
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 Tue Mar 25, 2025 at 9:07 PM CET, Tamir Duberstein wrote:
> >> > dif
` is replaced with `let *mut *const T = (*mut *mut
T)`.cast();` since pointer to pointer can be confusing.
Apply these changes and enable the lint -- no functional change
intended.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_as_ptr [1]
Reviewed-by: Benno Lossin
Si
example of this was in the macro's own doctest.
Reviewed-by: Benno Lossin
Reviewed-by: Alice Ryhl
Signed-off-by: Tamir Duberstein
---
rust/kernel/lib.rs | 5 ++---
rust/kernel/pci.rs | 2 +-
rust/kernel/platform.rs | 2 +-
rust/kernel/rbtree.rs | 23 ++-
4
d-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/bindings/lib.rs | 1 +
rust/kernel/device_id.rs | 3 ++-
rust/kernel/fs/file.rs | 3 ++-
rust/kernel/str.rs | 4 ++--
rust/kernel/uaccess.rs | 5 +++--
rust/uapi/lib.rs | 1 +
7 files changed, 12 insertio
sage.
- Added additional patches, converted to series.
- Link to v1:
https://lore.kernel.org/r/20250307-ptr-as-ptr-v1-1-582d06514...@gmail.com
---
Tamir Duberstein (7):
rust: retain pointer mut-ness in `container_of!`
rust: enable `clippy::ptr_as_ptr` lint
rust: e
tml#as_ptr_cast_mut
[1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/kernel/devres.rs | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index c62bae2b107b..bb15b86182a3 100644
--- a/Makefile
+++ b/Makefile
@@
er/index.html#ptr_cast_constness [1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile| 1 +
rust/kernel/block/mq/request.rs | 5 +++--
rust/kernel/dma.rs | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Makefile b/M
us apply the
changes and enable the lint -- no functional change intended.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#as_underscore
[1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/kernel/block/mq/operati
d8ortxsutkgl.1kojagbm8f...@proton.me/
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile| 1 +
drivers/gpu/drm/drm_panic_qr.rs | 10 +-
rust/bindings/lib.rs| 1 +
rust/kernel/net/phy.rs | 4 ++--
rust/uapi/lib.rs
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 40034f77fc2f..6233af50bab7 100644
> > --- a/rust/kernel/str.rs
> > +++ b/rust/ke
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 Tue Mar 25, 2025 at 11:33 PM CET, Tamir Duberstein wrote:
> >> > On Tue, Mar
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 Wed Mar 26, 2025 at 12:54 AM CET, Tamir Duberstein wrote:
> >> > On Tue, Mar
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 Wed Mar 26, 2025 at 5:57 PM CET, Tamir Duberstein wrote:
> >> > In the current co
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 I'm transmuting `[u8]` to `BStr`. See my earlier
On Wed, Mar 26, 2025 at 3:06 PM 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. Bu
On Tue, Mar 25, 2025 at 4:23 PM Miguel Ojeda
wrote:
>
> On Tue, Mar 25, 2025 at 9:07 PM Tamir Duberstein wrote:
> >
> > Changes in v7:
> > - Add patch to enable `clippy::ref_as_ptr`.
> > - Link to v6:
> > https://lore.kernel.org/r/20250324-ptr-as-ptr-v6-0-49
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, 2025 at 5:09 PM Benno Lossin
> > > wrote:
> > &g
tml#as_ptr_cast_mut
[1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/kernel/devres.rs | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 7b85b2a8d371..04a5246171f9 100644
--- a/Makefile
+++ b/Makefile
@@
` is replaced with `let *mut *const T = (*mut *mut
T)`.cast();` since pointer to pointer can be confusing.
Apply these changes and enable the lint -- no functional change
intended.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_as_ptr [1]
Reviewed-by: Benno Lossin
Si
us apply the
changes and enable the lint -- no functional change intended.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#as_underscore
[1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/kernel/block/mq/operati
d8ortxsutkgl.1kojagbm8f...@proton.me/
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile| 1 +
drivers/gpu/drm/drm_panic_qr.rs | 2 +-
rust/bindings/lib.rs| 1 +
rust/kernel/net/phy.rs | 4 ++--
rust/uapi/lib.rs|
eries.
- Link to v1:
https://lore.kernel.org/r/20250307-ptr-as-ptr-v1-1-582d06514...@gmail.com
---
Tamir Duberstein (6):
rust: enable `clippy::ptr_as_ptr` lint
rust: enable `clippy::ptr_cast_constness` lint
rust: enable `clippy::as_ptr_cast_mut` lint
rust: enable `clippy::as_
d-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/bindings/lib.rs | 1 +
rust/kernel/device_id.rs | 3 ++-
rust/kernel/fs/file.rs | 3 ++-
rust/kernel/str.rs | 6 --
rust/kernel/uaccess.rs | 10 --
rust/uapi/lib.rs | 1 +
7 files cha
er/index.html#ptr_cast_constness [1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile| 1 +
rust/kernel/block/mq/request.rs | 5 +++--
rust/kernel/dma.rs | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Makefile b/M
necessary; the rest will be done in a later commit.
Signed-off-by: Tamir Duberstein
---
drivers/gpu/drm/drm_panic_qr.rs | 2 +-
rust/kernel/device.rs | 4 +-
rust/kernel/error.rs| 4 +-
rust/kernel/firmware.rs | 8 +-
rust/kernel/kunit.rs| 4 +-
rust
icode data.
Signed-off-by: Tamir Duberstein
---
rust/kernel/kunit.rs | 9 +---
rust/kernel/str.rs | 63 ++--
2 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
index 824da0e
On Thu, Apr 17, 2025 at 12:48 PM Boqun Feng wrote:
>
> On Wed, Apr 16, 2025 at 01:36:05PM -0400, Tamir Duberstein wrote:
> > In Rust 1.51.0, Clippy introduced the `ptr_as_ptr` lint [1]:
> >
> > > Though `as` casts between raw pointers are not terrible,
> > >
On Thu, Apr 17, 2025 at 1:12 PM Boqun Feng wrote:
>
> On Wed, Apr 16, 2025 at 01:36:06PM -0400, Tamir Duberstein wrote:
> > In Rust 1.72.0, Clippy introduced the `ptr_cast_constness` lint [1]:
> >
> > > Though `as` casts between raw pointers are not terrible,
&g
On Thu, Apr 17, 2025 at 1:55 PM Boqun Feng wrote:
>
> On Wed, Apr 16, 2025 at 01:36:08PM -0400, Tamir Duberstein wrote:
> > In Rust 1.63.0, Clippy introduced the `as_underscore` lint [1]:
> >
> > > The conversion might include lossy conversion or a dangerous cast tha
On Thu, Apr 17, 2025 at 1:29 PM Boqun Feng wrote:
>
> On Wed, Apr 16, 2025 at 01:36:09PM -0400, Tamir Duberstein wrote:
> > Before Rust 1.29.0, Clippy introduced the `cast_lossless` lint [1]:
> >
> > > Rust’s `as` keyword will perform many kinds of conversions, inc
On Fri, Apr 18, 2025 at 11:09 AM Boqun Feng wrote:
>
> On Fri, Apr 18, 2025 at 08:08:02AM -0400, Tamir Duberstein wrote:
> > On Thu, Apr 17, 2025 at 4:12 PM Boqun Feng wrote:
> > >
> > > On Thu, Apr 17, 2025 at 03:26:14PM
- Added additional patches, converted to series.
- Link to v1:
https://lore.kernel.org/r/20250307-ptr-as-ptr-v1-1-582d06514...@gmail.com
---
Tamir Duberstein (6):
rust: enable `clippy::ptr_as_ptr` lint
rust: enable `clippy::ptr_cast_constness` lint
rust: enable `clippy::as_ptr_c
wed-by: Boqun Feng
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/bindings/lib.rs | 1 +
rust/kernel/alloc/allocator_test.rs| 2 +-
rust/kernel/alloc/kvec.rs | 4 ++--
rust/kernel/device.rs | 4 ++--
rus
iewed-by: Benno Lossin
Reviewed-by: Boqun Feng
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/bindings/lib.rs | 1 +
rust/kernel/device_id.rs | 2 +-
rust/kernel/fs/file.rs | 2 +-
rust/kernel/str.rs | 4 ++--
rust/kernel/uaccess.rs | 4 ++--
rust/uap
d8ortxsutkgl.1kojagbm8f...@proton.me/
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile| 1 +
drivers/gpu/drm/drm_panic_qr.rs | 2 +-
rust/bindings/lib.rs| 1 +
rust/kernel/net/phy.rs | 4 ++--
rust/uapi/lib.rs|
tml#as_ptr_cast_mut
[1]
Reviewed-by: Benno Lossin
Reviewed-by: Boqun Feng
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/kernel/devres.rs | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 7b85b2a8d371..04a5246171f9 100644
--- a/
us apply the
changes and enable the lint -- no functional change intended.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#as_underscore
[1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/kernel/block/mq/operati
On Thu, Apr 17, 2025 at 4:12 PM Boqun Feng wrote:
>
> On Thu, Apr 17, 2025 at 03:26:14PM -0400, Tamir Duberstein wrote:
> [...]
> > >
> > > > Ok(())
> > > > }
> > > > diff --git a/rust/kernel/device_id.rs b/rust/kernel/device
ast_constness [1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile| 1 +
rust/kernel/block/mq/request.rs | 4 ++--
rust/kernel/dma.rs | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index
` is replaced with `let *mut *const T = (*mut *mut
T)`.cast();` since pointer to pointer can be confusing.
Apply these changes and enable the lint -- no functional change
intended.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_as_ptr [1]
Reviewed-by: Benno Lossin
Si
d8ortxsutkgl.1kojagbm8f...@proton.me/
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile| 1 +
drivers/gpu/drm/drm_panic_qr.rs | 2 +-
rust/bindings/lib.rs| 1 +
rust/kernel/net/phy.rs | 4 ++--
rust/uapi/lib.rs|
tml#as_ptr_cast_mut
[1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/kernel/devres.rs | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 7b85b2a8d371..04a5246171f9 100644
--- a/Makefile
+++ b/Makefile
@@
iewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/bindings/lib.rs | 1 +
rust/kernel/device_id.rs | 2 +-
rust/kernel/fs/file.rs | 2 +-
rust/kernel/str.rs | 4 ++--
rust/kernel/uaccess.rs | 4 ++--
rust/uapi/lib.rs | 1 +
7 files ch
-id: 20250409-container-of-mutness-b153dab4388d:v1
prerequisite-patch-id: 53d5889db599267f87642bb0ae3063c29bc24863
Best regards,
--
Tamir Duberstein
us apply the
changes and enable the lint -- no functional change intended.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#as_underscore
[1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/kernel/block/mq/operati
On Wed, Apr 16, 2025 at 1:51 PM Boqun Feng wrote:
>
> On Wed, Apr 16, 2025 at 01:36:10PM -0400, Tamir Duberstein wrote:
> > In Rust 1.78.0, Clippy introduced the `ref_as_ptr` lint [1]:
> >
> > > Using `as` casts may result in silently changing mutability or type.
On Tue, Apr 15, 2025 at 2:18 PM Boqun Feng wrote:
>
> On Tue, Apr 15, 2025 at 01:58:41PM -0400, Tamir Duberstein wrote:
> > Hi Boqun, thanks for having a look!
> >
> > On Tue, Apr 15, 2025 at 1:37 PM Boqun Feng wrote:
> > >
> > > On Wed, Apr 09, 2025 a
Hi Boqun, thanks for having a look!
On Tue, Apr 15, 2025 at 1:37 PM Boqun Feng wrote:
>
> On Wed, Apr 09, 2025 at 10:47:23AM -0400, Tamir Duberstein wrote:
> > In Rust 1.78.0, Clippy introduced the `ref_as_ptr` lint [1]:
> >
> > > Using `as` casts may result in sile
On Tue, Apr 15, 2025 at 4:51 PM Boqun Feng wrote:
>
> On Tue, Apr 15, 2025 at 04:10:01PM -0400, Tamir Duberstein wrote:
> > On Tue, Apr 15, 2025 at 2:18 PM Boqun Feng wrote:
> > >
> > > On Tue, Apr 15, 2025 at 01:58:41PM -0400, Tamir Duberstein wrote:
> > &g
On Tue, Apr 15, 2025 at 7:03 PM Boqun Feng wrote:
>
> On Tue, Apr 15, 2025 at 04:59:01PM -0400, Tamir Duberstein wrote:
> [...]
> > > > > > > > diff --git a/rust/kernel/device_id.rs b/rust/kernel/device_id.rs
> > > > > > > > index 406
ast_constness [1]
Reviewed-by: Benno Lossin
Signed-off-by: Tamir Duberstein
---
Makefile| 1 +
rust/kernel/block/mq/request.rs | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 5d2931344490..7b85b2a8d371 100644
--- a/M
+/// * Verifies at compile-time that the function signature matches the
> declaration in the header
> +/// file.
> +///
> +/// You must declare the signature of the Rust function in a header file
> that is included by
> +/// `rust/bindings/bindings_helper.h`.
> +///
> +/// This macro is *not* the same as the C macros `EXPORT_SYMBOL_*`, since
> all Rust symbols are
> +/// currently automatically exported with `EXPORT_SYMBOL_GPL`.
nit: "since" implies causation, which isn't the case, I think.
Consider if ", since" can be replaced with a semicolon.
> +#[proc_macro_attribute]
> +pub fn export(attr: TokenStream, ts: TokenStream) -> TokenStream {
> +export::export(attr, ts)
> +}
> +
> /// Concatenate two identifiers.
> ///
> /// This is useful in macros that need to declare or reference items with
> names
>
> --
> 2.48.1.711.g2feabab25a-goog
Minor comments.
Reviewed-by: Tamir Duberstein
> // Called from `vsprintf` with format specifier `%pA`.
> #[expect(clippy::missing_safety_doc)]
> -#[no_mangle]
> +#[export]
> unsafe extern "C" fn rust_fmt_argument(
> buf: *mut c_char,
> end: *mut c_char,
>
> --
> 2.48.1.711.g2feabab25a-goog
Reviewed-by: Tamir Duberstein
ings/bindings_helper.h b/rust/bindings/bindings_helper.h
> index 55354e4dec14..5345aa93fb8a 100644
> --- a/rust/bindings/bindings_helper.h
> +++ b/rust/bindings/bindings_helper.h
> @@ -36,6 +36,10 @@
> #include
> #include
>
> +#if defined(CONFIG_DRM_PANIC_SCREEN_QR_CODE)
> +#include
> +#endif
Why the guard here?
It'd be nice to have a comment here explaining the atypical need for
this include.
> +
> /* `bindgen` gets confused at certain things. */
> const size_t RUST_CONST_HELPER_ARCH_SLAB_MINALIGN = ARCH_SLAB_MINALIGN;
> const size_t RUST_CONST_HELPER_PAGE_SIZE = PAGE_SIZE;
>
> --
> 2.48.1.711.g2feabab25a-goog
With Andy's comment about extern addressed:
Reviewed-by: Tamir Duberstein
:tt)*) => {
> +$v.push(::proc_macro::TokenTree::Ident(::proc_macro::Ident::new("_",
> $span)));
> + quote_spanned!(@proc $v $span $($tt)*);
> +};
> (@proc $v:ident $span:ident $id:ident $($tt:tt)*) => {
>
> $v.push(::proc_macro::TokenTree::Ident(::proc_macro::Ident::new(stringify!($id),
> $span)));
> quote_spanned!(@proc $v $span $($tt)*);
>
> --
> 2.48.1.711.g2feabab25a-goog
Reviewed-by: Tamir Duberstein
On Fri, Feb 28, 2025 at 10:49 AM Miguel Ojeda
wrote:
>
> On Fri, Feb 28, 2025 at 4:41 PM Tamir Duberstein wrote:
> >
> > This needs an update given Miguel's comments on the cover letter. I
> > wonder if the code should also justify the choice (over cbindgen).
&g
On Fri, Feb 28, 2025 at 12:08 PM Alice Ryhl wrote:
>
> On Fri, Feb 28, 2025 at 4:55 PM Tamir Duberstein wrote:
> >
> > On Fri, Feb 28, 2025 at 7:41 AM Alice Ryhl wrote:
> > >
> > > @@ -980,8 +983,12 @@ fn draw_all(&mut self, data: impl Iterator > >
tps://docs.kernel.org/core-api/printk-basics.html>
>
> -use core::{
> +use crate::{
> ffi::{c_char, c_void},
> -fmt,
> +str::RawFormatter,
> };
> -
> -use crate::str::RawFormatter;
> +use core::fmt;
>
> // Called from `vsprintf` with format specifier `%pA`.
> #[expect(clippy::missing_safety_doc)]
>
> --
> 2.48.1.711.g2feabab25a-goog
Reviewed-by: Tamir Duberstein
Hi Lucas, chiming in here since I also care about building on macOS.
On Mon, Feb 24, 2025 at 10:05 AM Lucas De Marchi
wrote:
>
> Is this the approach taken for other similar issues you had? Note that
> argv[0] and program_invocation_short_name are not the same thing. For
> this particular binary
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:
> >> +pub fn resize(&mut self, new_len: usize, value: T, flags: Flags)
On Wed, Mar 19, 2025 at 10:34 AM Benno Lossin wrote:
>
> 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 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, 2025 at 5:09 PM Benno Lossin wrote:
> >> On Wed Mar 26, 2025 at 8:06 PM CET, Tamir Duberstein wrote:
> >> > On Wed, Mar
C-String literals were added in Rust 1.77. Replace instances of
`kernel::c_str!` with C-String literals where possible and rename
`kernel::c_str!` to `c_str_avoid_literals` to clarify its intended use.
Closes: https://github.com/Rust-for-Linux/linux/issues/1075
Signed-off-by: Tamir Duberstein
On Mon, May 26, 2025 at 12:15 PM Miguel Ojeda
wrote:
>
> On Sat, May 24, 2025 at 10:33 PM Tamir Duberstein wrote:
> >
> > This title is consistent with all other macros' documentation,
> > regardless of the number of examples contained in their "Examples&qu
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` This enables formatting of foreign types (like
> > `core::ffi::CStr
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
> > `kernel::str::CStr` with `core::ffi::CStr` now that we can.
>
> What'
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 name, how about `concat_to_c_str` or
> `concat_with_nul`?
>
> This macro also i
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`.
> >
> > Signed-off-by: Tamir Duberstein
> > ---
> > drivers/gpu/drm/drm_panic_qr.rs
/516476467
Signed-off-by: Tamir Duberstein
---
drivers/block/rnull.rs | 2 +-
rust/kernel/block/mq.rs | 2 +-
rust/kernel/device.rs | 2 +-
rust/kernel/fmt.rs | 77 +
rust/kernel/kunit.rs| 6 +--
rust/kernel/lib.rs | 1 +
r
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/net/phy/qt2025.rs | 1 +
rust/kernel/device.rs | 3
necessary; the rest will be done in a later commit.
Signed-off-by: Tamir Duberstein
---
drivers/gpu/drm/drm_panic_qr.rs | 2 +-
rust/kernel/device.rs | 4 +-
rust/kernel/error.rs| 4 +-
rust/kernel/firmware.rs | 11 +-
rust/kernel/kunit.rs| 6 +-
rust
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
---
rust/macros/lib.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/macros/lib.r
inux/linux/issues/1075
Signed-off-by: Tamir Duberstein
---
Changes in v10:
- Rebase on cbeaa41dfe26b72639141e87183cb23e00d4b0dd.
- Implement Alice's suggestion to use a proc macro to work around orphan
rules otherwise preventing `core::ffi::CStr` to be directly printed
with `{}`.
- Lin
On Tue, May 27, 2025 at 8:44 AM Alice Ryhl wrote:
>
> On Tue, May 27, 2025 at 12:18 AM Tamir Duberstein wrote:
> > > > +}
> > > > +
> > > > +fn make_ident<'a, T: IntoIterator>(
> > > > +span: Span,
> > > > +name
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, 2025 at 10:33 PM CEST, Tamir Duberstein wrote:
> >> > Introdu
On Mon, May 26, 2025 at 7:03 PM Benno Lossin wrote:
>
> 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:
> >> >
On Mon, May 26, 2025 at 7:07 PM Benno Lossin wrote:
>
> 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:
> >> > +
On Wed, May 28, 2025 at 6:38 AM Alice Ryhl wrote:
>
> On Sat, May 24, 2025 at 04:33:00PM -0400, Tamir Duberstein wrote:
> > This picks up from Michal Rostecki's work[0]. Per Michal's guidance I
> > have omitted Co-authored tags, as the end result is quite differe
On Mon, Jun 2, 2025 at 4:46 AM Alice Ryhl wrote:
>
> On Fri, May 30, 2025 at 08:27:44AM -0400, Tamir Duberstein wrote:
> > `kernel::ffi::CStr` was introduced in commit d126d2380131 ("rust: str:
> > add `CStr` type") in November 2022 as an upstreaming of earlier work
&
On Mon, Jun 2, 2025 at 4:45 AM Alice Ryhl wrote:
>
> On Fri, May 30, 2025 at 08:27:45AM -0400, Tamir Duberstein wrote:
> > C-String literals were added in Rust 1.77. Replace instances of
> > `kernel::c_str!` with C-String literals where possible and rename
> > `kernel:
On Sun, Jun 1, 2025 at 12:24 PM Benno Lossin wrote:
>
> On Fri May 30, 2025 at 2:27 PM CEST, Tamir Duberstein wrote:
> > Remove a handful of unncessary intermediate vectors and token streams;
> > mainly the top-level stream can be directly extended with the notable
>
On Sun, Jun 15, 2025 at 4:55 PM Tamir Duberstein wrote:
>
> In Rust 1.63.0, Clippy introduced the `as_underscore` lint [1]:
>
> > The conversion might include lossy conversion or a dangerous cast that
> > might go undetected due to the type being inferred.
> >
> &g
On Sun, Jun 15, 2025 at 4:55 PM Tamir Duberstein wrote:
>
> Before Rust 1.29.0, Clippy introduced the `cast_lossless` lint [1]:
>
> > Rust’s `as` keyword will perform many kinds of conversions, including
> > silently lossy conversions. Conversion functions such as `i32
On Sun, Jun 15, 2025 at 4:55 PM Tamir Duberstein wrote:
>
> In Rust 1.51.0, Clippy introduced the `ptr_as_ptr` lint [1]:
>
> > Though `as` casts between raw pointers are not terrible,
> > `pointer::cast` is safer because it cannot accidentally change the
> > pointer
wed-by: Boqun Feng
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
rust/bindings/lib.rs | 1 +
rust/kernel/alloc/allocator_test.rs| 2 +-
rust/kernel/alloc/kvec.rs | 4 ++--
rust/kernel/configfs.rs| 2 +-
rust
us apply the
changes and enable the lint -- no functional change intended.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#as_underscore
[1]
Reviewed-by: Benno Lossin
Reviewed-by: Boqun Feng
Signed-off-by: Tamir Duberstein
---
Makefile | 1 +
d
1 - 100 of 227 matches
Mail list logo