]> git.hungrycats.org Git - linux/commit
drm/xe/gt_idle: Use NSEC_PER_MSEC instead of float literal
authorShuicheng Lin <shuicheng.lin@intel.com>
Mon, 11 May 2026 15:33:07 +0000 (15:33 +0000)
committerShuicheng Lin <shuicheng.lin@intel.com>
Thu, 14 May 2026 15:24:28 +0000 (08:24 -0700)
commit1d60990cdb0b6fbf70ec5fdd96c0b214c455b71e
treef95143178b6f5c2131970c12d61f9c5ddb4c7661
parent71d61e3e299a17139e47f980a4d6f425b2c59bf7
drm/xe/gt_idle: Use NSEC_PER_MSEC instead of float literal

The residency multiplier conversion in get_residency_ms() used the
floating-point literal 1e6 as the divisor of mul_u64_u32_div(). While
the compiler constant-folds this to an integer, using float literals
in kernel code is bad practice since the kernel generally avoids
floating-point operations.

Replace 1e6 with the standard NSEC_PER_MSEC macro from <linux/time64.h>,
which is both self-documenting (ns to ms conversion) and unambiguously
integer. Add the corresponding include rather than relying on
transitive inclusion.

No functional change.

Assisted-by: Claude:claude-opus-4.6
Reviewed-by: Nitin Gote <nitin.r.gote@intel.com>
Link: https://patch.msgid.link/20260511153307.223435-1-shuicheng.lin@intel.com
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
drivers/gpu/drm/xe/xe_gt_idle.c