Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e98966c authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds
Browse files

tty: rework break handling



Some hardware needs to do break handling itself and may have partial
support only. Make break_ctl return an error code. Add a tty driver flag
so you can indicate driver hardware side break support.

Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent abbe629a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ config MOXA_SMARTIO

config ISI
	tristate "Multi-Tech multiport card support (EXPERIMENTAL)"
	depends on SERIAL_NONSTANDARD && PCI
	depends on SERIAL_NONSTANDARD && PCI && BROKEN
	select FW_LOADER
	help
	  This is a driver for the Multi-Tech cards which provide several
+2 −1
Original line number Diff line number Diff line
@@ -1248,7 +1248,7 @@ static int rs_tiocmset(struct tty_struct *tty, struct file *file,
/*
 * rs_break() --- routine which turns the break handling on or off
 */
static void rs_break(struct tty_struct *tty, int break_state)
static int rs_break(struct tty_struct *tty, int break_state)
{
	struct async_struct * info = (struct async_struct *)tty->driver_data;
	unsigned long flags;
@@ -1263,6 +1263,7 @@ static void rs_break(struct tty_struct *tty, int break_state)
	  custom.adkcon = AC_UARTBRK;
	mb();
	local_irq_restore(flags);
	return 0;
}


+4 −4
Original line number Diff line number Diff line
@@ -3700,14 +3700,15 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
/*
 * cy_break() --- routine which turns the break handling on or off
 */
static void cy_break(struct tty_struct *tty, int break_state)
static int cy_break(struct tty_struct *tty, int break_state)
{
	struct cyclades_port *info = tty->driver_data;
	struct cyclades_card *card;
	unsigned long flags;
	int retval = 0;

	if (serial_paranoia_check(info, tty->name, "cy_break"))
		return;
		return -EINVAL;

	card = info->card;

@@ -3736,8 +3737,6 @@ static void cy_break(struct tty_struct *tty, int break_state)
			}
		}
	} else {
		int retval;

		if (break_state == -1) {
			retval = cyz_issue_cmd(card,
				info->line - card->first_line,
@@ -3758,6 +3757,7 @@ static void cy_break(struct tty_struct *tty, int break_state)
		}
	}
	spin_unlock_irqrestore(&card->card_lock, flags);
	return retval;
}				/* cy_break */

static int get_mon_info(struct cyclades_port *info,
+3 −2
Original line number Diff line number Diff line
@@ -1725,13 +1725,13 @@ static int esp_tiocmset(struct tty_struct *tty, struct file *file,
/*
 * rs_break() --- routine which turns the break handling on or off
 */
static void esp_break(struct tty_struct *tty, int break_state)
static int esp_break(struct tty_struct *tty, int break_state)
{
	struct esp_struct *info = tty->driver_data;
	unsigned long flags;

	if (serial_paranoia_check(info, tty->name, "esp_break"))
		return;
		return -EINVAL;

	if (break_state == -1) {
		spin_lock_irqsave(&info->lock, flags);
@@ -1747,6 +1747,7 @@ static void esp_break(struct tty_struct *tty, int break_state)
		serial_out(info, UART_ESI_CMD2, 0x00);
		spin_unlock_irqrestore(&info->lock, flags);
	}
	return 0;
}

static int rs_ioctl(struct tty_struct *tty, struct file *file,
+6 −5
Original line number Diff line number Diff line
@@ -609,7 +609,7 @@ static void stli_unthrottle(struct tty_struct *tty);
static void	stli_stop(struct tty_struct *tty);
static void	stli_start(struct tty_struct *tty);
static void	stli_flushbuffer(struct tty_struct *tty);
static void	stli_breakctl(struct tty_struct *tty, int state);
static int	stli_breakctl(struct tty_struct *tty, int state);
static void	stli_waituntilsent(struct tty_struct *tty, int timeout);
static void	stli_sendxchar(struct tty_struct *tty, char ch);
static void	stli_hangup(struct tty_struct *tty);
@@ -1909,7 +1909,7 @@ static void stli_flushbuffer(struct tty_struct *tty)

/*****************************************************************************/

static void stli_breakctl(struct tty_struct *tty, int state)
static int stli_breakctl(struct tty_struct *tty, int state)
{
	struct stlibrd	*brdp;
	struct stliport	*portp;
@@ -1917,15 +1917,16 @@ static void stli_breakctl(struct tty_struct *tty, int state)

	portp = tty->driver_data;
	if (portp == NULL)
		return;
		return -EINVAL;
	if (portp->brdnr >= stli_nrbrds)
		return;
		return -EINVAL;
	brdp = stli_brds[portp->brdnr];
	if (brdp == NULL)
		return;
		return -EINVAL;

	arg = (state == -1) ? BREAKON : BREAKOFF;
	stli_cmdwait(brdp, portp, A_BREAK, &arg, sizeof(long), 0);
	return 0;
}

/*****************************************************************************/
Loading