Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/panthor: Use the BITS_PER_LONG macro

sizeof(unsigned long) * 8 is the number of bits in an unsigned long
variable, replace it with BITS_PER_LONG macro to make them simpler.

And fix the warning:
WARNING: Comparisons should place the constant on the right side of the test
#23: FILE: drivers/gpu/drm/panthor/panthor_mmu.c:2696:
+ if (BITS_PER_LONG < va_bits) {

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240902094404.1943710-1-ruanjinjie@huawei.com

authored by

Jinjie Ruan and committed by
Steven Price
9b79594a 3a8d9761

+2 -2
+2 -2
drivers/gpu/drm/panthor/panthor_mmu.c
··· 2693 2693 * which passes iova as an unsigned long. Patch the mmu_features to reflect this 2694 2694 * limitation. 2695 2695 */ 2696 - if (sizeof(unsigned long) * 8 < va_bits) { 2696 + if (va_bits > BITS_PER_LONG) { 2697 2697 ptdev->gpu_info.mmu_features &= ~GENMASK(7, 0); 2698 - ptdev->gpu_info.mmu_features |= sizeof(unsigned long) * 8; 2698 + ptdev->gpu_info.mmu_features |= BITS_PER_LONG; 2699 2699 } 2700 2700 2701 2701 return drmm_add_action_or_reset(&ptdev->base, panthor_mmu_release_wq, mmu->vm.wq);