Commit 15ed6cc0 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds
Browse files

cyclades: coding style & review



Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e5b393e4
Loading
Loading
Loading
Loading
+149 −159
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
 *
 * This version supports shared IRQ's (only for PCI boards).
 *
 * $Log: cyclades.c,v $
 * Prevent users from opening non-existing Z ports.
 *
 * Revision 2.3.2.8   2000/07/06 18:14:16 ivan
@@ -649,9 +648,9 @@
#include <linux/firmware.h>

#include <asm/system.h>
#include <asm/io.h>
#include <linux/io.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>

#include <linux/kernel.h>
#include <linux/pci.h>
@@ -841,14 +840,22 @@ static int cy_chip_offset[] = { 0x0000,

#ifdef CONFIG_PCI
static struct pci_device_id cy_pci_dev_id[] __devinitdata = {
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_Y_Lo) },	/* PCI < 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_Y_Hi) },	/* PCI > 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_4Y_Lo) },	/* 4Y PCI < 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_4Y_Hi) },	/* 4Y PCI > 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_8Y_Lo) },	/* 8Y PCI < 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_8Y_Hi) },	/* 8Y PCI > 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_Z_Lo) },	/* Z PCI < 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_Z_Hi) },	/* Z PCI > 1Mb */
	/* PCI < 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_Y_Lo) },
	/* PCI > 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_Y_Hi) },
	/* 4Y PCI < 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_4Y_Lo) },
	/* 4Y PCI > 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_4Y_Hi) },
	/* 8Y PCI < 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_8Y_Lo) },
	/* 8Y PCI > 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_8Y_Hi) },
	/* Z PCI < 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_Z_Lo) },
	/* Z PCI > 1Mb */
	{ PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_Z_Hi) },
	{ }			/* end of table */
};
MODULE_DEVICE_TABLE(pci, cy_pci_dev_id);
@@ -911,9 +918,8 @@ static int cyy_issue_cmd(void __iomem * base_addr, u_char cmd, int index)

	/* Check to see that the previous command has completed */
	for (i = 0; i < 100; i++) {
		if (readb(base_addr + (CyCCR << index)) == 0) {
		if (readb(base_addr + (CyCCR << index)) == 0)
			break;
		}
		udelay(10L);
	}
	/* if the CCR never cleared, the previous command
@@ -1320,7 +1326,8 @@ static irqreturn_t cyy_interrupt(int irq, void *dev_id)

	if (unlikely(cinfo == NULL)) {
#ifdef CY_DEBUG_INTERRUPTS
		printk(KERN_DEBUG "cyy_interrupt: spurious interrupt %d\n",irq);
		printk(KERN_DEBUG "cyy_interrupt: spurious interrupt %d\n",
				irq);
#endif
		return IRQ_NONE;	/* spurious interrupt */
	}
@@ -1375,7 +1382,7 @@ static irqreturn_t cyy_interrupt(int irq, void *dev_id)

/***********************************************************/
/********* End of block of Cyclom-Y specific code **********/
/******** Start of block of Cyclades-Z specific code *********/
/******** Start of block of Cyclades-Z specific code *******/
/***********************************************************/

