cyclades: remove more duplicated code
Remove duplicated code from cy_set_line_char. There were 2 if branches with same contents except flags. Branch only for the flags computation and use them in the only copy of the code. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
3aeea5b922
commit
46fb782522
1 changed files with 14 additions and 31 deletions
|
@ -2057,6 +2057,8 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
|
||||||
channel = info->line - card->first_line;
|
channel = info->line - card->first_line;
|
||||||
|
|
||||||
if (!cy_is_Z(card)) {
|
if (!cy_is_Z(card)) {
|
||||||
|
u32 cflags;
|
||||||
|
|
||||||
/* baud rate */
|
/* baud rate */
|
||||||
baud = tty_get_baud_rate(tty);
|
baud = tty_get_baud_rate(tty);
|
||||||
if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
|
if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
|
||||||
|
@ -2198,37 +2200,18 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
|
||||||
(info->default_timeout ? info->default_timeout : 0x02));
|
(info->default_timeout ? info->default_timeout : 0x02));
|
||||||
/* 10ms rx timeout */
|
/* 10ms rx timeout */
|
||||||
|
|
||||||
if (C_CLOCAL(tty)) {
|
cflags = CyCTS;
|
||||||
/* without modem intr */
|
if (!C_CLOCAL(tty))
|
||||||
cyy_writeb(info, CySRER,
|
cflags |= CyDSR | CyRI | CyDCD;
|
||||||
cyy_readb(info, CySRER) | CyMdmCh);
|
/* without modem intr */
|
||||||
/* act on 1->0 modem transitions */
|
cyy_writeb(info, CySRER, cyy_readb(info, CySRER) | CyMdmCh);
|
||||||
if ((cflag & CRTSCTS) && info->rflow) {
|
/* act on 1->0 modem transitions */
|
||||||
cyy_writeb(info, CyMCOR1,
|
if ((cflag & CRTSCTS) && info->rflow)
|
||||||
(CyCTS | rflow_thr[i]));
|
cyy_writeb(info, CyMCOR1, cflags | rflow_thr[i]);
|
||||||
} else {
|
else
|
||||||
cyy_writeb(info, CyMCOR1,
|
cyy_writeb(info, CyMCOR1, cflags);
|
||||||
CyCTS);
|
/* act on 0->1 modem transitions */
|
||||||
}
|
cyy_writeb(info, CyMCOR2, cflags);
|
||||||
/* act on 0->1 modem transitions */
|
|
||||||
cyy_writeb(info, CyMCOR2, CyCTS);
|
|
||||||
} else {
|
|
||||||
/* without modem intr */
|
|
||||||
cyy_writeb(info, CySRER,
|
|
||||||
cyy_readb(info, CySRER) | CyMdmCh);
|
|
||||||
/* act on 1->0 modem transitions */
|
|
||||||
if ((cflag & CRTSCTS) && info->rflow) {
|
|
||||||
cyy_writeb(info, CyMCOR1,
|
|
||||||
(CyDSR | CyCTS | CyRI | CyDCD |
|
|
||||||
rflow_thr[i]));
|
|
||||||
} else {
|
|
||||||
cyy_writeb(info, CyMCOR1,
|
|
||||||
CyDSR | CyCTS | CyRI | CyDCD);
|
|
||||||
}
|
|
||||||
/* act on 0->1 modem transitions */
|
|
||||||
cyy_writeb(info, CyMCOR2,
|
|
||||||
CyDSR | CyCTS | CyRI | CyDCD);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == 0) /* baud rate is zero, turn off line */
|
if (i == 0) /* baud rate is zero, turn off line */
|
||||||
cyy_change_rts_dtr(info, 0, TIOCM_DTR);
|
cyy_change_rts_dtr(info, 0, TIOCM_DTR);
|
||||||
|
|
Loading…
Add table
Reference in a new issue