diff options
| author | Rohit Vaswani <rvaswani@codeaurora.org> | 2015-08-28 15:33:14 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:14:15 -0700 |
| commit | 25e3f17849ed58dfec963407b024e6e7ba1a3a29 (patch) | |
| tree | 3501de44bd0401bd00799f66a0dfc76da55f474e | |
| parent | 6408533e2a05f8d34e07a3d49d72394b76a20387 (diff) | |
iommu/arm-smmu: Reorganize code to allow no gdsc
Some SMMUs may not have a dedicated gdsc for it.
Allow for the enable code to prepare clocks and vote
for bus requests even if there is no gdsc provided.
Change-Id: Iaedfb73d8ae7f12895472893468e5c32d2bf2462
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
| -rw-r--r-- | drivers/iommu/arm-smmu.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index f4fc6f951648..9d8c7dc4de7a 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -751,11 +751,10 @@ static int arm_smmu_unrequest_bus(struct arm_smmu_device *smmu) static int arm_smmu_disable_regulators(struct arm_smmu_device *smmu) { - if (!smmu->gdsc) - return 0; - arm_smmu_unprepare_clocks(smmu); arm_smmu_unrequest_bus(smmu); + if (!smmu->gdsc) + return 0; return regulator_disable(smmu->gdsc); } @@ -763,25 +762,27 @@ static int arm_smmu_enable_regulators(struct arm_smmu_device *smmu) { int ret; - if (!smmu->gdsc) - return 0; - - ret = regulator_enable(smmu->gdsc); - if (ret) - return ret; + if (smmu->gdsc) { + ret = regulator_enable(smmu->gdsc); + if (ret) + goto out; + } ret = arm_smmu_request_bus(smmu); - if (ret) { - regulator_disable(smmu->gdsc); - goto out; - } + if (ret) + goto out_reg; ret = arm_smmu_prepare_clocks(smmu); - if (ret) { - arm_smmu_unrequest_bus(smmu); - regulator_disable(smmu->gdsc); - } + if (ret) + goto out_bus; + + return ret; +out_bus: + arm_smmu_unrequest_bus(smmu); +out_reg: + if (smmu->gdsc) + regulator_disable(smmu->gdsc); out: return ret; } |