static int
@@ -1388,9 +1395,8 @@ cyz_fetch_msg(struct cyclades_card *cinfo,
	unsigned long loc_doorbell;

	firm_id = cinfo->base_addr + ID_ADDRESS;
	if (!ISZLOADED(*cinfo)) {
	if (!ISZLOADED(*cinfo))
		return -1;
	}
	zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
	board_ctrl = &zfw_ctrl->board_ctrl;

@@ -1418,9 +1424,9 @@ cyz_issue_cmd(struct cyclades_card *cinfo,
	unsigned int index;

	firm_id = cinfo->base_addr + ID_ADDRESS;
	if (!ISZLOADED(*cinfo)) {
	if (!ISZLOADED(*cinfo))
		return -1;
	}

	zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
	board_ctrl = &zfw_ctrl->board_ctrl;

@@ -1428,9 +1434,8 @@ cyz_issue_cmd(struct cyclades_card *cinfo,
	pci_doorbell =
	    &((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))->pci_doorbell;
	while ((readl(pci_doorbell) & 0xff) != 0) {
		if (index++ == 1000) {
		if (index++ == 1000)
			return (int)(readl(pci_doorbell) & 0xff);
		}
		udelay(50L);
	}
	cy_writel(&board_ctrl->hcmd_channel, channel);
@@ -1504,7 +1509,8 @@ static void cyz_handle_rx(struct cyclades_port *info,
			while (len--) {
				data = readb(cinfo->base_addr + rx_bufaddr +
						new_rx_get);
				new_rx_get = (new_rx_get + 1)& (rx_bufsize - 1);
				new_rx_get = (new_rx_get + 1) &
							(rx_bufsize - 1);
				tty_insert_flip_char(tty, data, TTY_NORMAL);
				info->idle_stats.recv_bytes++;
				info->icount.rx++;
@@ -1636,7 +1642,8 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
		special_count = 0;
		delta_count = 0;
		info = &cinfo->ports[channel];
		if ((tty = info->tty) == NULL)
		tty = info->tty;
		if (tty == NULL)
			continue;

		ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
@@ -1732,7 +1739,8 @@ static irqreturn_t cyz_interrupt(int irq, void *dev_id)

	if (unlikely(cinfo == NULL)) {
#ifdef CY_DEBUG_INTERRUPTS
		printk(KERN_DEBUG "cyz_interrupt: spurious interrupt %d\n",irq);
		printk(KERN_DEBUG "cyz_interrupt: spurious interrupt %d\n",
									irq);
#endif
		return IRQ_NONE;	/* spurious interrupt */
	}
@@ -1851,9 +1859,8 @@ static int startup(struct cyclades_port *info)
	}

	if (!info->type) {
		if (info->tty) {
		if (info->tty)
			set_bit(TTY_IO_ERROR, &info->tty->flags);
		}
		free_page(page);
		goto errout;
	}
@@ -1904,9 +1911,8 @@ static int startup(struct cyclades_port *info)
			readb(base_addr + (CySRER << index)) | CyRxData);
		info->flags |= ASYNC_INITIALIZED;

		if (info->tty) {
		if (info->tty)
			clear_bit(TTY_IO_ERROR, &info->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));
@@ -1925,9 +1931,8 @@ static int startup(struct cyclades_port *info)
		base_addr = card->base_addr;

		firm_id = base_addr + ID_ADDRESS;
		if (!ISZLOADED(*card)) {
		if (!ISZLOADED(*card))
			return -ENODEV;
		}

		zfw_ctrl = card->base_addr +
				(readl(&firm_id->zfwctrl_addr) & 0xfffff);
@@ -1990,9 +1995,8 @@ static int startup(struct cyclades_port *info)
		/* enable send, recv, modem !!! */

		info->flags |= ASYNC_INITIALIZED;
		if (info->tty) {
		if (info->tty)
			clear_bit(TTY_IO_ERROR, &info->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));
@@ -2061,9 +2065,8 @@ static void shutdown(struct cyclades_port *info)
	void __iomem *base_addr;
	int chip, channel, index;

	if (!(info->flags & ASYNC_INITIALIZED)) {
	if (!(info->flags & ASYNC_INITIALIZED))
		return;
	}

	card = info->card;
	channel = info->line - card->first_line;
@@ -2105,9 +2108,8 @@ static void shutdown(struct cyclades_port *info)
		/* it may be appropriate to clear _XMIT at
		   some later date (after testing)!!! */

		if (info->tty) {
		if (info->tty)
			set_bit(TTY_IO_ERROR, &info->tty->flags);
		}
		info->flags &= ~ASYNC_INITIALIZED;
		spin_unlock_irqrestore(&card->card_lock, flags);
	} else {
@@ -2124,9 +2126,8 @@ static void shutdown(struct cyclades_port *info)
#endif

		firm_id = base_addr + ID_ADDRESS;
		if (!ISZLOADED(*card)) {
		if (!ISZLOADED(*card))
			return;
		}

		zfw_ctrl = card->base_addr +
				(readl(&firm_id->zfwctrl_addr) & 0xfffff);
@@ -2157,9 +2158,8 @@ static void shutdown(struct cyclades_port *info)
#endif
		}

		if (info->tty) {
		if (info->tty)
			set_bit(TTY_IO_ERROR, &info->tty->flags);
		}
		info->flags &= ~ASYNC_INITIALIZED;

		spin_unlock_irqrestore(&card->card_lock, flags);
@@ -2204,7 +2204,8 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
	 * If non-blocking mode is set, then make the check up front
	 * and then exit.
	 */
	if ((filp->f_flags & O_NONBLOCK) || (tty->flags & (1 << TTY_IO_ERROR))) {
	if ((filp->f_flags & O_NONBLOCK) ||
					(tty->flags & (1 << TTY_IO_ERROR))) {
		info->flags |= ASYNC_NORMAL_ACTIVE;
		return 0;
	}
@@ -2301,7 +2302,8 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
			return -EINVAL;
		}

		zfw_ctrl = base_addr + (readl(&firm_id->zfwctrl_addr)& 0xfffff);
		zfw_ctrl = base_addr + (readl(&firm_id->zfwctrl_addr)
								& 0xfffff);
		board_ctrl = &zfw_ctrl->board_ctrl;
		ch_ctrl = zfw_ctrl->ch_ctrl;

@@ -2378,9 +2380,9 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
	int retval;

	line = tty->index;
	if ((tty->index < 0) || (NR_PORTS <= line)) {
	if (tty->index < 0 || NR_PORTS <= line)
		return -ENODEV;
	}

	for (i = 0; i < NR_CARDS; i++)
		if (line < cy_card[i].first_line + cy_card[i].nports &&
				line >= cy_card[i].first_line)
@@ -2388,9 +2390,8 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
	if (i >= NR_CARDS)
		return -ENODEV;
	info = &cy_card[i].ports[line - cy_card[i].first_line];
	if (info->line < 0) {
	if (info->line < 0)
		return -ENODEV;
	}

	/* If the card's firmware hasn't been loaded,
	   treat it as absent from the system.  This
@@ -2456,9 +2457,9 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
#endif
	tty->driver_data = info;
	info->tty = tty;
	if (serial_paranoia_check(info, tty->name, "cy_open")) {
	if (serial_paranoia_check(info, tty->name, "cy_open"))
		return -ENODEV;
	}

#ifdef CY_DEBUG_OPEN
	printk(KERN_DEBUG "cyc:cy_open ttyC%d, count = %d\n", info->line,
			info->count);
@@ -2482,9 +2483,8 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
	 * Start up serial port
	 */
	retval = startup(info);
	if (retval) {
	if (retval)
		return retval;
	}

	retval = block_til_ready(tty, filp, info);
	if (retval) {
@@ -2591,9 +2591,8 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
	printk(KERN_DEBUG "cyc:cy_close ttyC%d\n", info->line);
#endif

	if (!info || serial_paranoia_check(info, tty->name, "cy_close")) {
	if (!info || serial_paranoia_check(info, tty->name, "cy_close"))
		return;
	}

	card = info->card;

@@ -2641,9 +2640,9 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
	 */
	tty->closing = 1;
	spin_unlock_irqrestore(&card->card_lock, flags);
	if (info->closing_wait != CY_CLOSING_WAIT_NONE) {
	if (info->closing_wait != CY_CLOSING_WAIT_NONE)
		tty_wait_until_sent(tty, info->closing_wait);
	}

	spin_lock_irqsave(&card->card_lock, flags);

	if (!IS_CYC_Z(*card)) {
@@ -2657,15 +2656,16 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
		cy_writeb(base_addr + (CySRER << index),
			  readb(base_addr + (CySRER << index)) & ~CyRxData);
		if (info->flags & ASYNC_INITIALIZED) {
			/* Waiting for on-board buffers to be empty before closing
			   the port */
			/* Waiting for on-board buffers to be empty before
			   closing the port */
			spin_unlock_irqrestore(&card->card_lock, flags);
			cy_wait_until_sent(tty, info->timeout);
			spin_lock_irqsave(&card->card_lock, flags);
		}
	} else {
#ifdef Z_WAKE
		/* Waiting for on-board buffers to be empty before closing the port */
		/* Waiting for on-board buffers to be empty before closing
		   the port */
		void __iomem *base_addr = card->base_addr;
		struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS;
		struct ZFW_CTRL __iomem *zfw_ctrl =
@@ -2738,9 +2738,8 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count)
	printk(KERN_DEBUG "cyc:cy_write ttyC%d\n", info->line);
#endif

	if (serial_paranoia_check(info, tty->name, "cy_write")) {
	if (serial_paranoia_check(info, tty->name, "cy_write"))
		return 0;
	}

	if (!info->xmit_buf)
		return 0;
@@ -2766,9 +2765,9 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count)
	info->idle_stats.xmit_bytes += ret;
	info->idle_stats.xmit_idle = jiffies;

	if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) {
	if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped)
		start_xmit(info);
	}

	return ret;
}				/* cy_write */

