Commit 21fd9be4 authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by Joerg Roedel
Browse files

iommu/mediatek: Cleanup pericfg lookup flow



Since only the INFRA type IOMMU needs to modify register(s) in the
pericfg iospace, it's safe to drop the pericfg_comp_str NULL check;
also, directly assign the regmap handle to data->pericfg instead of
to the infracfg variable to improve code readability.

Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
Link: https://lore.kernel.org/r/20220616110830.26037-6-angelogioacchino.delregno@collabora.com


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 7d748ffd
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -1217,15 +1217,13 @@ static int mtk_iommu_probe(struct platform_device *pdev)
			dev_err(dev, "mm dts parse fail(%d).", ret);
			goto out_runtime_disable;
		}
	} else if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_INFRA) &&
		   data->plat_data->pericfg_comp_str) {
		infracfg = syscon_regmap_lookup_by_compatible(data->plat_data->pericfg_comp_str);
		if (IS_ERR(infracfg)) {
			ret = PTR_ERR(infracfg);
	} else if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_INFRA)) {
		p = data->plat_data->pericfg_comp_str;
		data->pericfg = syscon_regmap_lookup_by_compatible(p);
		if (IS_ERR(data->pericfg)) {
			ret = PTR_ERR(data->pericfg);
			goto out_runtime_disable;
		}

		data->pericfg = infracfg;
	}

	platform_set_drvdata(pdev, data);