@@ -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,23 +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- __serial8250_clear_IER (up );
716- }
717-
718702#ifdef CONFIG_SERIAL_8250_RSA
719703/*
720704 * 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)
32853269
32863270 wait_for_xmitr (up , UART_LSR_THRE );
32873271 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;
32933272}
32943273
32953274/*
@@ -3318,7 +3297,6 @@ static void serial8250_console_restore(struct uart_8250_port *up)
33183297 serial8250_out_MCR (up , up -> mcr | UART_MCR_DTR | UART_MCR_RTS );
33193298}
33203299
3321- #ifdef CONFIG_SERIAL_8250_LEGACY_CONSOLE
33223300/*
33233301 * Print a string to the serial port using the device FIFO
33243302 *
@@ -3377,7 +3355,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
33773355 * First save the IER then disable the interrupts
33783356 */
33793357 ier = serial_port_in (port , UART_IER );
3380- __serial8250_clear_IER (up );
3358+ serial8250_clear_IER (up );
33813359
33823360 /* check scratch reg to see if port powered off during system sleep */
33833361 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,
34433421 if (locked )
34443422 uart_port_unlock_irqrestore (port , flags );
34453423}
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 */
35713424
35723425static unsigned int probe_baud (struct uart_port * port )
35733426{
@@ -3586,7 +3439,6 @@ static unsigned int probe_baud(struct uart_port *port)
35863439
35873440int serial8250_console_setup (struct uart_port * port , char * options , bool probe )
35883441{
3589- struct uart_8250_port * up = up_to_u8250p (port );
35903442 int baud = 9600 ;
35913443 int bits = 8 ;
35923444 int parity = 'n' ;
@@ -3596,8 +3448,6 @@ int serial8250_console_setup(struct uart_port *port, char *options, bool probe)
35963448 if (!port -> iobase && !port -> membase )
35973449 return - ENODEV ;
35983450
3599- up -> console_newline_needed = false;
3600-
36013451 if (options )
36023452 uart_parse_options (options , & baud , & parity , & bits , & flow );
36033453 else if (probe )
0 commit comments