@@ -2950,12 +2949,12 @@ static void set_line_char(struct cyclades_port *info)
	int baud, baud_rate = 0;
	int i;

	if (!info->tty || !info->tty->termios) {
	if (!info->tty || !info->tty->termios)
		return;
	}
	if (info->line == -1) {

	if (info->line == -1)
		return;
	}

	cflag = info->tty->termios->c_cflag;
	iflag = info->tty->termios->c_iflag;

@@ -2994,13 +2993,11 @@ static void set_line_char(struct cyclades_port *info)
		}
		/* find the baud index */
		for (i = 0; i < 20; i++) {
			if (baud == baud_table[i]) {
			if (baud == baud_table[i])
				break;
		}
		}
		if (i == 20) {
		if (i == 20)
			i = 19;	/* CD1400_MAX_SPEED */
		}

		if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) ==
				ASYNC_SPD_CUST) {
@@ -3059,18 +3056,16 @@ static void set_line_char(struct cyclades_port *info)
			info->cor1 = Cy_8_BITS;
			break;
		}
		if (cflag & CSTOPB) {
		if (cflag & CSTOPB)
			info->cor1 |= Cy_2_STOP;
		}

		if (cflag & PARENB) {
			if (cflag & PARODD) {
			if (cflag & PARODD)
				info->cor1 |= CyPARITY_O;
			} else {
			else
				info->cor1 |= CyPARITY_E;
			}
		} else {
		} else
			info->cor1 |= CyPARITY_NONE;
		}

		/* CTS flow control flag */
		if (cflag & CRTSCTS) {
@@ -3123,7 +3118,8 @@ static void set_line_char(struct cyclades_port *info)
		cyy_issue_cmd(base_addr, CyCOR_CHANGE | CyCOR1ch | CyCOR2ch |
				CyCOR3ch, index);

		cy_writeb(base_addr + (CyCAR << index), (u_char) channel);	/* !!! Is this needed? */
		/* !!! Is this needed? */
		cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
		cy_writeb(base_addr + (CyRTPR << index),
			(info->default_timeout ? info->default_timeout : 0x02));
		/* 10ms rx timeout */
@@ -3191,9 +3187,8 @@ static void set_line_char(struct cyclades_port *info)
#endif
		}

		if (info->tty) {
		if (info->tty)
			clear_bit(TTY_IO_ERROR, &info->tty->flags);
		}
		spin_unlock_irqrestore(&card->card_lock, flags);

	} else {
@@ -3206,9 +3201,8 @@ static void set_line_char(struct cyclades_port *info)
		int retval;

		firm_id = card->base_addr + ID_ADDRESS;
		if (!ISZLOADED(*card)) {
		if (!ISZLOADED(*card))
			return;
		}

		zfw_ctrl = card->base_addr +
			(readl(&firm_id->zfwctrl_addr) & 0xfffff);
@@ -3268,14 +3262,12 @@ static void set_line_char(struct cyclades_port *info)
				  readl(&ch_ctrl->comm_data_l) | C_DL_1STOP);
		}
		if (cflag & PARENB) {
			if (cflag & PARODD) {
			if (cflag & PARODD)
				cy_writel(&ch_ctrl->comm_parity, C_PR_ODD);
			} else {
			else
				cy_writel(&ch_ctrl->comm_parity, C_PR_EVEN);
			}
		} else {
		} else
			cy_writel(&ch_ctrl->comm_parity, C_PR_NONE);
		}

		/* CTS flow control flag */
		if (cflag & CRTSCTS) {
@@ -3305,11 +3297,10 @@ static void set_line_char(struct cyclades_port *info)
		}

		/* CD sensitivity */
		if (cflag & CLOCAL) {
		if (cflag & CLOCAL)
			info->flags &= ~ASYNC_CHECK_CD;
		} else {
		else
			info->flags |= ASYNC_CHECK_CD;
		}

		if (baud == 0) {	/* baud rate is zero, turn off line */
			cy_writel(&ch_ctrl->rs_control,
@@ -3331,10 +3322,9 @@ static void set_line_char(struct cyclades_port *info)
				"was %x\n", info->line, retval);
		}

		if (info->tty) {
		if (info->tty)
			clear_bit(TTY_IO_ERROR, &info->tty->flags);
	}
	}
}				/* set_line_char */

