dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] accel/ivpu: Remove unnecessary min_t()/max_t() usage
@ 2026-07-16  8:33 Andrzej Kacprowski
  2026-07-16 13:29 ` Wachowski, Karol
  0 siblings, 1 reply; 3+ messages in thread
From: Andrzej Kacprowski @ 2026-07-16  8:33 UTC (permalink / raw)
  To: dri-devel
  Cc: oded.gabbay, jeff.hugo, lizhi.hou, karol.wachowski,
	andrzej.kacprowski

Remove unnecessary min_t()/max_t() usage in ivpu_fw.c
and ivpu_mmu_context.c. The min()/max() macros are
sufficient as the types are compatible and
there is no risk of overflow.

Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_fw.c          | 2 +-
 drivers/accel/ivpu/ivpu_mmu_context.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c
index 5a8f7dfb54e6..b78b7c35cd9b 100644
--- a/drivers/accel/ivpu/ivpu_fw.c
+++ b/drivers/accel/ivpu/ivpu_fw.c
@@ -318,7 +318,7 @@ static int ivpu_fw_parse(struct ivpu_device *vdev)
 	fw->shave_nn_size = PAGE_ALIGN(fw_hdr->shave_nn_fw_size);
 	fw->cold_boot_entry_point = fw_hdr->entry_point;
 
-	fw->trace_level = min_t(u32, ivpu_fw_log_level, IVPU_FW_LOG_FATAL);
+	fw->trace_level = min(ivpu_fw_log_level, IVPU_FW_LOG_FATAL);
 	fw->trace_destination_mask = VPU_TRACE_DESTINATION_VERBOSE_TRACING;
 	fw->trace_hw_component_mask = -1;
 
diff --git a/drivers/accel/ivpu/ivpu_mmu_context.c b/drivers/accel/ivpu/ivpu_mmu_context.c
index c4014c83e727..bb3ca81838e3 100644
--- a/drivers/accel/ivpu/ivpu_mmu_context.c
+++ b/drivers/accel/ivpu/ivpu_mmu_context.c
@@ -588,8 +588,8 @@ void ivpu_mmu_context_init(struct ivpu_device *vdev, struct ivpu_mmu_context *ct
 		start = vdev->hw->ranges.runtime.start;
 		end = vdev->hw->ranges.shave.end;
 	} else {
-		start = min_t(u64, vdev->hw->ranges.user.start, vdev->hw->ranges.shave.start);
-		end = max_t(u64, vdev->hw->ranges.user.end, vdev->hw->ranges.dma.end);
+		start = min(vdev->hw->ranges.user.start, vdev->hw->ranges.shave.start);
+		end = max(vdev->hw->ranges.user.end, vdev->hw->ranges.dma.end);
 	}
 
 	drm_mm_init(&ctx->mm, start, end - start);
-- 
2.43.0


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

* Re: [PATCH] accel/ivpu: Remove unnecessary min_t()/max_t() usage
  2026-07-16  8:33 [PATCH] accel/ivpu: Remove unnecessary min_t()/max_t() usage Andrzej Kacprowski
@ 2026-07-16 13:29 ` Wachowski, Karol
  2026-07-17  8:17   ` Wachowski, Karol
  0 siblings, 1 reply; 3+ messages in thread
From: Wachowski, Karol @ 2026-07-16 13:29 UTC (permalink / raw)
  To: Andrzej Kacprowski, dri-devel; +Cc: oded.gabbay, jeff.hugo, lizhi.hou

On 16-Jul-26 10:33, Andrzej Kacprowski wrote:
> Remove unnecessary min_t()/max_t() usage in ivpu_fw.c
> and ivpu_mmu_context.c. The min()/max() macros are
> sufficient as the types are compatible and
> there is no risk of overflow.
> 
> Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
> ---
>   drivers/accel/ivpu/ivpu_fw.c          | 2 +-
>   drivers/accel/ivpu/ivpu_mmu_context.c | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c
> index 5a8f7dfb54e6..b78b7c35cd9b 100644
> --- a/drivers/accel/ivpu/ivpu_fw.c
> +++ b/drivers/accel/ivpu/ivpu_fw.c
> @@ -318,7 +318,7 @@ static int ivpu_fw_parse(struct ivpu_device *vdev)
>   	fw->shave_nn_size = PAGE_ALIGN(fw_hdr->shave_nn_fw_size);
>   	fw->cold_boot_entry_point = fw_hdr->entry_point;
>   
> -	fw->trace_level = min_t(u32, ivpu_fw_log_level, IVPU_FW_LOG_FATAL);
> +	fw->trace_level = min(ivpu_fw_log_level, IVPU_FW_LOG_FATAL);
>   	fw->trace_destination_mask = VPU_TRACE_DESTINATION_VERBOSE_TRACING;
>   	fw->trace_hw_component_mask = -1;
>   
> diff --git a/drivers/accel/ivpu/ivpu_mmu_context.c b/drivers/accel/ivpu/ivpu_mmu_context.c
> index c4014c83e727..bb3ca81838e3 100644
> --- a/drivers/accel/ivpu/ivpu_mmu_context.c
> +++ b/drivers/accel/ivpu/ivpu_mmu_context.c
> @@ -588,8 +588,8 @@ void ivpu_mmu_context_init(struct ivpu_device *vdev, struct ivpu_mmu_context *ct
>   		start = vdev->hw->ranges.runtime.start;
>   		end = vdev->hw->ranges.shave.end;
>   	} else {
> -		start = min_t(u64, vdev->hw->ranges.user.start, vdev->hw->ranges.shave.start);
> -		end = max_t(u64, vdev->hw->ranges.user.end, vdev->hw->ranges.dma.end);
> +		start = min(vdev->hw->ranges.user.start, vdev->hw->ranges.shave.start);
> +		end = max(vdev->hw->ranges.user.end, vdev->hw->ranges.dma.end);
>   	}
>   
>   	drm_mm_init(&ctx->mm, start, end - start);

Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com>

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

* Re: [PATCH] accel/ivpu: Remove unnecessary min_t()/max_t() usage
  2026-07-16 13:29 ` Wachowski, Karol
