From: Alexandre Courbot Date: Wed, 22 Oct 2025 10:50:57 +0000 (+0900) Subject: gpu: nova-core: bitfield: simplify expression X-Git-Tag: v6.19-rc1~157^2~8^2~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6b8932b9374bd0591bb4dda3eb3e4f1cc50655e;p=thirdparty%2Fkernel%2Flinux.git gpu: nova-core: bitfield: simplify expression The shift is more easily expressed by the index of the lowest bit of the field. Reported-by: Edwin Peer Link: https://lore.kernel.org/rust-for-linux/F3853912-2C1C-4F9B-89B0-3168689F35B3@nvidia.com/ Reviewed-by: Joel Fernandes Reviewed-by: Danilo Krummrich Signed-off-by: Alexandre Courbot Message-ID: <20251022-nova-bitfield-v1-2-73bc0988667b@nvidia.com> --- diff --git a/drivers/gpu/nova-core/bitfield.rs b/drivers/gpu/nova-core/bitfield.rs index 136de72891629..f113439c6501a 100644 --- a/drivers/gpu/nova-core/bitfield.rs +++ b/drivers/gpu/nova-core/bitfield.rs @@ -268,7 +268,7 @@ macro_rules! bitfield { _ => ::kernel::build_error!("Unsupported storage type size") } }; - const [<$field:upper _SHIFT>]: u32 = Self::[<$field:upper _MASK>].trailing_zeros(); + const [<$field:upper _SHIFT>]: u32 = $lo; ); $(