static int
@@ -3731,8 +3721,8 @@ static void cy_break(struct tty_struct *tty, int break_state)
	spin_unlock_irqrestore(&card->card_lock, flags);
}				/* cy_break */

static int
get_mon_info(struct cyclades_port *info, struct cyclades_monitor __user * mon)
static int get_mon_info(struct cyclades_port *info,
				struct cyclades_monitor __user *mon)
{

	if (copy_to_user(mon, &info->mon, sizeof(struct cyclades_monitor)))
@@ -3771,8 +3761,8 @@ static int set_threshold(struct cyclades_port *info, unsigned long value)
	return 0;
}				/* set_threshold */

static int
get_threshold(struct cyclades_port *info, unsigned long __user * value)
static int get_threshold(struct cyclades_port *info,
						unsigned long __user *value)
{
	struct cyclades_card *card;
	void __iomem *base_addr;
@@ -3793,15 +3783,15 @@ get_threshold(struct cyclades_port *info, unsigned long __user * value)
	return 0;
}				/* get_threshold */

static int
set_default_threshold(struct cyclades_port *info, unsigned long value)
static int set_default_threshold(struct cyclades_port *info,
							unsigned long value)
{
	info->default_threshold = value & 0x0f;
	return 0;
}				/* set_default_threshold */

static int
get_default_threshold(struct cyclades_port *info, unsigned long __user * value)
static int get_default_threshold(struct cyclades_port *info,
						unsigned long __user *value)
{
	return put_user(info->default_threshold, value);
}				/* get_default_threshold */
@@ -3828,7 +3818,8 @@ static int set_timeout(struct cyclades_port *info, unsigned long value)
	return 0;
}				/* set_timeout */

static int get_timeout(struct cyclades_port *info, unsigned long __user * value)
static int get_timeout(struct cyclades_port *info,
						unsigned long __user *value)
{
	struct cyclades_card *card;
	void __iomem *base_addr;
@@ -3855,8 +3846,8 @@ static int set_default_timeout(struct cyclades_port *info, unsigned long value)
	return 0;
}				/* set_default_timeout */

static int
get_default_timeout(struct cyclades_port *info, unsigned long __user * value)
static int get_default_timeout(struct cyclades_port *info,
					unsigned long __user *value)
{
	return put_user(info->default_timeout, value);
}				/* get_default_timeout */
@@ -4118,9 +4109,8 @@ static void cy_throttle(struct tty_struct *tty)
			tty->ldisc.chars_in_buffer(tty), info->line);
#endif

	if (serial_paranoia_check(info, tty->name, "cy_throttle")) {
	if (serial_paranoia_check(info, tty->name, "cy_throttle"))
		return;
	}

	card = info->card;

@@ -4174,12 +4164,11 @@ static void cy_unthrottle(struct tty_struct *tty)
	char buf[64];

	printk(KERN_DEBUG "cyc:unthrottle %s: %ld...ttyC%d\n",
		tty_name(tty, buf), tty->ldisc.chars_in_buffer(tty),info->line);
		tty_name(tty, buf), tty_chars_in_buffer(tty), info->line);
