public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Fix all clippy warnings in drm-rust-next
@ 2026-04-04 21:28 John Hubbard
  2026-04-04 21:28 ` [PATCH v2 1/3] gpu: nova-core: vbios: use from_le_bytes() for PCI ROM header parsing John Hubbard
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: John Hubbard @ 2026-04-04 21:28 UTC (permalink / raw)
  To: Danilo Krummrich, Alexandre Courbot
  Cc: Joel Fernandes, Timur Tabi, Alistair Popple, Eliot Courtney,
	Shashank Sharma, Zhi Wang, David Airlie, Simona Vetter,
	Bjorn Helgaas, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, rust-for-linux, LKML, John Hubbard

This series fixes all remaining clippy warnings when building
drm-rust-next with CLIPPY=1, using rustc 1.85.0. There are a few clippy
lints involved, spread across nova-core and kernel crate code:

* clippy::precedence in nova-core vbios PCI ROM header parsing (2 warnings)
* clippy::precedence in nova-core read_sysmem_flush_page_ga100() (1 warning)
* clippy::incompatible_msrv for slice_ptr_len in rust/kernel/ptr (4 warnings)

v1 is here:
  https://lore.kernel.org/20260404025821.386514-1-jhubbard@nvidia.com

Changes in v2:
* Split the vbios from_le_bytes() cleanup into its own patch, per Alex.

* New patch: silence clippy::incompatible_msrv false positives in
  rust/kernel/ptr.

* Expanded the scope of the fixes: now it makes the entire drm-rust-next
  kernel clippy-clean, at least for the toolchain that I tested on.


John Hubbard (3):
  gpu: nova-core: vbios: use from_le_bytes() for PCI ROM header parsing
  gpu: nova-core: fb: fix clippy::precedence warning in
    read_sysmem_flush_page_ga100()
  rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len

 drivers/gpu/nova-core/fb/hal/ga100.rs | 7 ++++---
 drivers/gpu/nova-core/vbios.rs        | 7 +------
 rust/kernel/ptr.rs                    | 1 +
 rust/kernel/ptr/projection.rs         | 3 +++
 4 files changed, 9 insertions(+), 9 deletions(-)


base-commit: 7c50d748b4a635bc39802ea3f6b120e66b1b9067
-- 
2.53.0


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

* [PATCH v2 1/3] gpu: nova-core: vbios: use from_le_bytes() for PCI ROM header parsing
  2026-04-04 21:28 [PATCH v2 0/3] Fix all clippy warnings in drm-rust-next John Hubbard
@ 2026-04-04 21:28 ` John Hubbard
  2026-04-04 21:28 ` [PATCH v2 2/3] gpu: nova-core: fb: fix clippy::precedence warning in read_sysmem_flush_page_ga100() John Hubbard
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: John Hubbard @ 2026-04-04 21:28 UTC (permalink / raw)
  To: Danilo Krummrich, Alexandre Courbot
  Cc: Joel Fernandes, Timur Tabi, Alistair Popple, Eliot Courtney,
	Shashank Sharma, Zhi Wang, David Airlie, Simona Vetter,
	Bjorn Helgaas, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, rust-for-linux, LKML, John Hubbard

Clippy fires two clippy::precedence warnings on the manual
byte-shifting expression:
  warning: operator precedence can trip the unwary
     --> drivers/gpu/nova-core/vbios.rs:511:17
      |
  511 | /                 u32::from(data[29]) << 24
  512 | |                     | u32::from(data[28]) << 16
  513 | |                     | u32::from(data[27]) << 8
      | |______________________________________________^

Clear the warnings by replacing manual byte-shifting with
u32::from_le_bytes(). Using from_le_bytes() is also a tiny code
improvement, because it uses less code and is clearer about the intent.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 drivers/gpu/nova-core/vbios.rs | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index 3e3fa5b72524..ebda28e596c5 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -507,12 +507,7 @@ fn new(dev: &device::Device, data: &[u8]) -> Result<Self> {
 
         if data.len() >= 30 {
             // Read size_of_block at offset 0x1A.
-            size_of_block = Some(
-                u32::from(data[29]) << 24
-                    | u32::from(data[28]) << 16
-                    | u32::from(data[27]) << 8
-                    | u32::from(data[26]),
-            );
+            size_of_block = Some(u32::from_le_bytes([data[26], data[27], data[28], data[29]]));
         }
 
         // For NBSI images, try to read the nbsiDataOffset at offset 0x16.
-- 
2.53.0


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

* [PATCH v2 2/3] gpu: nova-core: fb: fix clippy::precedence warning in read_sysmem_flush_page_ga100()
  2026-04-04 21:28 [PATCH v2 0/3] Fix all clippy warnings in drm-rust-next John Hubbard
  2026-04-04 21:28 ` [PATCH v2 1/3] gpu: nova-core: vbios: use from_le_bytes() for PCI ROM header parsing John Hubbard
