Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5e7cbaf authored by Vaibhav Hiremath's avatar Vaibhav Hiremath Committed by Greg Kroah-Hartman
Browse files

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: default avatarVaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 25847ee7
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -67,7 +67,8 @@ static int coldboot_seq(struct platform_device *pdev)
	struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev);
	struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev);
	int ret;
	int ret;


	if (apb->init_disabled)
	if (apb->init_disabled ||
			apb->state == ARCHE_PLATFORM_STATE_ACTIVE)
		return 0;
		return 0;


	/* Hold APB in reset state */
	/* 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);
	struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev);
	int ret;
	int ret;


	if (apb->init_disabled)
	if (apb->init_disabled ||
			apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
		return 0;
		return 0;


	ret = regulator_enable(apb->vcore);
	ret = regulator_enable(apb->vcore);
@@ -141,8 +143,9 @@ static int standby_boot_seq(struct platform_device *pdev)
	if (apb->init_disabled)
	if (apb->init_disabled)
		return 0;
		return 0;


	/* If it is in OFF state, then we do not want to change the state */
	/* Even if it is in OFF state, then we do not want to change the state */
	if (apb->state == ARCHE_PLATFORM_STATE_OFF)
	if (apb->state == ARCHE_PLATFORM_STATE_STANDBY ||
			apb->state == ARCHE_PLATFORM_STATE_OFF)
		return 0;
		return 0;


	/*
	/*
@@ -162,7 +165,7 @@ static void poweroff_seq(struct platform_device *pdev)
{
{
	struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(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;
		return;


	/* disable the clock */
	/* disable the clock */