@@ -546,13 +546,6 @@ static int serial8250_em485_init(struct uart_8250_port *p)
546
546
if (!p -> em485 )
547
547
return - ENOMEM ;
548
548
549
- #ifndef CONFIG_SERIAL_8250_LEGACY_CONSOLE
550
- if (uart_console (& p -> port )) {
551
- dev_warn (p -> port .dev , "no atomic printing for rs485 consoles\n" );
552
- p -> port .cons -> write_atomic = NULL ;
553
- }
554
- #endif
555
-
556
549
hrtimer_init (& p -> em485 -> stop_tx_timer , CLOCK_MONOTONIC ,
557
550
HRTIMER_MODE_REL );
558
551
hrtimer_init (& p -> em485 -> start_tx_timer , CLOCK_MONOTONIC ,
@@ -698,23 +691,14 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
698
691
serial8250_rpm_put (p );
699
692
}
700
693
701
- /*
702
- * Only to be used by write_atomic() and the legacy write(), which do not
703
- * require port lock.
704
- */
705
- static void __serial8250_clear_IER (struct uart_8250_port * up )
694
+ static void serial8250_clear_IER (struct uart_8250_port * up )
706
695
{
707
696
if (up -> capabilities & UART_CAP_UUE )
708
697
serial_out (up , UART_IER , UART_IER_UUE );
709
698
else
710
699
serial_out (up , UART_IER , 0 );
711
700
}
712
701
713
- static inline void serial8250_clear_IER (struct uart_8250_port * up )
714
- {
715
- __serial8250_clear_IER (up );
716
- }
717
-
718
702
#ifdef CONFIG_SERIAL_8250_RSA
719
703
/*
720
704
* Attempts to turn on the RSA FIFO. Returns zero on failure.
@@ -3285,11 +3269,6 @@ static void serial8250_console_putchar(struct uart_port *port, unsigned char ch)
3285
3269
3286
3270
wait_for_xmitr (up , UART_LSR_THRE );
3287
3271
serial_port_out (port , UART_TX , ch );
3288
-
3289
- if (ch == '\n' )
3290
- up -> console_newline_needed = false;
3291
- else
3292
- up -> console_newline_needed = true;
3293
3272
}
3294
3273
3295
3274
/*
@@ -3318,7 +3297,6 @@ static void serial8250_console_restore(struct uart_8250_port *up)
3318
3297
serial8250_out_MCR (up , up -> mcr | UART_MCR_DTR | UART_MCR_RTS );
3319
3298
}
3320
3299
3321
- #ifdef CONFIG_SERIAL_8250_LEGACY_CONSOLE
3322
3300
/*
3323
3301
* Print a string to the serial port using the device FIFO
3324
3302
*
@@ -3377,7 +3355,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
3377
3355
* First save the IER then disable the interrupts
3378
3356
*/
3379
3357
ier = serial_port_in (port , UART_IER );
3380
- __serial8250_clear_IER (up );
3358
+ serial8250_clear_IER (up );
3381
3359
3382
3360
/* check scratch reg to see if port powered off during system sleep */
3383
3361
if (up -> canary && (up -> canary != serial_port_in (port , UART_SCR ))) {
@@ -3443,131 +3421,6 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
3443
3421
if (locked )
3444
3422
uart_port_unlock_irqrestore (port , flags );
3445
3423
}
3446
- #else
3447
- void serial8250_console_write_thread (struct uart_8250_port * up ,
3448
- struct nbcon_write_context * wctxt )
3449
- {
3450
- struct uart_8250_em485 * em485 = up -> em485 ;
3451
- struct uart_port * port = & up -> port ;
3452
- unsigned int ier ;
3453
-
3454
- touch_nmi_watchdog ();
3455
-
3456
- if (!nbcon_enter_unsafe (wctxt ))
3457
- return ;
3458
-
3459
- /* First save IER then disable the interrupts. */
3460
- ier = serial_port_in (port , UART_IER );
3461
- serial8250_clear_IER (up );
3462
-
3463
- /* Check scratch reg if port powered off during system sleep. */
3464
- if (up -> canary && (up -> canary != serial_port_in (port , UART_SCR ))) {
3465
- serial8250_console_restore (up );
3466
- up -> canary = 0 ;
3467
- }
3468
-
3469
- if (em485 ) {
3470
- if (em485 -> tx_stopped )
3471
- up -> rs485_start_tx (up );
3472
- mdelay (port -> rs485 .delay_rts_before_send );
3473
- }
3474
-
3475
- if (nbcon_exit_unsafe (wctxt )) {
3476
- int len = READ_ONCE (wctxt -> len );
3477
- int i ;
3478
-
3479
- /*
3480
- * Write out the message. Toggle unsafe for each byte in order
3481
- * to give another (higher priority) context the opportunity
3482
- * for a friendly takeover. If such a takeover occurs, this
3483
- * context must reacquire ownership in order to perform final
3484
- * actions (such as re-enabling the interrupts).
3485
- *
3486
- * IMPORTANT: wctxt->outbuf and wctxt->len are no longer valid
3487
- * after a reacquire so writing the message must be
3488
- * aborted.
3489
- */
3490
- for (i = 0 ; i < len ; i ++ ) {
3491
- if (!nbcon_enter_unsafe (wctxt )) {
3492
- nbcon_reacquire_nobuf (wctxt );
3493
- break ;
3494
- }
3495
-
3496
- uart_console_write (port , wctxt -> outbuf + i , 1 , serial8250_console_putchar );
3497
-
3498
- if (!nbcon_exit_unsafe (wctxt )) {
3499
- nbcon_reacquire_nobuf (wctxt );
3500
- break ;
3501
- }
3502
- }
3503
- } else {
3504
- nbcon_reacquire_nobuf (wctxt );
3505
- }
3506
-
3507
- while (!nbcon_enter_unsafe (wctxt ))
3508
- nbcon_reacquire_nobuf (wctxt );
3509
-
3510
- /* Finally, wait for transmitter to become empty and restore IER. */
3511
- wait_for_xmitr (up , UART_LSR_BOTH_EMPTY );
3512
- if (em485 ) {
3513
- mdelay (port -> rs485 .delay_rts_after_send );
3514
- if (em485 -> tx_stopped )
3515
- up -> rs485_stop_tx (up );
3516
- }
3517
- serial_port_out (port , UART_IER , ier );
3518
-
3519
- /*
3520
- * The receive handling will happen properly because the receive ready
3521
- * bit will still be set; it is not cleared on read. However, modem
3522
- * control will not, we must call it if we have saved something in the
3523
- * saved flags while processing with interrupts off.
3524
- */
3525
- if (up -> msr_saved_flags )
3526
- serial8250_modem_status (up );
3527
-
3528
- nbcon_exit_unsafe (wctxt );
3529
- }
3530
-
3531
- void serial8250_console_write_atomic (struct uart_8250_port * up ,
3532
- struct nbcon_write_context * wctxt )
3533
- {
3534
- struct uart_port * port = & up -> port ;
3535
- unsigned int ier ;
3536
-
3537
- /* Atomic console not supported for rs485 mode. */
3538
- if (WARN_ON_ONCE (up -> em485 ))
3539
- return ;
3540
-
3541
- touch_nmi_watchdog ();
3542
-
3543
- if (!nbcon_enter_unsafe (wctxt ))
3544
- return ;
3545
-
3546
- /*
3547
- * First save IER then disable the interrupts. The special variant to
3548
- * clear IER is used because atomic printing may occur without holding
3549
- * the port lock.
3550
- */
3551
- ier = serial_port_in (port , UART_IER );
3552
- __serial8250_clear_IER (up );
3553
-
3554
- /* Check scratch reg if port powered off during system sleep. */
3555
- if (up -> canary && (up -> canary != serial_port_in (port , UART_SCR ))) {
3556
- serial8250_console_restore (up );
3557
- up -> canary = 0 ;
3558
- }
3559
-
3560
- if (up -> console_newline_needed )
3561
- uart_console_write (port , "\n" , 1 , serial8250_console_putchar );
3562
- uart_console_write (port , wctxt -> outbuf , wctxt -> len , serial8250_console_putchar );
3563
-
3564
- /* Finally, wait for transmitter to become empty and restore IER. */
3565
- wait_for_xmitr (up , UART_LSR_BOTH_EMPTY );
3566
- serial_port_out (port , UART_IER , ier );
3567
-
3568
- nbcon_exit_unsafe (wctxt );
3569
- }
3570
- #endif /* CONFIG_SERIAL_8250_LEGACY_CONSOLE */
3571
3424
3572
3425
static unsigned int probe_baud (struct uart_port * port )
3573
3426
{
@@ -3586,7 +3439,6 @@ static unsigned int probe_baud(struct uart_port *port)
3586
3439
3587
3440
int serial8250_console_setup (struct uart_port * port , char * options , bool probe )
3588
3441
{
3589
- struct uart_8250_port * up = up_to_u8250p (port );
3590
3442
int baud = 9600 ;
3591
3443
int bits = 8 ;
3592
3444
int parity = 'n' ;
@@ -3596,8 +3448,6 @@ int serial8250_console_setup(struct uart_port *port, char *options, bool probe)
3596
3448
if (!port -> iobase && !port -> membase )
3597
3449
return - ENODEV ;
3598
3450
3599
- up -> console_newline_needed = false;
3600
-
3601
3451
if (options )
3602
3452
uart_parse_options (options , & baud , & parity , & bits , & flow );
3603
3453
else if (probe )
0 commit comments