@@ -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,26 +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
- /* Port locked to synchronize UART_IER access against the console. */
716
- lockdep_assert_held_once (& up -> port .lock );
717
-
718
- __serial8250_clear_IER (up );
719
- }
720
-
721
702
#ifdef CONFIG_SERIAL_8250_RSA
722
703
/*
723
704
* Attempts to turn on the RSA FIFO. Returns zero on failure.
@@ -3288,11 +3269,6 @@ static void serial8250_console_putchar(struct uart_port *port, unsigned char ch)
3288
3269
3289
3270
wait_for_xmitr (up , UART_LSR_THRE );
3290
3271
serial_port_out (port , UART_TX , ch );
3291
-
3292
- if (ch == '\n' )
3293
- up -> console_newline_needed = false;
3294
- else
3295
- up -> console_newline_needed = true;
3296
3272
}
3297
3273
3298
3274
/*
@@ -3321,7 +3297,6 @@ static void serial8250_console_restore(struct uart_8250_port *up)
3321
3297
serial8250_out_MCR (up , up -> mcr | UART_MCR_DTR | UART_MCR_RTS );
3322
3298
}
3323
3299
3324
- #ifdef CONFIG_SERIAL_8250_LEGACY_CONSOLE
3325
3300
/*
3326
3301
* Print a string to the serial port using the device FIFO
3327
3302
*
@@ -3380,7 +3355,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
3380
3355
* First save the IER then disable the interrupts
3381
3356
*/
3382
3357
ier = serial_port_in (port , UART_IER );
3383
- __serial8250_clear_IER (up );
3358
+ serial8250_clear_IER (up );
3384
3359
3385
3360
/* check scratch reg to see if port powered off during system sleep */
3386
3361
if (up -> canary && (up -> canary != serial_port_in (port , UART_SCR ))) {
@@ -3446,131 +3421,6 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
3446
3421
if (locked )
3447
3422
uart_port_unlock_irqrestore (port , flags );
3448
3423
}
3449
- #else
3450
- void serial8250_console_write_thread (struct uart_8250_port * up ,
3451
- struct nbcon_write_context * wctxt )
3452
- {
3453
- struct uart_8250_em485 * em485 = up -> em485 ;
3454
- struct uart_port * port = & up -> port ;
3455
- unsigned int ier ;
3456
-
3457
- touch_nmi_watchdog ();
3458
-
3459
- if (!nbcon_enter_unsafe (wctxt ))
3460
- return ;
3461
-
3462
- /* First save IER then disable the interrupts. */
3463
- ier = serial_port_in (port , UART_IER );
3464
- serial8250_clear_IER (up );
3465
-
3466
- /* Check scratch reg if port powered off during system sleep. */
3467
- if (up -> canary && (up -> canary != serial_port_in (port , UART_SCR ))) {
3468
- serial8250_console_restore (up );
3469
- up -> canary = 0 ;
3470
- }
3471
-
3472
- if (em485 ) {
3473
- if (em485 -> tx_stopped )
3474
- up -> rs485_start_tx (up );
3475
- mdelay (port -> rs485 .delay_rts_before_send );
3476
- }
3477
-
3478
- if (nbcon_exit_unsafe (wctxt )) {
3479
- int len = READ_ONCE (wctxt -> len );
3480
- int i ;
3481
-
3482
- /*
3483
- * Write out the message. Toggle unsafe for each byte in order
3484
- * to give another (higher priority) context the opportunity
3485
- * for a friendly takeover. If such a takeover occurs, this
3486
- * context must reacquire ownership in order to perform final
3487
- * actions (such as re-enabling the interrupts).
3488
- *
3489
- * IMPORTANT: wctxt->outbuf and wctxt->len are no longer valid
3490
- * after a reacquire so writing the message must be
3491
- * aborted.
3492
- */
3493
- for (i = 0 ; i < len ; i ++ ) {
3494
- if (!nbcon_enter_unsafe (wctxt )) {
3495
- nbcon_reacquire_nobuf (wctxt );
3496
- break ;
3497
- }
3498
-
3499
- uart_console_write (port , wctxt -> outbuf + i , 1 , serial8250_console_putchar );
3500
-
3501
- if (!nbcon_exit_unsafe (wctxt )) {
3502
- nbcon_reacquire_nobuf (wctxt );
3503
- break ;
3504
- }
3505
- }
3506
- } else {
3507
- nbcon_reacquire_nobuf (wctxt );
3508
- }
3509
-
3510
- while (!nbcon_enter_unsafe (wctxt ))
3511
- nbcon_reacquire_nobuf (wctxt );
3512
-
3513
- /* Finally, wait for transmitter to become empty and restore IER. */
3514
- wait_for_xmitr (up , UART_LSR_BOTH_EMPTY );
3515
- if (em485 ) {
3516
- mdelay (port -> rs485 .delay_rts_after_send );
3517
- if (em485 -> tx_stopped )
3518
- up -> rs485_stop_tx (up );
3519
- }
3520
- serial_port_out (port , UART_IER , ier );
3521
-
3522
- /*
3523
- * The receive handling will happen properly because the receive ready
3524
- * bit will still be set; it is not cleared on read. However, modem
3525
- * control will not, we must call it if we have saved something in the
3526
- * saved flags while processing with interrupts off.
3527
- */
3528
- if (up -> msr_saved_flags )
3529
- serial8250_modem_status (up );
3530
-
3531
- nbcon_exit_unsafe (wctxt );
3532
- }
3533
-
3534
- void serial8250_console_write_atomic (struct uart_8250_port * up ,
3535
- struct nbcon_write_context * wctxt )
3536
- {
3537
- struct uart_port * port = & up -> port ;
3538
- unsigned int ier ;
3539
-
3540
- /* Atomic console not supported for rs485 mode. */
3541
- if (WARN_ON_ONCE (up -> em485 ))
3542
- return ;
3543
-
3544
- touch_nmi_watchdog ();
3545
-
3546
- if (!nbcon_enter_unsafe (wctxt ))
3547
- return ;
3548
-
3549
- /*
3550
- * First save IER then disable the interrupts. The special variant to
3551
- * clear IER is used because atomic printing may occur without holding
3552
- * the port lock.
3553
- */
3554
- ier = serial_port_in (port , UART_IER );
3555
- __serial8250_clear_IER (up );
3556
-
3557
- /* Check scratch reg if port powered off during system sleep. */
3558
- if (up -> canary && (up -> canary != serial_port_in (port , UART_SCR ))) {
3559
- serial8250_console_restore (up );
3560
- up -> canary = 0 ;
3561
- }
3562
-
3563
- if (up -> console_newline_needed )
3564
- uart_console_write (port , "\n" , 1 , serial8250_console_putchar );
3565
- uart_console_write (port , wctxt -> outbuf , wctxt -> len , serial8250_console_putchar );
3566
-
3567
- /* Finally, wait for transmitter to become empty and restore IER. */
3568
- wait_for_xmitr (up , UART_LSR_BOTH_EMPTY );
3569
- serial_port_out (port , UART_IER , ier );
3570
-
3571
- nbcon_exit_unsafe (wctxt );
3572
- }
3573
- #endif /* CONFIG_SERIAL_8250_LEGACY_CONSOLE */
3574
3424
3575
3425
static unsigned int probe_baud (struct uart_port * port )
3576
3426
{
@@ -3589,7 +3439,6 @@ static unsigned int probe_baud(struct uart_port *port)
3589
3439
3590
3440
int serial8250_console_setup (struct uart_port * port , char * options , bool probe )
3591
3441
{
3592
- struct uart_8250_port * up = up_to_u8250p (port );
3593
3442
int baud = 9600 ;
3594
3443
int bits = 8 ;
3595
3444
int parity = 'n' ;
@@ -3599,8 +3448,6 @@ int serial8250_console_setup(struct uart_port *port, char *options, bool probe)
3599
3448
if (!port -> iobase && !port -> membase )
3600
3449
return - ENODEV ;
3601
3450
3602
- up -> console_newline_needed = false;
3603
-
3604
3451
if (options )
3605
3452
uart_parse_options (options , & baud , & parity , & bits , & flow );
3606
3453
else if (probe )
0 commit comments