Skip to content

Commit

Permalink
drm/panthor: Use the BITS_PER_LONG macro
Browse files Browse the repository at this point in the history
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
	torvalds#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
  • Loading branch information
Jinjie Ruan authored and boogieeeee committed Dec 21, 2024
1 parent d4c1137 commit e6317fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/panthor/panthor_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2692,9 +2692,9 @@ int panthor_mmu_init(struct panthor_device *ptdev)
* which passes iova as an unsigned long. Patch the mmu_features to reflect this
* limitation.
*/
if (sizeof(unsigned long) * 8 < va_bits) {
if (va_bits > BITS_PER_LONG) {
ptdev->gpu_info.mmu_features &= ~GENMASK(7, 0);
ptdev->gpu_info.mmu_features |= sizeof(unsigned long) * 8;
ptdev->gpu_info.mmu_features |= BITS_PER_LONG;
}

return drmm_add_action_or_reset(&ptdev->base, panthor_mmu_release_wq, mmu->vm.wq);
Expand Down

0 comments on commit e6317fa

Please sign in to comment.