From 1c38c5a8978ad267081b62f2fa7b2a33f5afbdc1 Mon Sep 17 00:00:00 2001 From: Pranav Vashi Date: Mon, 17 Dec 2018 01:18:07 +0530 Subject: [PATCH] power: Fix compilation without QCOM_DLOAD_MODE * Add ifdef for OP additions. Signed-off-by: Pranav Vashi --- drivers/power/reset/msm-poweroff.c | 16 +++++++++++++++- kernel/reboot.c | 5 ++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c index 09ade6adbfe9..c8aa19223a54 100644 --- a/drivers/power/reset/msm-poweroff.c +++ b/drivers/power/reset/msm-poweroff.c @@ -104,10 +104,12 @@ struct reset_attribute { module_param_call(download_mode, dload_set, param_get_int, &download_mode, 0644); +#ifdef CONFIG_QCOM_DLOAD_MODE int oem_get_download_mode(void) { return download_mode; } +#endif static int panic_prep_restart(struct notifier_block *this, unsigned long event, void *ptr) @@ -157,12 +159,14 @@ static void set_dload_mode(int on) ret = scm_set_dload_mode(on ? dload_type : 0, 0); if (ret) pr_err("Failed to set secure DLOAD mode: %d\n", ret); +#ifdef CONFIG_QCOM_DLOAD_MODE if (on) qpnp_pon_set_restart_reason(0x00); else qpnp_pon_set_restart_reason(PON_RESTART_REASON_PANIC); if (!on) scm_disable_sdi(); +#endif dload_mode_enabled = on; } @@ -286,7 +290,9 @@ static void halt_spmi_pmic_arbiter(void) static void msm_restart_prepare(const char *cmd) { bool need_warm_reset = false; +#ifdef CONFIG_QCOM_DLOAD_MODE bool oem_panic_record = false; +#endif #ifdef CONFIG_QCOM_DLOAD_MODE @@ -310,13 +316,17 @@ static void msm_restart_prepare(const char *cmd) need_warm_reset = (get_dload_mode() || (cmd != NULL && cmd[0] != '\0')); } +#ifdef CONFIG_QCOM_DLOAD_MODE if (!download_mode && (in_panic || restart_mode == RESTART_DLOAD)) { oem_panic_record = true; } qpnp_pon_set_restart_reason(0x00); + need_warm_reset == need_warm_reset || oem_panic_record; +#endif + /* Hard reset the PMIC unless memory contents must be maintained. */ - if (need_warm_reset || oem_panic_record) { + if (need_warm_reset) { qpnp_pon_system_pwr_off(PON_POWER_OFF_WARM_RESET); } else { qpnp_pon_system_pwr_off(PON_POWER_OFF_HARD_RESET); @@ -402,10 +412,12 @@ static void msm_restart_prepare(const char *cmd) } } +#ifdef CONFIG_QCOM_DLOAD_MODE if (oem_panic_record) { qpnp_pon_set_restart_reason(PON_RESTART_REASON_PANIC); __raw_writel(OEM_PANIC, restart_reason); } +#endif flush_cache_all(); /*outer_flush_all is not supported by 64bit kernel*/ @@ -467,7 +479,9 @@ static void do_msm_poweroff(void) pr_notice("Powering off the SoC\n"); set_dload_mode(0); +#ifdef CONFIG_QCOM_DLOAD_MODE qpnp_pon_set_restart_reason(0x00); +#endif scm_disable_sdi(); qpnp_pon_system_pwr_off(PON_POWER_OFF_SHUTDOWN); diff --git a/kernel/reboot.c b/kernel/reboot.c index eff59767e84b..8b9eeed2720d 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -16,8 +16,10 @@ #include #include #include +#ifdef CONFIG_QCOM_DLOAD_MODE #include #include +#endif /* * this indicates whether you can reboot with ctrl-alt-del: the default is yes @@ -46,7 +48,6 @@ int reboot_cpu; enum reboot_type reboot_type = BOOT_ACPI; int reboot_force; - /* * If set, this is used for preparing the system to power off. */ @@ -224,6 +225,7 @@ void kernel_restart(char *cmd) else pr_emerg("Restarting system with command '%s'\n", cmd); +#ifdef CONFIG_QCOM_DLOAD_MODE /*if enable dump, if dm-verity device corrupted, force enter dump */ if (oem_get_download_mode()) { if (((cmd != NULL && cmd[0] != '\0') && @@ -233,6 +235,7 @@ void kernel_restart(char *cmd) msleep(10000); } } +#endif kmsg_dump(KMSG_DUMP_RESTART); machine_restart(cmd);