From 3905cfd1d6725336b02ef0d923115ab8c543f246 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 16 Nov 2022 09:54:40 +0000 Subject: [PATCH] Revert "serial: 8250: Toggle IER bits on only after irq has been set up" This reverts commit 572fb97fce35a3cc5694b9c8a7e83c97d11461b9 which is commit 039d4926379b1d1c17b51cf21c500a5eed86899e upstream. It breaks the kernel abi and is not needed for any supported Android devices at this point in time, so it can be safely reverted. Bug: 161946584 Signed-off-by: Greg Kroah-Hartman Change-Id: I07e784e722762dab69f031063317350379e59b76 --- drivers/tty/serial/8250/8250_core.c | 16 +++++----------- drivers/tty/serial/8250/8250_port.c | 8 +++----- include/linux/serial_8250.h | 1 - 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 0a7e9491b4d1..aae9d26ce4f4 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -310,9 +310,10 @@ static void serial8250_backup_timeout(struct timer_list *t) jiffies + uart_poll_timeout(&up->port) + HZ / 5); } -static void univ8250_setup_timer(struct uart_8250_port *up) +static int univ8250_setup_irq(struct uart_8250_port *up) { struct uart_port *port = &up->port; + int retval = 0; /* * The above check will only give an accurate result the first time @@ -333,16 +334,10 @@ static void univ8250_setup_timer(struct uart_8250_port *up) */ if (!port->irq) mod_timer(&up->timer, jiffies + uart_poll_timeout(port)); -} + else + retval = serial_link_irq_chain(up); -static int univ8250_setup_irq(struct uart_8250_port *up) -{ - struct uart_port *port = &up->port; - - if (port->irq) - return serial_link_irq_chain(up); - - return 0; + return retval; } static void univ8250_release_irq(struct uart_8250_port *up) @@ -398,7 +393,6 @@ static struct uart_ops univ8250_port_ops; static const struct uart_8250_ops univ8250_driver_ops = { .setup_irq = univ8250_setup_irq, .release_irq = univ8250_release_irq, - .setup_timer = univ8250_setup_timer, }; static struct uart_8250_port serial8250_ports[UART_NR]; diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 3caa4aa193f6..9d60418e4adb 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2276,10 +2276,6 @@ int serial8250_do_startup(struct uart_port *port) if (port->irq && (up->port.flags & UPF_SHARE_IRQ)) up->port.irqflags |= IRQF_SHARED; - retval = up->ops->setup_irq(up); - if (retval) - goto out; - if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) { unsigned char iir1; @@ -2322,7 +2318,9 @@ int serial8250_do_startup(struct uart_port *port) } } - up->ops->setup_timer(up); + retval = up->ops->setup_irq(up); + if (retval) + goto out; /* * Now, initialize the UART diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 92f3b778d8c2..2b70f736b091 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -74,7 +74,6 @@ struct uart_8250_port; struct uart_8250_ops { int (*setup_irq)(struct uart_8250_port *); void (*release_irq)(struct uart_8250_port *); - void (*setup_timer)(struct uart_8250_port *); }; struct uart_8250_em485 {