Commit b300fb26 authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by Greg Kroah-Hartman
Browse files

tty: Convert ->carrier_raised() and callchains to bool



Return boolean from ->carrier_raised() instead of 0 and 1. Make the
return type change also to tty_port_carrier_raised() that makes the
->carrier_raised() call (+ cd variable in moxa into which its return
value is stored).

Also cleans up a few unnecessary constructs related to this change:

	return xx ? 1 : 0;
	-> return xx;

	if (xx)
		return 1;
	return 0;
	-> return xx;

Reviewed-by: default avatarJiri Slaby <jirislaby@kernel.org>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230117090358.4796-7-ilpo.jarvinen@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dcd794c6
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -377,7 +377,7 @@ static void async_mode(MGSLPC_INFO *info);

static void tx_timeout(struct timer_list *t);

static int carrier_raised(struct tty_port *port);
static bool carrier_raised(struct tty_port *port);
static void dtr_rts(struct tty_port *port, int onoff);

#if SYNCLINK_GENERIC_HDLC
@@ -2430,7 +2430,7 @@ static void mgslpc_hangup(struct tty_struct *tty)
	tty_port_hangup(&info->port);
}

static int carrier_raised(struct tty_port *port)
static bool carrier_raised(struct tty_port *port)
{
	MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port);
	unsigned long flags;
@@ -2439,9 +2439,7 @@ static int carrier_raised(struct tty_port *port)
	get_signals(info);
	spin_unlock_irqrestore(&info->lock, flags);

	if (info->serial_signals & SerialSignal_DCD)
		return 1;
	return 0;
	return info->serial_signals & SerialSignal_DCD;
}

static void dtr_rts(struct tty_port *port, int onoff)
+3 −4
Original line number Diff line number Diff line
@@ -526,7 +526,7 @@ static void sdio_uart_irq(struct sdio_func *func)
	port->in_sdio_uart_irq = NULL;
}

static int uart_carrier_raised(struct tty_port *tport)
static bool uart_carrier_raised(struct tty_port *tport)
{
	struct sdio_uart_port *port =
			container_of(tport, struct sdio_uart_port, port);
@@ -535,9 +535,8 @@ static int uart_carrier_raised(struct tty_port *tport)
		return 1;
	ret = sdio_uart_get_mctrl(port);
	sdio_uart_release_func(port);
	if (ret & TIOCM_CAR)
		return 1;
	return 0;

	return ret & TIOCM_CAR;
}

/**
+1 −1
Original line number Diff line number Diff line
@@ -1454,7 +1454,7 @@ static const struct tty_operations serial_ops = {
	.proc_show = rs_proc_show,
};

static int amiga_carrier_raised(struct tty_port *port)
static bool amiga_carrier_raised(struct tty_port *port)
{
	return !(ciab.pra & SER_DCD);
}
+2 −2
Original line number Diff line number Diff line
@@ -501,7 +501,7 @@ static int moxa_tiocmset(struct tty_struct *tty,
static void moxa_poll(struct timer_list *);
static void moxa_set_tty_param(struct tty_struct *, const struct ktermios *);
static void moxa_shutdown(struct tty_port *);
static int moxa_carrier_raised(struct tty_port *);
static bool moxa_carrier_raised(struct tty_port *);
static void moxa_dtr_rts(struct tty_port *, int);
/*
 * moxa board interface functions:
@@ -1432,7 +1432,7 @@ static void moxa_shutdown(struct tty_port *port)
	MoxaPortFlushData(ch, 2);
}

static int moxa_carrier_raised(struct tty_port *port)
static bool moxa_carrier_raised(struct tty_port *port)
{
	struct moxa_port *ch = container_of(port, struct moxa_port, port);
	int dcd;
+3 −2
Original line number Diff line number Diff line
@@ -458,10 +458,11 @@ static void __mxser_stop_tx(struct mxser_port *info)
	outb(info->IER, info->ioaddr + UART_IER);
}

static int mxser_carrier_raised(struct tty_port *port)
static bool mxser_carrier_raised(struct tty_port *port)
{
	struct mxser_port *mp = container_of(port, struct mxser_port, port);
	return (inb(mp->ioaddr + UART_MSR) & UART_MSR_DCD)?1:0;

	return inb(mp->ioaddr + UART_MSR) & UART_MSR_DCD;
}

static void mxser_dtr_rts(struct tty_port *port, int on)
Loading