OSDN Git Service

power: reset: Move in_panic handling out of dload mode
authorMichael Bestas <mkbestas@lineageos.org>
Sun, 22 Jul 2018 19:05:13 +0000 (22:05 +0300)
committerArian <arian.kulmer@web.de>
Tue, 19 Nov 2019 14:49:08 +0000 (15:49 +0100)
* Some devices might want to use that logic
  without enabling download mode

Change-Id: Idd4a2cc8a47041740f8d4e9f43bffd84fae5830d

drivers/power/reset/msm-poweroff.c

index 5af1e5e..47b22b7 100644 (file)
@@ -63,6 +63,19 @@ static void scm_disable_sdi(void);
  * So the SDI cannot be re-enabled when it already by-passed.
 */
 
+static int in_panic;
+
+static int panic_prep_restart(struct notifier_block *this,
+                             unsigned long event, void *ptr)
+{
+       in_panic = 1;
+       return NOTIFY_DONE;
+}
+
+static struct notifier_block panic_blk = {
+       .notifier_call  = panic_prep_restart,
+};
+
 #ifdef CONFIG_QCOM_DLOAD_MODE
 #define EDL_MODE_PROP "qcom,msm-imem-emergency_download_mode"
 #define DL_MODE_PROP "qcom,msm-imem-download_mode"
@@ -70,7 +83,6 @@ static void scm_disable_sdi(void);
 #define KASLR_OFFSET_PROP "qcom,msm-imem-kaslr_offset"
 #endif
 
-static int in_panic;
 static int dload_type = SCM_DLOAD_FULLDUMP;
 static int download_mode = 1;
 static struct kobject dload_kobj;
@@ -100,17 +112,6 @@ struct reset_attribute {
 module_param_call(download_mode, dload_set, param_get_int,
                        &download_mode, 0644);
 
-static int panic_prep_restart(struct notifier_block *this,
-                             unsigned long event, void *ptr)
-{
-       in_panic = 1;
-       return NOTIFY_DONE;
-}
-
-static struct notifier_block panic_blk = {
-       .notifier_call  = panic_prep_restart,
-};
-
 int scm_set_dload_mode(int arg1, int arg2)
 {
        struct scm_desc desc = {
@@ -569,11 +570,12 @@ static int msm_restart_probe(struct platform_device *pdev)
        struct device_node *np;
        int ret = 0;
 
+       atomic_notifier_chain_register(&panic_notifier_list, &panic_blk);
+
 #ifdef CONFIG_QCOM_DLOAD_MODE
        if (scm_is_call_available(SCM_SVC_BOOT, SCM_DLOAD_CMD) > 0)
                scm_dload_supported = true;
 
-       atomic_notifier_chain_register(&panic_notifier_list, &panic_blk);
        np = of_find_compatible_node(NULL, NULL, DL_MODE_PROP);
        if (!np) {
                pr_err("unable to find DT imem DLOAD mode node\n");