#endif

	if (serial_paranoia_check(info, tty->name, "cy_unthrottle")) {
	if (serial_paranoia_check(info, tty->name, "cy_unthrottle"))
		return;
	}

	if (I_IXOFF(tty)) {
		if (info->x_char)
@@ -4274,7 +4263,8 @@ static void cy_start(struct tty_struct *tty)
		base_addr = cinfo->base_addr + (cy_chip_offset[chip] << index);

		spin_lock_irqsave(&cinfo->card_lock, flags);
		cy_writeb(base_addr + (CyCAR << index), (u_char) (channel & 0x0003));	/* index channel */
		cy_writeb(base_addr + (CyCAR << index),
			(u_char) (channel & 0x0003));	/* index channel */
		cy_writeb(base_addr + (CySRER << index),
			  readb(base_addr + (CySRER << index)) | CyTxRdy);
		spin_unlock_irqrestore(&cinfo->card_lock, flags);
@@ -4411,10 +4401,11 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
			info->cor3 = 0x08;	/* _very_ small rcv threshold */

			chip_number = (port - cinfo->first_line) / 4;
			if ((info->chip_rev = readb(cinfo->base_addr +
				      (cy_chip_offset[chip_number] <<
				       index) + (CyGFRCR << index))) >=
			    CD1400_REV_J) {
			info->chip_rev = readb(cinfo->base_addr +
				      (cy_chip_offset[chip_number] << index) +
				      (CyGFRCR << index));

			if (info->chip_rev >= CD1400_REV_J) {
				/* It is a CD1400 rev. J or later */
				info->tbpr = baud_bpr_60[13];	/* Tx BPR */
				info->tco = baud_co_60[13];	/* Tx CO */
@@ -4459,7 +4450,8 @@ static unsigned short __devinit cyy_init_card(void __iomem *true_base_addr,
	/* Cy_ClrIntr is 0x1800 */
	udelay(500L);

	for (chip_number = 0; chip_number < CyMAX_CHIPS_PER_CARD; chip_number++) {
	for (chip_number = 0; chip_number < CyMAX_CHIPS_PER_CARD;
							chip_number++) {
		base_addr =
		    true_base_addr + (cy_chip_offset[chip_number] << index);
		mdelay(1);
@@ -4560,9 +4552,8 @@ static int __init cy_detect_isa(void)
	/* scan the address table probing for Cyclom-Y/ISA boards */
	for (i = 0; i < NR_ISA_ADDRS; i++) {
		unsigned int isa_address = cy_isa_addresses[i];
		if (isa_address == 0x0000) {
		if (isa_address == 0x0000)
			return nboard;
		}

		/* probe for CD1400... */
		cy_isa_address = ioremap(isa_address, CyISA_Ywin);
@@ -4852,12 +4843,10 @@ static int __devinit cyz_load_fw(struct pci_dev *pdev, void __iomem *base_addr,
	if (mailbox != 0) {
		/* set window to last 512K of RAM */
		cy_writel(&ctl_addr->loc_addr_base, WIN_RAM + RAM_SIZE);
		//sleep(1);
		for (tmp = base_addr; tmp < base_addr + RAM_SIZE; tmp++)
			cy_writeb(tmp, 255);
		/* set window to beginning of RAM */
		cy_writel(&ctl_addr->loc_addr_base, WIN_RAM);
		//sleep(1);
	}

	retval = __cyz_load_fw(fw, "Cyclom-Z", mailbox, base_addr, NULL);
@@ -5387,7 +5376,8 @@ static void __exit cy_cleanup_module(void)
	del_timer_sync(&cyz_timerlist);
#endif /* CONFIG_CYZ_INTR */

	if ((e1 = tty_unregister_driver(cy_serial_driver)))
	e1 = tty_unregister_driver(cy_serial_driver);
	if (e1)
		printk(KERN_ERR "failed to unregister Cyclades serial "
				"driver(%d)\n", e1);