Commit 599159b6 authored by Vaibhav Hiremath's avatar Vaibhav Hiremath Committed by Greg Kroah-Hartman

greybus: arche-platform: 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: default avatarVaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 27e18d8c
...@@ -133,6 +133,9 @@ static int arche_platform_coldboot_seq(struct arche_platform_drvdata *arche_pdat ...@@ -133,6 +133,9 @@ static int arche_platform_coldboot_seq(struct arche_platform_drvdata *arche_pdat
{ {
int ret; int ret;
if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE)
return 0;
dev_info(arche_pdata->dev, "Booting from cold boot state\n"); dev_info(arche_pdata->dev, "Booting from cold boot state\n");
svc_reset_onoff(arche_pdata->svc_reset_gpio, svc_reset_onoff(arche_pdata->svc_reset_gpio,
...@@ -159,6 +162,9 @@ static int arche_platform_coldboot_seq(struct arche_platform_drvdata *arche_pdat ...@@ -159,6 +162,9 @@ static int arche_platform_coldboot_seq(struct arche_platform_drvdata *arche_pdat
static void arche_platform_fw_flashing_seq(struct arche_platform_drvdata *arche_pdata) static void arche_platform_fw_flashing_seq(struct arche_platform_drvdata *arche_pdata)
{ {
if (arche_pdata->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
return;
dev_info(arche_pdata->dev, "Switching to FW flashing state\n"); dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
svc_reset_onoff(arche_pdata->svc_reset_gpio, svc_reset_onoff(arche_pdata->svc_reset_gpio,
...@@ -176,6 +182,9 @@ static void arche_platform_fw_flashing_seq(struct arche_platform_drvdata *arche_ ...@@ -176,6 +182,9 @@ static void arche_platform_fw_flashing_seq(struct arche_platform_drvdata *arche_
static void arche_platform_poweroff_seq(struct arche_platform_drvdata *arche_pdata) static void arche_platform_poweroff_seq(struct arche_platform_drvdata *arche_pdata)
{ {
if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF)
return;
/* Send disconnect/detach event to SVC */ /* Send disconnect/detach event to SVC */
gpio_set_value(arche_pdata->wake_detect_gpio, 0); gpio_set_value(arche_pdata->wake_detect_gpio, 0);
usleep_range(100, 200); usleep_range(100, 200);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment