diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2009-09-19 16:13:15 -0400 |
---|---|---|
committer | Live-CD User <linux@linux.site> | 2009-09-19 16:13:15 -0400 |
commit | cc7fdf49d6f06efdf0cb7da8d7abe7eff663aa9b (patch) | |
tree | f4bfbed45e02e386a03adee21bf8c4716feff713 /drivers | |
parent | 4d7682005ca88a37667c4af03908798e188b5224 (diff) |
cyclades: merge cy_startup tails
There is a duplicated code for Y and Z in cy_startup, merge the paths.
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/cyclades.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 74627950f901..47cd7b8d4d97 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -1296,7 +1296,7 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty) | |||
1296 | unsigned long flags; | 1296 | unsigned long flags; |
1297 | int retval = 0; | 1297 | int retval = 0; |
1298 | void __iomem *base_addr; | 1298 | void __iomem *base_addr; |
1299 | int chip, channel, index; | 1299 | int channel; |
1300 | unsigned long page; | 1300 | unsigned long page; |
1301 | 1301 | ||
1302 | card = info->card; | 1302 | card = info->card; |
@@ -1308,14 +1308,11 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty) | |||
1308 | 1308 | ||
1309 | spin_lock_irqsave(&card->card_lock, flags); | 1309 | spin_lock_irqsave(&card->card_lock, flags); |
1310 | 1310 | ||
1311 | if (info->port.flags & ASYNC_INITIALIZED) { | 1311 | if (info->port.flags & ASYNC_INITIALIZED) |
1312 | free_page(page); | ||
1313 | goto errout; | 1312 | goto errout; |
1314 | } | ||
1315 | 1313 | ||
1316 | if (!info->type) { | 1314 | if (!info->type) { |
1317 | set_bit(TTY_IO_ERROR, &tty->flags); | 1315 | set_bit(TTY_IO_ERROR, &tty->flags); |
1318 | free_page(page); | ||
1319 | goto errout; | 1316 | goto errout; |
1320 | } | 1317 | } |
1321 | 1318 | ||
@@ -1329,9 +1326,9 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty) | |||
1329 | cy_set_line_char(info, tty); | 1326 | cy_set_line_char(info, tty); |
1330 | 1327 | ||
1331 | if (!cy_is_Z(card)) { | 1328 | if (!cy_is_Z(card)) { |
1332 | chip = channel >> 2; | 1329 | int chip = channel >> 2; |
1330 | int index = card->bus_index; | ||
1333 | channel &= 0x03; | 1331 | channel &= 0x03; |
1334 | index = card->bus_index; | ||
1335 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); | 1332 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
1336 | 1333 | ||
1337 | #ifdef CY_DEBUG_OPEN | 1334 | #ifdef CY_DEBUG_OPEN |
@@ -1354,18 +1351,6 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty) | |||
1354 | 1351 | ||
1355 | cy_writeb(base_addr + (CySRER << index), | 1352 | cy_writeb(base_addr + (CySRER << index), |
1356 | readb(base_addr + (CySRER << index)) | CyRxData); | 1353 | readb(base_addr + (CySRER << index)) | CyRxData); |
1357 | info->port.flags |= ASYNC_INITIALIZED; | ||
1358 | |||
1359 | clear_bit(TTY_IO_ERROR, &tty->flags); | ||
1360 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | ||
1361 | info->breakon = info->breakoff = 0; | ||
1362 | memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats)); | ||
1363 | info->idle_stats.in_use = | ||
1364 | info->idle_stats.recv_idle = | ||
1365 | info->idle_stats.xmit_idle = jiffies; | ||
1366 | |||
1367 | spin_unlock_irqrestore(&card->card_lock, flags); | ||
1368 | |||
1369 | } else { | 1354 | } else { |
1370 | struct CH_CTRL __iomem *ch_ctrl = info->u.cyz.ch_ctrl; | 1355 | struct CH_CTRL __iomem *ch_ctrl = info->u.cyz.ch_ctrl; |
1371 | 1356 | ||
@@ -1416,18 +1401,19 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty) | |||
1416 | tty_port_raise_dtr_rts(&info->port); | 1401 | tty_port_raise_dtr_rts(&info->port); |
1417 | 1402 | ||
1418 | /* enable send, recv, modem !!! */ | 1403 | /* enable send, recv, modem !!! */ |
1404 | } | ||
1419 | 1405 | ||
1420 | info->port.flags |= ASYNC_INITIALIZED; | 1406 | info->port.flags |= ASYNC_INITIALIZED; |
1421 | clear_bit(TTY_IO_ERROR, &tty->flags); | ||
1422 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | ||
1423 | info->breakon = info->breakoff = 0; | ||
1424 | memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats)); | ||
1425 | info->idle_stats.in_use = | ||
1426 | info->idle_stats.recv_idle = | ||
1427 | info->idle_stats.xmit_idle = jiffies; | ||
1428 | 1407 | ||
1429 | spin_unlock_irqrestore(&card->card_lock, flags); | 1408 | clear_bit(TTY_IO_ERROR, &tty->flags); |
1430 | } | 1409 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
1410 | info->breakon = info->breakoff = 0; | ||
1411 | memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats)); | ||
1412 | info->idle_stats.in_use = | ||
1413 | info->idle_stats.recv_idle = | ||
1414 | info->idle_stats.xmit_idle = jiffies; | ||
1415 | |||
1416 | spin_unlock_irqrestore(&card->card_lock, flags); | ||
1431 | 1417 | ||
1432 | #ifdef CY_DEBUG_OPEN | 1418 | #ifdef CY_DEBUG_OPEN |
1433 | printk(KERN_DEBUG "cyc startup done\n"); | 1419 | printk(KERN_DEBUG "cyc startup done\n"); |
@@ -1436,6 +1422,7 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty) | |||
1436 | 1422 | ||
1437 | errout: | 1423 | errout: |
1438 | spin_unlock_irqrestore(&card->card_lock, flags); | 1424 | spin_unlock_irqrestore(&card->card_lock, flags); |
1425 | free_page(page); | ||
1439 | return retval; | 1426 | return retval; |
1440 | } /* startup */ | 1427 | } /* startup */ |
1441 | 1428 | ||