OSDN Git Service

iommu: arm-smmu: update regulator notification for SMMU
authorJaydeep Sen <jsen@codeaurora.org>
Sun, 8 Nov 2015 11:23:13 +0000 (16:53 +0530)
committerDavid Keitel <dkeitel@codeaurora.org>
Tue, 22 Mar 2016 18:14:31 +0000 (11:14 -0700)
The SMMU halt needs to be accessed before regulator is disabled. So move
notification from REGULATOR_EVENT_DISABLE to REGULATOR_EVENT_PRE_DISABLE.

Regulator framework will notify client on other events too, return
NOTIFY_OK.

Change-Id: Ieed950418d5afc6f5b84b13131ef39964f3168e2
Signed-off-by: Jaydeep Sen <jsen@codeaurora.org>
drivers/iommu/arm-smmu.c

index 6d5841c..e2fdd7b 100644 (file)
@@ -2932,6 +2932,13 @@ static int regulator_notifier(struct notifier_block *nb,
        struct arm_smmu_device *smmu = container_of(nb,
                                        struct arm_smmu_device, regulator_nb);
 
+       /* Ignore EVENT DISABLE as no clocks could be turned on
+        * at this notification.
+       */
+       if (event != REGULATOR_EVENT_PRE_DISABLE &&
+                               event != REGULATOR_EVENT_ENABLE)
+               return NOTIFY_OK;
+
        ret = arm_smmu_prepare_clocks(smmu);
        if (ret)
                goto out;
@@ -2940,7 +2947,7 @@ static int regulator_notifier(struct notifier_block *nb,
        if (ret)
                goto unprepare_clock;
 
-       if (event == REGULATOR_EVENT_DISABLE)
+       if (event == REGULATOR_EVENT_PRE_DISABLE)
                arm_smmu_halt(smmu);
        else if (event == REGULATOR_EVENT_ENABLE)
                arm_smmu_resume(smmu);
@@ -2949,7 +2956,7 @@ static int regulator_notifier(struct notifier_block *nb,
 unprepare_clock:
        arm_smmu_unprepare_clocks(smmu);
 out:
-       return ret;
+       return NOTIFY_OK;
 }
 
 static int register_regulator_notifier(struct arm_smmu_device *smmu)