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

Commit 7f82f804 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

drivers: soc: qcom: Enable EUD only after initialization



When EUD is enabled through the command line, since command
line parameters are set early in the boot sequence, it is
possible for the EUD enabling function to be called, before
the necessary data structures are initialized. Allow enabling
function to be called only if EUD has been initialized at the
time the enabling function is invoked.

Change-Id: If8f6c425aad609bd7ea9f1b028f7ee30a060a308
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent 76154d31
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -83,6 +83,7 @@ static const unsigned int eud_extcon_cable[] = {
 * EUD is disabled by default.
 * EUD is disabled by default.
 */
 */
static int enable;
static int enable;
static bool eud_ready;
static struct platform_device *eud_private;
static struct platform_device *eud_private;


static void enable_eud(struct platform_device *pdev)
static void enable_eud(struct platform_device *pdev)
@@ -157,6 +158,10 @@ static int param_eud_set(const char *val, const struct kernel_param *kp)
	if (enable != EUD_ENABLE_CMD && enable != EUD_DISABLE_CMD)
	if (enable != EUD_ENABLE_CMD && enable != EUD_DISABLE_CMD)
		return -EINVAL;
		return -EINVAL;


	*((uint *)kp->arg) = enable;
	if (!eud_ready)
		return 0;

	if (enable == EUD_ENABLE_CMD) {
	if (enable == EUD_ENABLE_CMD) {
		pr_debug("%s: Enbling EUD\n", __func__);
		pr_debug("%s: Enbling EUD\n", __func__);
		enable_eud(eud_private);
		enable_eud(eud_private);
@@ -165,7 +170,6 @@ static int param_eud_set(const char *val, const struct kernel_param *kp)
		disable_eud(eud_private);
		disable_eud(eud_private);
	}
	}


	*((uint *)kp->arg) = enable;
	return 0;
	return 0;
}
}


@@ -532,6 +536,7 @@ static int msm_eud_probe(struct platform_device *pdev)
	}
	}


	eud_private = pdev;
	eud_private = pdev;
	eud_ready = true;


	/* Enable EUD */
	/* Enable EUD */
	if (enable)
	if (enable)