Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[firefly-linux-kernel-4.4.55.git] / drivers / staging / android / fiq_debugger / fiq_debugger.c
index b132cff14f01c8a3ca59271651269fac50c0faba..c9a38705f3ad402c1ea576273ade1570205ca292 100644 (file)
@@ -499,6 +499,8 @@ static bool fiq_debugger_fiq_exec(struct fiq_debugger_state *state,
                if (*cmd) {
                        char tmp_cmd[32];
                        strlcpy(tmp_cmd, cmd, sizeof(tmp_cmd));
+                       blocking_notifier_call_chain(&reboot_notifier_list,
+                                               SYS_RESTART, (char *)cmd);
                        machine_restart(tmp_cmd);
                } else {
                        machine_restart(NULL);
@@ -645,7 +647,7 @@ static bool fiq_debugger_handle_uart_interrupt(struct fiq_debugger_state *state,
        int count = 0;
        bool signal_helper = false;
 
-       if (this_cpu != state->current_cpu) {
+       if ((this_cpu != state->current_cpu) && (cpu_online(state->current_cpu))) {
                if (state->in_fiq)
                        return false;
 
@@ -663,6 +665,9 @@ static bool fiq_debugger_handle_uart_interrupt(struct fiq_debugger_state *state,
                return false;
        }
 
+       if (this_cpu != state->current_cpu)
+               state->current_cpu = this_cpu;
+
        state->in_fiq = true;
 
        while ((c = fiq_debugger_getc(state)) != FIQ_DEBUGGER_NO_CHAR) {
@@ -811,6 +816,13 @@ static void fiq_debugger_console_write(struct console *co,
        if (!state->console_enable && !state->syslog_dumping)
                return;
 
+#ifdef CONFIG_RK_CONSOLE_THREAD
+       if (state->pdata->console_write) {
+               state->pdata->console_write(state->pdev, s, count);
+               return;
+       }
+#endif
+
        fiq_debugger_uart_enable(state);
        spin_lock_irqsave(&state->console_lock, flags);
        while (count--) {