diff options
author | Vaibhav Hiremath <vaibhav.hiremath@linaro.org> | 2016-02-22 17:27:26 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-02-23 22:43:06 -0800 |
commit | c5e7cbaf3ab8842278a9162dfaf04464ce21f0e4 (patch) | |
tree | c2f70143814cfc0df03451408cebdf4108bc9c00 | |
parent | 25847ee7c9517f91323f9139713ebdc94c865a2e (diff) |
greybus: arche-apb-ctrl: Return immediately if in same state from state change fns
Have a check inside all individual operational state change functions
to check whether device is in same state, and if yes, then return
immediately.
Testing Done: Tested on DB3.5 platform.
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r-- | drivers/staging/greybus/arche-apb-ctrl.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c index 3086306f04fb..c2f0776f04f4 100644 --- a/drivers/staging/greybus/arche-apb-ctrl.c +++ b/drivers/staging/greybus/arche-apb-ctrl.c @@ -67,7 +67,8 @@ static int coldboot_seq(struct platform_device *pdev) struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev); int ret; - if (apb->init_disabled) + if (apb->init_disabled || + apb->state == ARCHE_PLATFORM_STATE_ACTIVE) return 0; /* Hold APB in reset state */ @@ -112,7 +113,8 @@ static int fw_flashing_seq(struct platform_device *pdev) struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev); int ret; - if (apb->init_disabled) + if (apb->init_disabled || + apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING) return 0; ret = regulator_enable(apb->vcore); @@ -141,8 +143,9 @@ static int standby_boot_seq(struct platform_device *pdev) if (apb->init_disabled) return 0; - /* If it is in OFF state, then we do not want to change the state */ - if (apb->state == ARCHE_PLATFORM_STATE_OFF) + /* Even if it is in OFF state, then we do not want to change the state */ + if (apb->state == ARCHE_PLATFORM_STATE_STANDBY || + apb->state == ARCHE_PLATFORM_STATE_OFF) return 0; /* @@ -162,7 +165,7 @@ static void poweroff_seq(struct platform_device *pdev) { struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev); - if (apb->init_disabled) + if (apb->init_disabled || apb->state == ARCHE_PLATFORM_STATE_OFF) return; /* disable the clock */ |