From c5efbe731b865fff2db6a0ee8c1c34c7ac057c8f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 16 Nov 2024 14:07:04 +0000 Subject: [PATCH] Revert "tty/serial: Make ->dcd_change()+uart_handle_dcd_change() status bool active" This reverts commit 376d15bad7a50800f5b51dcedcbee6bf4b2c1b0e which is commit 0388a152fc5544be82e736343496f99c4eef8d62 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I831a3ddef1d1e76795c45d163806299017f1ba51 Signed-off-by: Greg Kroah-Hartman --- drivers/pps/clients/pps-ldisc.c | 6 +++--- drivers/tty/serial/serial_core.c | 8 ++++---- drivers/tty/serial/sunhv.c | 8 ++++---- include/linux/serial_core.h | 3 ++- include/linux/tty_ldisc.h | 4 ++-- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c index 443d6bae19d1..d73c4c2ed4e1 100644 --- a/drivers/pps/clients/pps-ldisc.c +++ b/drivers/pps/clients/pps-ldisc.c @@ -13,7 +13,7 @@ #include #include -static void pps_tty_dcd_change(struct tty_struct *tty, bool active) +static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status) { struct pps_device *pps; struct pps_event_time ts; @@ -29,11 +29,11 @@ static void pps_tty_dcd_change(struct tty_struct *tty, bool active) return; /* Now do the PPS event report */ - pps_event(pps, &ts, active ? PPS_CAPTUREASSERT : + pps_event(pps, &ts, status ? PPS_CAPTUREASSERT : PPS_CAPTURECLEAR, NULL); dev_dbg(pps->dev, "PPS %s at %lu\n", - active ? "assert" : "clear", jiffies); + status ? "assert" : "clear", jiffies); } static int (*alias_n_tty_open)(struct tty_struct *tty); diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 50bba980dabc..fd9f635dc247 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -3292,11 +3292,11 @@ EXPORT_SYMBOL(uart_match_port); /** * uart_handle_dcd_change - handle a change of carrier detect state * @uport: uart_port structure for the open port - * @active: new carrier detect status + * @status: new carrier detect status, nonzero if active * * Caller must hold uport->lock. */ -void uart_handle_dcd_change(struct uart_port *uport, bool active) +void uart_handle_dcd_change(struct uart_port *uport, unsigned int status) { struct tty_port *port = &uport->state->port; struct tty_struct *tty = port->tty; @@ -3308,7 +3308,7 @@ void uart_handle_dcd_change(struct uart_port *uport, bool active) ld = tty_ldisc_ref(tty); if (ld) { if (ld->ops->dcd_change) - ld->ops->dcd_change(tty, active); + ld->ops->dcd_change(tty, status); tty_ldisc_deref(ld); } } @@ -3316,7 +3316,7 @@ void uart_handle_dcd_change(struct uart_port *uport, bool active) uport->icount.dcd++; if (uart_dcd_enabled(uport)) { - if (active) + if (status) wake_up_interruptible(&port->open_wait); else if (tty) tty_hangup(tty); diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c index f0408a4d91ec..1938ba5e98c0 100644 --- a/drivers/tty/serial/sunhv.c +++ b/drivers/tty/serial/sunhv.c @@ -89,10 +89,10 @@ static int receive_chars_getchar(struct uart_port *port) if (c == CON_HUP) { hung_up = 1; - uart_handle_dcd_change(port, false); + uart_handle_dcd_change(port, 0); } else if (hung_up) { hung_up = 0; - uart_handle_dcd_change(port, true); + uart_handle_dcd_change(port, 1); } if (port->state == NULL) { @@ -135,7 +135,7 @@ static int receive_chars_read(struct uart_port *port) bytes_read = 1; } else if (stat == CON_HUP) { hung_up = 1; - uart_handle_dcd_change(port, false); + uart_handle_dcd_change(port, 0); continue; } else { /* HV_EWOULDBLOCK, etc. */ @@ -145,7 +145,7 @@ static int receive_chars_read(struct uart_port *port) if (hung_up) { hung_up = 0; - uart_handle_dcd_change(port, true); + uart_handle_dcd_change(port, 1); } if (port->sysrq != 0 && *con_read_page) { diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 7ce57f4894ee..50cc674d3f28 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -899,7 +899,8 @@ static inline bool uart_softcts_mode(struct uart_port *uport) * The following are helper functions for the low level drivers. */ -extern void uart_handle_dcd_change(struct uart_port *uport, bool active); +extern void uart_handle_dcd_change(struct uart_port *uport, + unsigned int status); extern void uart_handle_cts_change(struct uart_port *uport, unsigned int status); diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index a9b2496a5b5f..476993f65031 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -171,7 +171,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass, * send, please arise a tasklet or workqueue to do the real data transfer. * Do not send data in this hook, it may lead to a deadlock. * - * @dcd_change: [DRV] ``void ()(struct tty_struct *tty, bool active)`` + * @dcd_change: [DRV] ``void ()(struct tty_struct *tty, unsigned int status)`` * * Tells the discipline that the DCD pin has changed its status. Used * exclusively by the %N_PPS (Pulse-Per-Second) line discipline. @@ -239,7 +239,7 @@ struct tty_ldisc_ops { void (*receive_buf)(struct tty_struct *tty, const unsigned char *cp, const char *fp, int count); void (*write_wakeup)(struct tty_struct *tty); - void (*dcd_change)(struct tty_struct *tty, bool active); + void (*dcd_change)(struct tty_struct *tty, unsigned int status); int (*receive_buf2)(struct tty_struct *tty, const unsigned char *cp, const char *fp, int count); void (*lookahead_buf)(struct tty_struct *tty, const unsigned char *cp,