iommu/arm-smmu: Only prepare clocks when necessary
arm_smmu_enable_regulators also prepares all of our clocks (similarly for arm_smmu_disable_regulators), and is always called from arm_smmu_enable_clocks. arm_smmu_enable_clocks, also prepares our clocks, so clocks are being prepared twice, which is once more than we need. Fix this by enabling (not preparing) clocks in arm_smmu_enable_clocks, relying on arm_smmu_enable_regulators to prepare the clocks beforehand. Change-Id: Id07848f64a81522e27198d6e708159941b07d444 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
This commit is contained in:
parent
3cd7ba8dd0
commit
3b842460f1
1 changed files with 8 additions and 17 deletions
|
@ -719,33 +719,24 @@ static int arm_smmu_enable_regulators(struct arm_smmu_device *smmu)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int arm_smmu_enable_clocks_atomic(struct arm_smmu_device *smmu);
|
||||
static void arm_smmu_disable_clocks_atomic(struct arm_smmu_device *smmu);
|
||||
|
||||
static int arm_smmu_enable_clocks(struct arm_smmu_device *smmu)
|
||||
{
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
arm_smmu_enable_regulators(smmu);
|
||||
for (i = 0; i < smmu->num_clocks; ++i) {
|
||||
ret = clk_prepare_enable(smmu->clocks[i]);
|
||||
if (ret) {
|
||||
dev_err(smmu->dev,
|
||||
"Couldn't enable and prepare clock #%d\n", i);
|
||||
while (i--)
|
||||
clk_disable_unprepare(smmu->clocks[i]);
|
||||
arm_smmu_disable_regulators(smmu);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ret = arm_smmu_enable_clocks_atomic(smmu);
|
||||
if (ret)
|
||||
arm_smmu_disable_regulators(smmu);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void arm_smmu_disable_clocks(struct arm_smmu_device *smmu)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < smmu->num_clocks; ++i)
|
||||
clk_disable_unprepare(smmu->clocks[i]);
|
||||
|
||||
arm_smmu_disable_clocks_atomic(smmu);
|
||||
arm_smmu_disable_regulators(smmu);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue