Revert "tty/serial: Make ->dcd_change()+uart_handle_dcd_change() status bool active"

This reverts commit 376d15bad7 which is
commit 0388a152fc 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 <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2024-11-16 14:07:04 +00:00
parent 3aee75909f
commit c5efbe731b
5 changed files with 15 additions and 14 deletions

View File

@@ -13,7 +13,7 @@
#include <linux/pps_kernel.h>
#include <linux/bug.h>
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);

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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,