* [PATCH] drm/panthor: Remove dead code in mmu_hw_do_operation_locked
@ 2025-08-15 10:25 Steven Price
2025-08-15 11:17 ` Daniel Stone
0 siblings, 1 reply; 3+ messages in thread
From: Steven Price @ 2025-08-15 10:25 UTC (permalink / raw)
To: Boris Brezillon, Liviu Dudau, Daniel Stone
Cc: dri-devel, linux-kernel, Karunika Choo, Chia-I Wu, Steven Price
The only callers to mmu_hw_do_operation_locked() pass an 'op' of either
AS_COMAND_FLUSH_MEM or AS_COMMAND_FLUSH_PT. So remove the code paths
that test for other operations and add a drm_WARN_ON() to catch the
posibility of others appearing the future.
Suggested-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Steven Price <steven.price@arm.com>
---
drivers/gpu/drm/panthor/panthor_mmu.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index 367c89aca558..b16f44aec725 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -612,17 +612,12 @@ static int mmu_hw_do_operation_locked(struct panthor_device *ptdev, int as_nr,
* power it up
*/
- if (op != AS_COMMAND_UNLOCK)
- lock_region(ptdev, as_nr, iova, size);
+ drm_WARN_ON(&ptdev->base,
+ op != AS_COMMAND_FLUSH_MEM && op != AS_COMMAND_FLUSH_PT);
- if (op == AS_COMMAND_FLUSH_MEM || op == AS_COMMAND_FLUSH_PT)
- return mmu_hw_do_flush_on_gpu_ctrl(ptdev, as_nr, op);
+ lock_region(ptdev, as_nr, iova, size);
- /* Run the MMU operation */
- write_cmd(ptdev, as_nr, op);
-
- /* Wait for the flush to complete */
- return wait_ready(ptdev, as_nr);
+ return mmu_hw_do_flush_on_gpu_ctrl(ptdev, as_nr, op);
}
static int mmu_hw_do_operation(struct panthor_vm *vm,
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: Remove dead code in mmu_hw_do_operation_locked
2025-08-15 10:25 [PATCH] drm/panthor: Remove dead code in mmu_hw_do_operation_locked Steven Price
@ 2025-08-15 11:17 ` Daniel Stone
2025-08-15 11:25 ` Steven Price
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Stone @ 2025-08-15 11:17 UTC (permalink / raw)
To: Steven Price
Cc: Boris Brezillon, Liviu Dudau, dri-devel, linux-kernel,
Karunika Choo, Chia-I Wu
Hi Steven,
On Fri, 15 Aug 2025 at 11:25, Steven Price <steven.price@arm.com> wrote:
> The only callers to mmu_hw_do_operation_locked() pass an 'op' of either
> AS_COMAND_FLUSH_MEM or AS_COMMAND_FLUSH_PT. So remove the code paths
> that test for other operations and add a drm_WARN_ON() to catch the
> posibility of others appearing the future.
Thanks! I think it would make sense to also inline
mmu_hw_do_flush_on_gpu_ctrl() here though.
Cheers,
Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: Remove dead code in mmu_hw_do_operation_locked
2025-08-15 11:17 ` Daniel Stone
@ 2025-08-15 11:25 ` Steven Price
0 siblings, 0 replies; 3+ messages in thread
From: Steven Price @ 2025-08-15 11:25 UTC (permalink / raw)
To: Daniel Stone
Cc: Boris Brezillon, Liviu Dudau, dri-devel, linux-kernel,
Karunika Choo, Chia-I Wu
On 15/08/2025 12:17, Daniel Stone wrote:
> Hi Steven,
>
> On Fri, 15 Aug 2025 at 11:25, Steven Price <steven.price@arm.com> wrote:
>> The only callers to mmu_hw_do_operation_locked() pass an 'op' of either
>> AS_COMAND_FLUSH_MEM or AS_COMMAND_FLUSH_PT. So remove the code paths
>> that test for other operations and add a drm_WARN_ON() to catch the
>> posibility of others appearing the future.
>
> Thanks! I think it would make sense to also inline
> mmu_hw_do_flush_on_gpu_ctrl() here though.
True, I'll have a go at a proper rewrite of that function to make it
more coherent.
Thanks,
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-15 11:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-15 10:25 [PATCH] drm/panthor: Remove dead code in mmu_hw_do_operation_locked Steven Price
2025-08-15 11:17 ` Daniel Stone
2025-08-15 11:25 ` Steven Price
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®