hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/soc/rockchip/fiq_debugger/rk_fiq_debugger.c
....@@ -179,11 +179,13 @@
179179
180180 if (lsr & UART_LSR_DR) {
181181 temp = rk_fiq_read(t, UART_RX);
182
- buf[n & 0x1f] = temp;
183
- n++;
184
- if (temp == 'q' && n > 2) {
185
- if ((buf[(n - 2) & 0x1f] == 'i') &&
186
- (buf[(n - 3) & 0x1f] == 'f'))
182
+ buf[++n & 0x1f] = temp;
183
+
184
+ if (temp == 'q') {
185
+ if ((buf[(n - 1) & 0x1f] == 'i') &&
186
+ (buf[(n - 2) & 0x1f] == 'f') &&
187
+ (buf[(n - 3) & 0x1f] != '_') &&
188
+ (buf[(n - 3) & 0x1f] != ' '))
187189 return FIQ_DEBUGGER_BREAK;
188190 else
189191 return temp;
....@@ -334,7 +336,7 @@
334336 unsigned int dropped;
335337
336338 set_current_state(TASK_INTERRUPTIBLE);
337
- if (kfifo_is_empty(&fifo) && kfifo_is_empty(&tty_fifo)) {
339
+ if (console_thread_stop || (kfifo_is_empty(&fifo) && kfifo_is_empty(&tty_fifo))) {
338340 smp_store_mb(console_thread_running, false);
339341 schedule();
340342 smp_store_mb(console_thread_running, true);
....@@ -344,13 +346,13 @@
344346 set_current_state(TASK_RUNNING);
345347
346348 while (!console_thread_stop && (!kfifo_is_empty(&fifo) || !kfifo_is_empty(&tty_fifo))) {
347
- while (kfifo_get(&fifo, &c)) {
349
+ while (!console_thread_stop && kfifo_get(&fifo, &c)) {
348350 console_put(pdev, &c, 1);
349351 if (c == '\n')
350352 break;
351353 }
352354
353
- while (kfifo_get(&tty_fifo, &c)) {
355
+ while (!console_thread_stop && kfifo_get(&tty_fifo, &c)) {
354356 console_putc(pdev, c);
355357 len_tty++;
356358 if (c == '\n')
....@@ -418,6 +420,8 @@
418420 unsigned int ret = 0;
419421 struct rk_fiq_debugger *t;
420422
423
+ if (console_thread_stop)
424
+ return count;
421425 t = container_of(dev_get_platdata(&pdev->dev), typeof(*t), pdata);
422426
423427 if (count > 0) {