@ 2026-04-04 21:28 ` John Hubbard
  2026-04-04 21:35   ` John Hubbard
  2026-04-04 21:28 ` [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len John Hubbard
  2026-04-05 15:16 ` [PATCH v2 0/3] Fix all clippy warnings in drm-rust-next Danilo Krummrich
  3 siblings, 1 reply; 16+ messages in thread
From: John Hubbard @ 2026-04-04 21:28 UTC (permalink / raw)
  To: Danilo Krummrich, Alexandre Courbot
  Cc: Joel Fernandes, Timur Tabi, Alistair Popple, Eliot Courtney,
	Shashank Sharma, Zhi Wang, David Airlie, Simona Vetter,
	Bjorn Helgaas, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, rust-for-linux, LKML, John Hubbard

Clippy warns when shifts and bitwise-OR are mixed without parentheses,
because the relative precedence of << and | is easy to misread.

Add explicit parentheses to silence the warning.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 drivers/gpu/nova-core/fb/hal/ga100.rs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/nova-core/fb/hal/ga100.rs b/drivers/gpu/nova-core/fb/hal/ga100.rs
index 1c03783cddef..b5d0f04198f0 100644
--- a/drivers/gpu/nova-core/fb/hal/ga100.rs
+++ b/drivers/gpu/nova-core/fb/hal/ga100.rs
@@ -17,9 +17,10 @@
 struct Ga100;
 
 pub(super) fn read_sysmem_flush_page_ga100(bar: &Bar0) -> u64 {
-    u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR).adr_39_08()) << FLUSH_SYSMEM_ADDR_SHIFT
-        | u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR_HI).adr_63_40())
-            << FLUSH_SYSMEM_ADDR_SHIFT_HI
+    (u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR).adr_39_08())
+        << FLUSH_SYSMEM_ADDR_SHIFT)
+        | (u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR_HI).adr_63_40())
+            << FLUSH_SYSMEM_ADDR_SHIFT_HI)
 }
 
 pub(super) fn write_sysmem_flush_page_ga100(bar: &Bar0, addr: u64) {
-- 
2.53.0


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

* [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len
  2026-04-04 21:28 [PATCH v2 0/3] Fix all clippy warnings in drm-rust-next John Hubbard
  2026-04-04 21:28 ` [PATCH v2 1/3] gpu: nova-core: vbios: use from_le_bytes() for PCI ROM header parsing John Hubbard
  2026-04-04 21:28 ` [PATCH v2 2/3] gpu: nova-core: fb: fix clippy::precedence warning in read_sysmem_flush_page_ga100() John Hubbard
@ 2026-04-04 21:28 ` John Hubbard
  2026-04-04 21:46   ` Miguel Ojeda
  2026-04-05 15:16 ` [PATCH v2 0/3] Fix all clippy warnings in drm-rust-next Danilo Krummrich
  3 siblings, 1 reply; 16+ messages in thread
From: John Hubbard @ 2026-04-04 21:28 UTC (permalink / raw)
  To: Danilo Krummrich, Alexandre Courbot
  Cc: Joel Fernandes, Timur Tabi, Alistair Popple, Eliot Courtney,
	Shashank Sharma, Zhi Wang, David Airlie, Simona Vetter,
	Bjorn Helgaas, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, rust-for-linux, LKML, John Hubbard

Clippy reports four warnings when building with CLIPPY=1:

  warning: current MSRV (Minimum Supported Rust Version) is `1.78.0` but this item is stable since `1.79.0`
    --> rust/kernel/ptr/projection.rs:79:26
     |
  79 |         if self >= slice.len() {
     |                          ^^^^^

  warning: current MSRV (Minimum Supported Rust Version) is `1.78.0` but this item is stable since `1.79.0`
    --> rust/kernel/ptr/projection.rs:95:29
     |
  95 |         if self.end > slice.len() {
     |                             ^^^^^

  warning: current MSRV (Minimum Supported Rust Version) is `1.78.0` but this item is stable since `1.79.0`
     --> rust/kernel/ptr/projection.rs:121:28
      |
  121 |         (self.start..slice.len()).get(slice)
      |                            ^^^^^

  warning: current MSRV (Minimum Supported Rust Version) is `1.78.0` but this item is stable since `1.79.0`
     --> rust/kernel/ptr.rs:253:11
      |
  253 |         p.len() * size_of::<T>()
      |           ^^^^^

These are false positives. The <*mut [T]>::len() and <*const [T]>::len()
methods are available because the kernel enables #![feature(slice_ptr_len)]
in lib.rs. Clippy does not account for feature gates when checking MSRV
compatibility.

Silence these false positive via #[allow(clippy::incompatible_msrv)].

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 rust/kernel/ptr.rs            | 1 +
 rust/kernel/ptr/projection.rs | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/rust/kernel/ptr.rs b/rust/kernel/ptr.rs
index bdc2d79ff669..7482653ef160 100644
--- a/rust/kernel/ptr.rs
+++ b/rust/kernel/ptr.rs
@@ -248,6 +248,7 @@ fn size(_: *const Self) -> usize {
 }
 
 impl<T> KnownSize for [T] {
+    #[allow(clippy::incompatible_msrv)]
     #[inline(always)]
     fn size(p: *const Self) -> usize {
         p.len() * size_of::<T>()
diff --git a/rust/kernel/ptr/projection.rs b/rust/kernel/ptr/projection.rs
index 140ea8e21617..7d1c878b3116 100644
--- a/rust/kernel/ptr/projection.rs
+++ b/rust/kernel/ptr/projection.rs
@@ -74,6 +74,7 @@ fn index(self, slice: *mut T) -> *mut Self::Output {
 unsafe impl<T> ProjectIndex<[T]> for usize {
     type Output = T;
 
+    #[allow(clippy::incompatible_msrv)]
     #[inline(always)]
     fn get(self, slice: *mut [T]) -> Option<*mut T> {
         if self >= slice.len() {
@@ -89,6 +90,7 @@ fn get(self, slice: *mut [T]) -> Option<*mut T> {
 unsafe impl<T> ProjectIndex<[T]> for core::ops::Range<usize> {
     type Output = [T];
 
+    #[allow(clippy::incompatible_msrv)]
     #[inline(always)]
     fn get(self, slice: *mut [T]) -> Option<*mut [T]> {
         let new_len = self.end.checked_sub(self.start)?;
@@ -116,6 +118,7 @@ fn get(self, slice: *mut [T]) -> Option<*mut [T]> {
 unsafe impl<T> ProjectIndex<[T]> for core::ops::RangeFrom<usize> {
     type Output = [T];
 
+    #[allow(clippy::incompatible_msrv)]
     #[inline(always)]
     fn get(self, slice: *mut [T]) -> Option<*mut [T]> {
         (self.start..slice.len()).get(slice)
-- 
2.53.0


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

* Re: [PATCH v2 2/3] gpu: nova-core: fb: fix clippy::precedence warning in read_sysmem_flush_page_ga100()
  2026-04-04 21:28 ` [PATCH v2 2/3] gpu: nova-core: fb: fix clippy::precedence warning in read_sysmem_flush_page_ga100() John Hubbard
@ 2026-04-04 21:35   ` John Hubbard
  2026-04-05 11:42     ` Alexandre Courbot
  0 siblings, 1 reply; 16+ messages in thread
From: John Hubbard @ 2026-04-04 21:35 UTC (permalink / raw)
  To: Danilo Krummrich, Alexandre Courbot
  Cc: Joel Fernandes, Timur Tabi, Alistair Popple, Eliot Courtney,
	Shashank Sharma, Zhi Wang, David Airlie, Simona Vetter,
	Bjorn Helgaas, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, rust-for-linux, LKML

On 4/4/26 2:28 PM, John Hubbard wrote:
> Clippy warns when shifts and bitwise-OR are mixed without parentheses,
> because the relative precedence of << and | is easy to misread.
> 
> Add explicit parentheses to silence the warning.

Please disregard (drop) this patch 2/3, because Miguel is removing
the associated lint, so we won't need it. 

> 
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
>  drivers/gpu/nova-core/fb/hal/ga100.rs | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/fb/hal/ga100.rs b/drivers/gpu/nova-core/fb/hal/ga100.rs
> index 1c03783cddef..b5d0f04198f0 100644
> --- a/drivers/gpu/nova-core/fb/hal/ga100.rs
> +++ b/drivers/gpu/nova-core/fb/hal/ga100.rs
> @@ -17,9 +17,10 @@
>  struct Ga100;
>  
>  pub(super) fn read_sysmem_flush_page_ga100(bar: &Bar0) -> u64 {
> -    u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR).adr_39_08()) << FLUSH_SYSMEM_ADDR_SHIFT
> -        | u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR_HI).adr_63_40())
> -            << FLUSH_SYSMEM_ADDR_SHIFT_HI
> +    (u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR).adr_39_08())
> +        << FLUSH_SYSMEM_ADDR_SHIFT)
> +        | (u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR_HI).adr_63_40())
> +            << FLUSH_SYSMEM_ADDR_SHIFT_HI)
>  }
>  
>  pub(super) fn write_sysmem_flush_page_ga100(bar: &Bar0, addr: u64) {

thanks,
-- 
John Hubbard


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

* Re: [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len
  2026-04-04 21:28 ` [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len John Hubbard
@ 2026-04-04 21:46   ` Miguel Ojeda
  2026-04-04 21:49     ` John Hubbard
  2026-04-04 22:09     ` Gary Guo
  0 siblings, 2 replies; 16+ messages in thread
From: Miguel Ojeda @ 2026-04-04 21:46 UTC (permalink / raw)
  To: John Hubbard
  Cc: Danilo Krummrich, Alexandre Courbot, Joel Fernandes, Timur Tabi,
	Alistair Popple, Eliot Courtney, Shashank Sharma, Zhi Wang,
	David Airlie, Simona Vetter, Bjorn Helgaas, Miguel Ojeda,
	Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	rust-for-linux, LKML

On Sat, Apr 4, 2026 at 11:28 PM John Hubbard <jhubbard@nvidia.com> wrote:
>
> Clippy reports four warnings when building with CLIPPY=1:
>
>   warning: current MSRV (Minimum Supported Rust Version) is `1.78.0` but this item is stable since `1.79.0`
>     --> rust/kernel/ptr/projection.rs:79:26
>      |
>   79 |         if self >= slice.len() {
>      |                          ^^^^^

This will also go away with the bump:

  https://lore.kernel.org/rust-for-linux/20260401114540.30108-3-ojeda@kernel.org/

Cheers,
Miguel

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

* Re: [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len
  2026-04-04 21:46   ` Miguel Ojeda
@ 2026-04-04 21:49     ` John Hubbard
  2026-04-05 23:22       ` Miguel Ojeda
  2026-04-04 22:09     ` Gary Guo
  1 sibling, 1 reply; 16+ messages in thread
From: John Hubbard @ 2026-04-04 21:49 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Danilo Krummrich, Alexandre Courbot, Joel Fernandes, Timur Tabi,
	Alistair Popple, Eliot Courtney, Shashank Sharma, Zhi Wang,
	David Airlie, Simona Vetter, Bjorn Helgaas, Miguel Ojeda,
	Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	rust-for-linux, LKML

On 4/4/26 2:46 PM, Miguel Ojeda wrote:
> On Sat, Apr 4, 2026 at 11:28 PM John Hubbard <jhubbard@nvidia.com> wrote:
>>
>> Clippy reports four warnings when building with CLIPPY=1:
>>
>>   warning: current MSRV (Minimum Supported Rust Version) is `1.78.0` but this item is stable since `1.79.0`
>>     --> rust/kernel/ptr/projection.rs:79:26
>>      |
>>   79 |         if self >= slice.len() {
>>      |                          ^^^^^
> 
> This will also go away with the bump:
> 
>   https://lore.kernel.org/rust-for-linux/20260401114540.30108-3-ojeda@kernel.org/
> 

And that bump is destined for this merge window, right?

I'm also wondering how much, if any of this series here is needed
soon, to remain warnings-free.

thanks,
-- 
John Hubbard


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

* Re: [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len
  2026-04-04 21:46   ` Miguel Ojeda
  2026-04-04 21:49     ` John Hubbard
@ 2026-04-04 22:09     ` Gary Guo
  2026-04-05 23:22       ` Miguel Ojeda
  1 sibling, 1 reply; 16+ messages in thread
From: Gary Guo @ 2026-04-04 22:09 UTC (permalink / raw)
  To: Miguel Ojeda, John Hubbard
  Cc: Danilo Krummrich, Alexandre Courbot, Joel Fernandes, Timur Tabi,
	Alistair Popple, Eliot Courtney, Shashank Sharma, Zhi Wang,
	David Airlie, Simona Vetter, Bjorn Helgaas, Miguel Ojeda,
	Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	rust-for-linux, LKML

On Sat Apr 4, 2026 at 10:46 PM BST, Miguel Ojeda wrote:
> On Sat, Apr 4, 2026 at 11:28 PM John Hubbard <jhubbard@nvidia.com> wrote:
>>
>> Clippy reports four warnings when building with CLIPPY=1:
>>
>>   warning: current MSRV (Minimum Supported Rust Version) is `1.78.0` but this item is stable since `1.79.0`
>>     --> rust/kernel/ptr/projection.rs:79:26
>>      |
>>   79 |         if self >= slice.len() {
>>      |                          ^^^^^
>
> This will also go away with the bump:
>
>   https://lore.kernel.org/rust-for-linux/20260401114540.30108-3-ojeda@kernel.org/
>
> Cheers,
> Miguel

I feel like this lint is hurting us rather than helping. Perhaps it's worth
disabling it globally.

Best,
Gary

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

* Re: [PATCH v2 2/3] gpu: nova-core: fb: fix clippy::precedence warning in read_sysmem_flush_page_ga100()
  2026-04-04 21:35   ` John Hubbard
@ 2026-04-05 11:42     ` Alexandre Courbot
  2026-04-05 12:13       ` Miguel Ojeda
  2026-04-05 12:32       ` Danilo Krummrich
  0 siblings, 2 replies; 16+ messages in thread
From: Alexandre Courbot @ 2026-04-05 11:42 UTC (permalink / raw)
  To: John Hubbard
  Cc: Danilo Krummrich, Joel Fernandes, Timur Tabi, Alistair Popple,
	Eliot Courtney, Shashank Sharma, Zhi Wang, David Airlie,
	Simona Vetter, Bjorn Helgaas, Miguel Ojeda, Alex Gaynor,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux, LKML

On Sun Apr 5, 2026 at 6:35 AM JST, John Hubbard wrote:
> On 4/4/26 2:28 PM, John Hubbard wrote:
>> Clippy warns when shifts and bitwise-OR are mixed without parentheses,
>> because the relative precedence of << and | is easy to misread.
>> 
>> Add explicit parentheses to silence the warning.
>
> Please disregard (drop) this patch 2/3, because Miguel is removing
> the associated lint, so we won't need it. 

I'm tempted to consider it anyway, because it is a readability
improvement. Any objection?

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

* Re: [PATCH v2 2/3] gpu: nova-core: fb: fix clippy::precedence warning in read_sysmem_flush_page_ga100()
  2026-04-05 11:42     ` Alexandre Courbot
@ 2026-04-05 12:13       ` Miguel Ojeda
  2026-04-05 12:32       ` Danilo Krummrich
  1 sibling, 0 replies; 16+ messages in thread
From: Miguel Ojeda @ 2026-04-05 12:13 UTC (permalink / raw)
  To: Alexandre Courbot, Gary Guo
  Cc: John Hubbard, Danilo Krummrich, Joel Fernandes, Timur Tabi,
	Alistair Popple, Eliot Courtney, Shashank Sharma, Zhi Wang,
	David Airlie, Simona Vetter, Bjorn Helgaas, Miguel Ojeda,
	Alex Gaynor, Boqun Feng, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux, LKML

On Sun, Apr 5, 2026 at 1:42 PM Alexandre Courbot <acourbot@nvidia.com> wrote:
>
> I'm tempted to consider it anyway, because it is a readability
> improvement. Any objection?

None at all -- though I think there are conflicting opinions on the
matter. I think Gary preferred not to have the parentheses, supported
by the fact that Clippy had to roll it back (i.e. linting at that by
default) meant the parentheses may not be popular.

Back then I wrote:

  Now, seeing quite a bunch of parenthesis for this in C files, from
  kernel devs and crypto stuff and all over drivers and so on and so
  forth, means others definitely do not find it obvious or prefer to be
  explicit for extra clarity.

I have checked again a few `git grep` patterns, and it seems to me
there are substantially more files using parentheses than not in C
files, at least with some naive regexes. Can someone double-check?

If we go for wanting them, then I can just enable
`clippy::precedence_bits` to be consistent instead.

It is easier to disable the lint later than trying to enable it later
on, though (because we would need to add all the missing parentheses
everywhere).

Cheers,
Miguel

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

* Re: [PATCH v2 2/3] gpu: nova-core: fb: fix clippy::precedence warning in read_sysmem_flush_page_ga100()
  2026-04-05 11:42     ` Alexandre Courbot
  2026-04-05 12:13       ` Miguel Ojeda
@ 2026-04-05 12:32       ` Danilo Krummrich
  2026-04-06  0:38         ` Alexandre Courbot
  1 sibling, 1 reply; 16+ messages in thread
From: Danilo Krummrich @ 2026-04-05 12:32 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: John Hubbard, Joel Fernandes, Timur Tabi, Alistair Popple,
	Eliot Courtney, Shashank Sharma, Zhi Wang, David Airlie,
	Simona Vetter, Bjorn Helgaas, Miguel Ojeda, Alex Gaynor,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux, LKML

On Sun Apr 5, 2026 at 1:42 PM CEST, Alexandre Courbot wrote:
> On Sun Apr 5, 2026 at 6:35 AM JST, John Hubbard wrote:
>> On 4/4/26 2:28 PM, John Hubbard wrote:
>>> Clippy warns when shifts and bitwise-OR are mixed without parentheses,
>>> because the relative precedence of << and | is easy to misread.
>>> 
>>> Add explicit parentheses to silence the warning.
>>
>> Please disregard (drop) this patch 2/3, because Miguel is removing
>> the associated lint, so we won't need it. 
>
> I'm tempted to consider it anyway, because it is a readability
> improvement. Any objection?

I'd rather not. If we have the lint disabled - and I think having it enabled is
a bit too much - then I don't want to set a precedence for unnecessary churn
like adding or removing unnecessary braces.

- Danilo

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

* Re: [PATCH v2 0/3] Fix all clippy warnings in drm-rust-next
  2026-04-04 21:28 [PATCH v2 0/3] Fix all clippy warnings in drm-rust-next John Hubbard
                   ` (2 preceding siblings ...)
  2026-04-04 21:28 ` [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len John Hubbard
@ 2026-04-05 15:16 ` Danilo Krummrich
  3 siblings, 0 replies; 16+ messages in thread
From: Danilo Krummrich @ 2026-04-05 15:16 UTC (permalink / raw)
  To: John Hubbard
  Cc: Alexandre Courbot, Joel Fernandes, Timur Tabi, Alistair Popple,
	Eliot Courtney, Shashank Sharma, Zhi Wang, David Airlie,
	Simona Vetter, Bjorn Helgaas, Miguel Ojeda, Alex Gaynor,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux, LKML

On Sat Apr 4, 2026 at 11:28 PM CEST, John Hubbard wrote:
> John Hubbard (3):
>   gpu: nova-core: vbios: use from_le_bytes() for PCI ROM header parsing

Applied to drm-rust-next, thanks!

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

* Re: [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len
  2026-04-04 21:49     ` John Hubbard
@ 2026-04-05 23:22       ` Miguel Ojeda
  2026-04-06  5:43         ` John Hubbard
  0 siblings, 1 reply; 16+ messages in thread
From: Miguel Ojeda @ 2026-04-05 23:22 UTC (permalink / raw)
  To: John Hubbard
  Cc: Danilo Krummrich, Alexandre Courbot, Joel Fernandes, Timur Tabi,
	Alistair Popple, Eliot Courtney, Shashank Sharma, Zhi Wang,
	David Airlie, Simona Vetter, Bjorn Helgaas, Miguel Ojeda,
	Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	rust-for-linux, LKML

On Sat, Apr 4, 2026 at 11:49 PM John Hubbard <jhubbard@nvidia.com> wrote:
>
> And that bump is destined for this merge window, right?

Yes, but I already replied here to this:

  https://lore.kernel.org/rust-for-linux/CANiq72nbHtFpqgC-CGyLULSH9C90U2bw7bmovscqffd4HP0Oxw@mail.gmail.com/

So I am wondering if you meant something else in one of them (?).

Confused...

> I'm also wondering how much, if any of this series here is needed
> soon, to remain warnings-free.

I don't think anything is strictly needed, but the cleanup you did in
the first patch looks good and Danilo already took it, so that is
great.

Cheers,
Miguel

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

* Re: [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len
  2026-04-04 22:09     ` Gary Guo
@ 2026-04-05 23:22       ` Miguel Ojeda
  0 siblings, 0 replies; 16+ messages in thread
From: Miguel Ojeda @ 2026-04-05 23:22 UTC (permalink / raw)
  To: Gary Guo
  Cc: John Hubbard, Danilo Krummrich, Alexandre Courbot, Joel Fernandes,
	Timur Tabi, Alistair Popple, Eliot Courtney, Shashank Sharma,
	Zhi Wang, David Airlie, Simona Vetter, Bjorn Helgaas,
	Miguel Ojeda, Alex Gaynor, Boqun Feng, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	rust-for-linux, LKML

On Sun, Apr 5, 2026 at 12:09 AM Gary Guo <gary@garyguo.net> wrote:
>
> I feel like this lint is hurting us rather than helping. Perhaps it's worth
> disabling it globally.

Yeah, we can do that. The `msrv` is still useful to have for other
lints, so I kept it.

Cheers,
Miguel

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

* Re: [PATCH v2 2/3] gpu: nova-core: fb: fix clippy::precedence warning in read_sysmem_flush_page_ga100()
  2026-04-05 12:32       ` Danilo Krummrich
@ 2026-04-06  0:38         ` Alexandre Courbot
  0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Courbot @ 2026-04-06  0:38 UTC (permalink / raw)
  To: Danilo Krummrich
  Cc: John Hubbard, Joel Fernandes, Timur Tabi, Alistair Popple,
	Eliot Courtney, Shashank Sharma, Zhi Wang, David Airlie,
	Simona Vetter, Bjorn Helgaas, Miguel Ojeda, Alex Gaynor,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux, LKML

On Sun Apr 5, 2026 at 9:32 PM JST, Danilo Krummrich wrote:
> On Sun Apr 5, 2026 at 1:42 PM CEST, Alexandre Courbot wrote:
>> On Sun Apr 5, 2026 at 6:35 AM JST, John Hubbard wrote:
>>> On 4/4/26 2:28 PM, John Hubbard wrote:
>>>> Clippy warns when shifts and bitwise-OR are mixed without parentheses,
>>>> because the relative precedence of << and | is easy to misread.
>>>> 
>>>> Add explicit parentheses to silence the warning.
>>>
>>> Please disregard (drop) this patch 2/3, because Miguel is removing
>>> the associated lint, so we won't need it. 
>>
>> I'm tempted to consider it anyway, because it is a readability
>> improvement. Any objection?
>
> I'd rather not. If we have the lint disabled - and I think having it enabled is
> a bit too much - then I don't want to set a precedence for unnecessary churn
> like adding or removing unnecessary braces.

Alright - dropping it for now then, thank you (and Miguel) for the input.

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

* Re: [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len
  2026-04-05 23:22       ` Miguel Ojeda
@ 2026-04-06  5:43         ` John Hubbard
  0 siblings, 0 replies; 16+ messages in thread
From: John Hubbard @ 2026-04-06  5:43 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Danilo Krummrich, Alexandre Courbot, Joel Fernandes, Timur Tabi,
	Alistair Popple, Eliot Courtney, Shashank Sharma, Zhi Wang,
	David Airlie, Simona Vetter, Bjorn Helgaas, Miguel Ojeda,
	Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	rust-for-linux, LKML

On 4/5/26 4:22 PM, Miguel Ojeda wrote:
> On Sat, Apr 4, 2026 at 11:49 PM John Hubbard <jhubbard@nvidia.com> wrote:
>>
>> And that bump is destined for this merge window, right?
> 
> Yes, but I already replied here to this:
> 
>    https://lore.kernel.org/rust-for-linux/CANiq72nbHtFpqgC-CGyLULSH9C90U2bw7bmovscqffd4HP0Oxw@mail.gmail.com/
> 
> So I am wondering if you meant something else in one of them (?).
> 
> Confused...

But considerably less confused than I was, when I wrote that
second question. haha :)

Anyway, all is clear now. I was a bit rattled when the new drm-rust-next
presented me 7 new CLIPPY warnings, but it appears that each one has
a resolution, so good.


thanks,
-- 
John Hubbard


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

end of thread, other threads:[~2026-04-06  5:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-04 21:28 [PATCH v2 0/3] Fix all clippy warnings in drm-rust-next John Hubbard
2026-04-04 21:28 ` [PATCH v2 1/3] gpu: nova-core: vbios: use from_le_bytes() for PCI ROM header parsing John Hubbard
2026-04-04 21:28 ` [PATCH v2 2/3] gpu: nova-core: fb: fix clippy::precedence warning in read_sysmem_flush_page_ga100() John Hubbard
2026-04-04 21:35   ` John Hubbard
2026-04-05 11:42     ` Alexandre Courbot
2026-04-05 12:13       ` Miguel Ojeda
2026-04-05 12:32       ` Danilo Krummrich
2026-04-06  0:38         ` Alexandre Courbot
2026-04-04 21:28 ` [PATCH v2 3/3] rust: ptr: allow clippy::incompatible_msrv for slice_ptr_len John Hubbard
2026-04-04 21:46   ` Miguel Ojeda
2026-04-04 21:49     ` John Hubbard
2026-04-05 23:22       ` Miguel Ojeda
2026-04-06  5:43         ` John Hubbard
2026-04-04 22:09     ` Gary Guo
2026-04-05 23:22       ` Miguel Ojeda
2026-04-05 15:16 ` [PATCH v2 0/3] Fix all clippy warnings in drm-rust-next Danilo Krummrich

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