static void cy_throttle(struct tty_struct *tty);
 static void cy_send_xchar(struct tty_struct *tty, char ch);
 
-#define IS_CYC_Z(card) ((card).num_chips == -1)
+#define IS_CYC_Z(card) ((card).num_chips == (unsigned int)-1)
 
 #define Z_FPGA_CHECK(card) \
        ((readl(&((struct RUNTIME_9060 __iomem *) \
 {
        struct cyclades_port *info;
        struct tty_struct *tty;
-       int char_count;
-       int j, len, index = cinfo->bus_index;
-       int save_xir, channel, save_car;
-       char data;
+       int len, index = cinfo->bus_index;
+       u8 save_xir, channel, save_car, data, char_count;
 
 #ifdef CY_DEBUG_INTERRUPTS
        printk(KERN_DEBUG "cyy_interrupt: rcvd intr, chip %d\n", chip);
 #endif
        /* determine the channel & change to that context */
-       save_xir = (u_char) readb(base_addr + (CyRIR << index));
-       channel = (u_short) (save_xir & CyIRChannel);
+       save_xir = readb(base_addr + (CyRIR << index));
+       channel = save_xir & CyIRChannel;
        info = &cinfo->ports[channel + chip * 4];
        save_car = readb(base_addr + (CyCAR << index));
        cy_writeb(base_addr + (CyCAR << index), save_xir);
 
        /* if there is nowhere to put the data, discard it */
        if (info->tty == NULL) {
-               j = (readb(base_addr + (CyRIVR << index)) & CyIVRMask);
-               if (j == CyIVRRxEx) {   /* exception */
+               if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) ==
+                               CyIVRRxEx) {    /* exception */
                        data = readb(base_addr + (CyRDSR << index));
                } else {        /* normal character reception */
                        char_count = readb(base_addr + (CyRDCR << index));
        }
        /* there is an open port for this data */
        tty = info->tty;
-       j = readb(base_addr + (CyRIVR << index)) & CyIVRMask;
-       if (j == CyIVRRxEx) {   /* exception */
+       if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) ==
+                       CyIVRRxEx) {    /* exception */
                data = readb(base_addr + (CyRDSR << index));
 
                /* For statistics only */
        cy_writeb(base_addr + (CyCAR << index), save_car);
 }
 
-static void cyy_chip_tx(struct cyclades_card *cinfo, int chip,
+static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip,
                void __iomem *base_addr)
 {
        struct cyclades_port *info;
-       int char_count;
-       int outch;
-       int save_xir, channel, save_car, index = cinfo->bus_index;
+       int char_count, index = cinfo->bus_index;
+       u8 save_xir, channel, save_car, outch;
 
        /* Since we only get here when the transmit buffer
           is empty, we know we can always stuff a dozen
 #endif
 
        /* determine the channel & change to that context */
-       save_xir = (u_char) readb(base_addr + (CyTIR << index));
-       channel = (u_short) (save_xir & CyIRChannel);
+       save_xir = readb(base_addr + (CyTIR << index));
+       channel = save_xir & CyIRChannel;
        save_car = readb(base_addr + (CyCAR << index));
        cy_writeb(base_addr + (CyCAR << index), save_xir);
 
                void __iomem *base_addr)
 {
        struct cyclades_port *info;
-       int mdm_change, mdm_status;
-       int save_xir, channel, save_car, index = cinfo->bus_index;
+       int index = cinfo->bus_index;
+       u8 save_xir, channel, save_car, mdm_change, mdm_status;
 
        /* determine the channel & change to that context */
-       save_xir = (u_char) readb(base_addr + (CyMIR << index));
-       channel = (u_short) (save_xir & CyIRChannel);
+       save_xir = readb(base_addr + (CyMIR << index));
+       channel = save_xir & CyIRChannel;
        info = &cinfo->ports[channel + chip * 4];
        save_car = readb(base_addr + (CyCAR << index));
        cy_writeb(base_addr + (CyCAR << index), save_xir);
        int status;
        struct cyclades_card *cinfo = dev_id;
        void __iomem *base_addr, *card_base_addr;
-       int chip;
+       unsigned int chip, too_many, had_work;
        int index;
-       int too_many;
-       int had_work;
 
        if (unlikely(cinfo == NULL)) {
 #ifdef CY_DEBUG_INTERRUPTS
        struct ZFW_CTRL __iomem *zfw_ctrl;
        struct BOARD_CTRL __iomem *board_ctrl;
        __u32 __iomem *pci_doorbell;
-       int index;
+       unsigned int index;
 
        firm_id = cinfo->base_addr + ID_ADDRESS;
        if (!ISZLOADED(*cinfo)) {
        return 0;
 }                              /* cyz_issue_cmd */
 
-static void
-cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
+static void cyz_handle_rx(struct cyclades_port *info,
                struct BUF_CTRL __iomem *buf_ctrl)
 {
        struct cyclades_card *cinfo = info->card;
        struct tty_struct *tty = info->tty;
-       int char_count;
+       unsigned int char_count;
        int len;
 #ifdef BLOCKMOVE
        unsigned char *buf;
                                char_count = rx_put - rx_get;
                        else
                                char_count = rx_put - rx_get + rx_bufsize;
-                       if (char_count >= (int)readl(&buf_ctrl->rx_threshold) &&
+                       if (char_count >= readl(&buf_ctrl->rx_threshold) &&
                                        !timer_pending(&cyz_rx_full_timer[
                                                        info->line]))
                                mod_timer(&cyz_rx_full_timer[info->line],
        }
 }
 
-static void
-cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
+static void cyz_handle_tx(struct cyclades_port *info,
                struct BUF_CTRL __iomem *buf_ctrl)
 {
        struct cyclades_card *cinfo = info->card;
        struct tty_struct *tty = info->tty;
-       char data;
-       int char_count;
+       u8 data;
+       unsigned int char_count;
 #ifdef BLOCKMOVE
        int small_count;
 #endif
                        printk(KERN_DEBUG "cyz_interrupt: rcvd intr, card %d, "
                                        "port %ld\n", info->card, channel);
 #endif
-                       cyz_handle_rx(info, ch_ctrl, buf_ctrl);
+                       cyz_handle_rx(info, buf_ctrl);
                        break;
                case C_CM_TXBEMPTY:
                case C_CM_TXLOWWM:
                        printk(KERN_DEBUG "cyz_interrupt: xmit intr, card %d, "
                                        "port %ld\n", info->card, channel);
 #endif
-                       cyz_handle_tx(info, ch_ctrl, buf_ctrl);
+                       cyz_handle_tx(info, buf_ctrl);
                        break;
 #endif                         /* CONFIG_CYZ_INTR */
                case C_CM_FATAL:
        struct FIRM_ID __iomem *firm_id;
        struct ZFW_CTRL __iomem *zfw_ctrl;
        struct BOARD_CTRL __iomem *board_ctrl;
-       struct CH_CTRL __iomem *ch_ctrl;
        struct BUF_CTRL __iomem *buf_ctrl;
        unsigned long expires = jiffies + HZ;
-       int card, port;
+       unsigned int port, card;
 
        for (card = 0; card < NR_CARDS; card++) {
                cinfo = &cy_card[card];
                for (port = 0; port < cinfo->nports; port++) {
                        info = &cinfo->ports[port];
                        tty = info->tty;
-                       ch_ctrl = &(zfw_ctrl->ch_ctrl[port]);
                        buf_ctrl = &(zfw_ctrl->buf_ctrl[port]);
 
                        if (!info->throttle)
-                               cyz_handle_rx(info, ch_ctrl, buf_ctrl);
-                       cyz_handle_tx(info, ch_ctrl, buf_ctrl);
+                               cyz_handle_rx(info, buf_ctrl);
+                       cyz_handle_tx(info, buf_ctrl);
                }
                /* poll every 'cyz_polling_cycle' period */
                expires = jiffies + cyz_polling_cycle;
 static int cy_open(struct tty_struct *tty, struct file *filp)
 {
        struct cyclades_port *info;
-       unsigned int i;
-       int retval, line;
+       unsigned int i, line;
+       int retval;
 
        line = tty->index;
-       if ((line < 0) || (NR_PORTS <= line)) {
+       if ((tty->index < 0) || (NR_PORTS <= line)) {
                return -ENODEV;
        }
        for (i = 0; i < NR_CARDS; i++)
 {
        struct cyclades_port *info;
        u32 uninitialized_var(mailbox);
-       unsigned int nports;
+       unsigned int nports, port;
        unsigned short chip_number;
-       int uninitialized_var(index), port;
+       int uninitialized_var(index);
 
        spin_lock_init(&cinfo->card_lock);
 
                        }
                }
 #endif                         /* CONFIG_CYZ_INTR */
-               cy_card[card_no].num_chips = -1;
+               cy_card[card_no].num_chips = (unsigned int)-1;
        }
 
        /* set cy_card */
 static void __exit cy_cleanup_module(void)
 {
        struct cyclades_card *card;
-       int i, e1;
+       unsigned int i, e1;
 
 #ifndef CONFIG_CYZ_INTR
        del_timer_sync(&cyz_timerlist);
 #endif /* CONFIG_CYZ_INTR */
                                )
                                free_irq(card->irq, card);
-                       for (e1 = card->first_line;
-                                       e1 < card->first_line +
+                       for (e1 = card->first_line; e1 < card->first_line +
                                        card->nports; e1++)
                                tty_unregister_device(cy_serial_driver, e1);
                        kfree(card->ports);