Skip to content

Commit 589899e

Browse files
nicolincjgunthorpe
authored andcommitted
iommu/tegra241-cmdqv: Simplify deinit flow in tegra241_cmdqv_remove_vintf()
The current flow of tegra241_cmdqv_remove_vintf() is: 1. For each LVCMDQ, tegra241_vintf_remove_lvcmdq(): a. Disable the LVCMDQ HW b. Release the LVCMDQ SW resource 2. For current VINTF, tegra241_vintf_hw_deinit(): c. Disable all LVCMDQ HWs d. Disable VINTF HW Obviously, the step 1.a and the step 2.c are redundant. Since tegra241_vintf_hw_deinit() disables all of its LVCMDQ HWs, it could simplify the flow in tegra241_cmdqv_remove_vintf() by calling that first: 1. For current VINTF, tegra241_vintf_hw_deinit(): a. Disable all LVCMDQ HWs b. Disable VINTF HW 2. Release all LVCMDQ SW resources Drop tegra241_vintf_remove_lvcmdq(), and move tegra241_vintf_free_lvcmdq() as the new step 2. Link: https://patch.msgid.link/r/86c97c8c4ee9ca192e7e7fa3007c10399d792ce6.1752126748.git.nicolinc@nvidia.com Acked-by: Pranjal Shrivastava <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Signed-off-by: Nicolin Chen <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 1eb4687 commit 589899e

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -628,24 +628,17 @@ static int tegra241_cmdqv_init_vintf(struct tegra241_cmdqv *cmdqv, u16 max_idx,
628628

629629
/* Remove Helpers */
630630

631-
static void tegra241_vintf_remove_lvcmdq(struct tegra241_vintf *vintf, u16 lidx)
632-
{
633-
tegra241_vcmdq_hw_deinit(vintf->lvcmdqs[lidx]);
634-
tegra241_vintf_free_lvcmdq(vintf, lidx);
635-
}
636-
637631
static void tegra241_cmdqv_remove_vintf(struct tegra241_cmdqv *cmdqv, u16 idx)
638632
{
639633
struct tegra241_vintf *vintf = cmdqv->vintfs[idx];
640634
u16 lidx;
641635

636+
tegra241_vintf_hw_deinit(vintf);
637+
642638
/* Remove LVCMDQ resources */
643639
for (lidx = 0; lidx < vintf->cmdqv->num_lvcmdqs_per_vintf; lidx++)
644640
if (vintf->lvcmdqs[lidx])
645-
tegra241_vintf_remove_lvcmdq(vintf, lidx);
646-
647-
/* Remove VINTF resources */
648-
tegra241_vintf_hw_deinit(vintf);
641+
tegra241_vintf_free_lvcmdq(vintf, lidx);
649642

650643
dev_dbg(cmdqv->dev, "VINTF%u: deallocated\n", vintf->idx);
651644
tegra241_cmdqv_deinit_vintf(cmdqv, idx);

0 commit comments

Comments
 (0)