@@ -546,13 +546,6 @@ static int serial8250_em485_init(struct uart_8250_port *p)
546546 if (!p -> em485 )
547547 return - ENOMEM ;
548548
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-
556549 hrtimer_init (& p -> em485 -> stop_tx_timer , CLOCK_MONOTONIC ,
557550 HRTIMER_MODE_REL );
558551 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)
698691 serial8250_rpm_put (p );
699692}
700693
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 )
706695{
707696 if (up -> capabilities & UART_CAP_UUE )
708697 serial_out (up , UART_IER , UART_IER_UUE );
709698 else
710699 serial_out (up , UART_IER , 0 );
711700}
712701
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-
721702#ifdef CONFIG_SERIAL_8250_RSA
722703/*
723704 * 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)
32883269
32893270 wait_for_xmitr (up , UART_LSR_THRE );
32903271 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;
32963272}
32973273
32983274/*
@@ -3321,7 +3297,6 @@ static void serial8250_console_restore(struct uart_8250_port *up)
33213297 serial8250_out_MCR (up , up -> mcr | UART_MCR_DTR | UART_MCR_RTS );
33223298}
33233299
3324- #ifdef CONFIG_SERIAL_8250_LEGACY_CONSOLE
33253300/*
33263301 * Print a string to the serial port using the device FIFO
33273302 *
@@ -3380,7 +3355,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
33803355 * First save the IER then disable the interrupts
33813356 */
33823357 ier = serial_port_in (port , UART_IER );
3383- __serial8250_clear_IER (up );
3358+ serial8250_clear_IER (up );
33843359
33853360 /* check scratch reg to see if port powered off during system sleep */
33863361 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,
34463421 if (locked )
34473422 uart_port_unlock_irqrestore (port , flags );
34483423}
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 */
35743424
35753425static unsigned int probe_baud (struct uart_port * port )
35763426{
@@ -3589,7 +3439,6 @@ static unsigned int probe_baud(struct uart_port *port)
35893439
35903440int serial8250_console_setup (struct uart_port * port , char * options , bool probe )
35913441{
3592- struct uart_8250_port * up = up_to_u8250p (port );
35933442 int baud = 9600 ;
35943443 int bits = 8 ;
35953444 int parity = 'n' ;
@@ -3599,8 +3448,6 @@ int serial8250_console_setup(struct uart_port *port, char *options, bool probe)
35993448 if (!port -> iobase && !port -> membase )
36003449 return - ENODEV ;
36013450
3602- up -> console_newline_needed = false;
3603-
36043451 if (options )
36053452 uart_parse_options (options , & baud , & parity , & bits , & flow );
36063453 else if (probe )
0 commit comments