@ 2026-07-17  8:17   ` Wachowski, Karol
  0 siblings, 0 replies; 3+ messages in thread
From: Wachowski, Karol @ 2026-07-17  8:17 UTC (permalink / raw)
  To: Andrzej Kacprowski, dri-devel; +Cc: oded.gabbay, jeff.hugo, lizhi.hou

On 16-Jul-26 15:29, Wachowski, Karol wrote:
> On 16-Jul-26 10:33, Andrzej Kacprowski wrote:
>> Remove unnecessary min_t()/max_t() usage in ivpu_fw.c
>> and ivpu_mmu_context.c. The min()/max() macros are
>> sufficient as the types are compatible and
>> there is no risk of overflow.
>>
>> Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
>> ---
>>   drivers/accel/ivpu/ivpu_fw.c          | 2 +-
>>   drivers/accel/ivpu/ivpu_mmu_context.c | 4 ++--
>>   2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c
>> index 5a8f7dfb54e6..b78b7c35cd9b 100644
>> --- a/drivers/accel/ivpu/ivpu_fw.c
>> +++ b/drivers/accel/ivpu/ivpu_fw.c
>> @@ -318,7 +318,7 @@ static int ivpu_fw_parse(struct ivpu_device *vdev)
>>       fw->shave_nn_size = PAGE_ALIGN(fw_hdr->shave_nn_fw_size);
>>       fw->cold_boot_entry_point = fw_hdr->entry_point;
>> -    fw->trace_level = min_t(u32, ivpu_fw_log_level, IVPU_FW_LOG_FATAL);
>> +    fw->trace_level = min(ivpu_fw_log_level, IVPU_FW_LOG_FATAL);
>>       fw->trace_destination_mask = VPU_TRACE_DESTINATION_VERBOSE_TRACING;
>>       fw->trace_hw_component_mask = -1;
>> diff --git a/drivers/accel/ivpu/ivpu_mmu_context.c b/drivers/accel/ 
>> ivpu/ivpu_mmu_context.c
>> index c4014c83e727..bb3ca81838e3 100644
>> --- a/drivers/accel/ivpu/ivpu_mmu_context.c
>> +++ b/drivers/accel/ivpu/ivpu_mmu_context.c
>> @@ -588,8 +588,8 @@ void ivpu_mmu_context_init(struct ivpu_device 
>> *vdev, struct ivpu_mmu_context *ct
>>           start = vdev->hw->ranges.runtime.start;
>>           end = vdev->hw->ranges.shave.end;
>>       } else {
>> -        start = min_t(u64, vdev->hw->ranges.user.start, vdev->hw- 
>> >ranges.shave.start);
>> -        end = max_t(u64, vdev->hw->ranges.user.end, vdev->hw- 
>> >ranges.dma.end);
>> +        start = min(vdev->hw->ranges.user.start, vdev->hw- 
>> >ranges.shave.start);
>> +        end = max(vdev->hw->ranges.user.end, vdev->hw->ranges.dma.end);
>>       }
>>       drm_mm_init(&ctx->mm, start, end - start);
> 
> Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com>

Pushed to drm-misc-next.

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

end of thread, other threads:[~2026-07-17  8:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16  8:33 [PATCH] accel/ivpu: Remove unnecessary min_t()/max_t() usage Andrzej Kacprowski
2026-07-16 13:29 ` Wachowski, Karol
2026-07-17  8:17   ` Wachowski, Karol

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