aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2009-09-19 16:13:17 -0400
committerLive-CD User <linux@linux.site>2009-09-19 16:13:17 -0400
commit46fb782522092f772c6ce2b129f201ca6e1e15a2 (patch)
treef43fd041a790c8b20d09498a4c6b9baf40138a1b
parent3aeea5b92210083c7cffd4f08a0bb141d3f2d574 (diff)
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>
-rw-r--r--drivers/char/cyclades.c45
1 files changed, 14 insertions, 31 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index cf2874a89c8c..f518e0b5b47d 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -2057,6 +2057,8 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
2057 channel = info->line - card->first_line; 2057 channel = info->line - card->first_line;
2058 2058
2059 if (!cy_is_Z(card)) { 2059 if (!cy_is_Z(card)) {
2060 u32 cflags;
2061
2060 /* baud rate */ 2062 /* baud rate */
2061 baud = tty_get_baud_rate(tty); 2063 baud = tty_get_baud_rate(tty);
2062 if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == 2064 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)
2198 (info->default_timeout ? info->default_timeout : 0x02)); 2200 (info->default_timeout ? info->default_timeout : 0x02));
2199 /* 10ms rx timeout */ 2201 /* 10ms rx timeout */
2200 2202
2201 if (C_CLOCAL(tty)) { 2203 cflags = CyCTS;
2202 /* without modem intr */ 2204 if (!C_CLOCAL(tty))
2203 cyy_writeb(info, CySRER, 2205 cflags |= CyDSR | CyRI | CyDCD;
2204 cyy_readb(info, CySRER) | CyMdmCh); 2206 /* without modem intr */
2205 /* act on 1->0 modem transitions */ 2207 cyy_writeb(info, CySRER, cyy_readb(info, CySRER) | CyMdmCh);
2206 if ((cflag & CRTSCTS) && info->rflow) { 2208 /* act on 1->0 modem transitions */
2207 cyy_writeb(info, CyMCOR1, 2209 if ((cflag & CRTSCTS) && info->rflow)
2208 (CyCTS | rflow_thr[i])); 2210 cyy_writeb(info, CyMCOR1, cflags | rflow_thr[i]);
2209 } else { 2211 else
2210 cyy_writeb(info, CyMCOR1, 2212 cyy_writeb(info, CyMCOR1, cflags);
2211 CyCTS); 2213 /* act on 0->1 modem transitions */
2212 } 2214 cyy_writeb(info, CyMCOR2, cflags);
2213 /* act on 0->1 modem transitions */
2214 cyy_writeb(info, CyMCOR2, CyCTS);
2215 } else {
2216 /* without modem intr */
2217 cyy_writeb(info, CySRER,
2218 cyy_readb(info, CySRER) | CyMdmCh);
2219 /* act on 1->0 modem transitions */
2220 if ((cflag & CRTSCTS) && info->rflow) {
2221 cyy_writeb(info, CyMCOR1,
2222 (CyDSR | CyCTS | CyRI | CyDCD |
2223 rflow_thr[i]));
2224 } else {
2225 cyy_writeb(info, CyMCOR1,
2226 CyDSR | CyCTS | CyRI | CyDCD);
2227 }
2228 /* act on 0->1 modem transitions */
2229 cyy_writeb(info, CyMCOR2,
2230 CyDSR | CyCTS | CyRI | CyDCD);
2231 }
2232 2215
2233 if (i == 0) /* baud rate is zero, turn off line */ 2216 if (i == 0) /* baud rate is zero, turn off line */
2234 cyy_change_rts_dtr(info, 0, TIOCM_DTR); 2217 cyy_change_rts_dtr(info, 0, TIOCM_DTR);