Skip to content

Commit

Permalink
cyclades: merge cy_startup tails
Browse files Browse the repository at this point in the history
There is a duplicated code for Y and Z in cy_startup, merge the paths.

Signed-off-by: Jiri Slaby <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
jirislaby authored and Live-CD User committed Sep 19, 2009
1 parent 4d76820 commit cc7fdf4
Showing 1 changed file with 16 additions and 29 deletions.
45 changes: 16 additions & 29 deletions drivers/char/cyclades.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)
unsigned long flags;
int retval = 0;
void __iomem *base_addr;
int chip, channel, index;
int channel;
unsigned long page;

card = info->card;
Expand All @@ -1308,14 +1308,11 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)

spin_lock_irqsave(&card->card_lock, flags);

if (info->port.flags & ASYNC_INITIALIZED) {
free_page(page);
if (info->port.flags & ASYNC_INITIALIZED)
goto errout;
}

if (!info->type) {
set_bit(TTY_IO_ERROR, &tty->flags);
free_page(page);
goto errout;
}

Expand All @@ -1329,9 +1326,9 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)
cy_set_line_char(info, tty);

if (!cy_is_Z(card)) {
chip = channel >> 2;
int chip = channel >> 2;
int index = card->bus_index;
channel &= 0x03;
index = card->bus_index;
base_addr = card->base_addr + (cy_chip_offset[chip] << index);

#ifdef CY_DEBUG_OPEN
Expand All @@ -1354,18 +1351,6 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)

cy_writeb(base_addr + (CySRER << index),
readb(base_addr + (CySRER << index)) | CyRxData);
info->port.flags |= ASYNC_INITIALIZED;

clear_bit(TTY_IO_ERROR, &tty->flags);
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
info->breakon = info->breakoff = 0;
memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats));
info->idle_stats.in_use =
info->idle_stats.recv_idle =
info->idle_stats.xmit_idle = jiffies;

spin_unlock_irqrestore(&card->card_lock, flags);

} else {
struct CH_CTRL __iomem *ch_ctrl = info->u.cyz.ch_ctrl;

Expand Down Expand Up @@ -1416,18 +1401,19 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)
tty_port_raise_dtr_rts(&info->port);

/* enable send, recv, modem !!! */
}

info->port.flags |= ASYNC_INITIALIZED;
clear_bit(TTY_IO_ERROR, &tty->flags);
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
info->breakon = info->breakoff = 0;
memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats));
info->idle_stats.in_use =
info->idle_stats.recv_idle =
info->idle_stats.xmit_idle = jiffies;
info->port.flags |= ASYNC_INITIALIZED;

spin_unlock_irqrestore(&card->card_lock, flags);
}
clear_bit(TTY_IO_ERROR, &tty->flags);
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
info->breakon = info->breakoff = 0;
memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats));
info->idle_stats.in_use =
info->idle_stats.recv_idle =
info->idle_stats.xmit_idle = jiffies;

spin_unlock_irqrestore(&card->card_lock, flags);

#ifdef CY_DEBUG_OPEN
printk(KERN_DEBUG "cyc startup done\n");
Expand All @@ -1436,6 +1422,7 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)

errout:
spin_unlock_irqrestore(&card->card_lock, flags);
free_page(page);
return retval;
} /* startup */

Expand Down

0 comments on commit cc7fdf4

Please sign in to comment.