int             irqtype;
 };
 
-static int     stli_nrbrds;
+static unsigned int stli_nrbrds;
 
 /* stli_lock must NOT be taken holding brd_lock */
 static spinlock_t stli_lock;   /* TTY logic lock */
 static comstats_t      stli_comstats;
 static combrd_t                stli_brdstats;
 static struct asystats stli_cdkstats;
-static struct stlibrd  stli_dummybrd;
-static struct stliport stli_dummyport;
 
 /*****************************************************************************/
 
 static void __iomem *stli_stalgetmemptr(struct stlibrd *brdp, unsigned long offset, int line);
 static void    stli_stalreset(struct stlibrd *brdp);
 
-static struct stliport *stli_getport(int brdnr, int panelnr, int portnr);
+static struct stliport *stli_getport(unsigned int brdnr, unsigned int panelnr, unsigned int portnr);
 
 static int     stli_initecp(struct stlibrd *brdp);
 static int     stli_initonb(struct stlibrd *brdp);
 static void __exit istallion_module_exit(void)
 {
        struct stlibrd  *brdp;
+       unsigned int j;
        int             i;
 
        printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle,
                return;
        }
        put_tty_driver(stli_serial);
-       for (i = 0; i < 4; i++)
-               class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i));
+       for (j = 0; j < 4; j++)
+               class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, j));
        class_destroy(istallion_class);
        if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
                printk("STALLION: failed to un-register serial memory device, "
 
        kfree(stli_txcookbuf);
 
-       for (i = 0; (i < stli_nrbrds); i++) {
-               if ((brdp = stli_brds[i]) == NULL)
+       for (j = 0; (j < stli_nrbrds); j++) {
+               if ((brdp = stli_brds[j]) == NULL)
                        continue;
 
                stli_cleanup_ports(brdp);
                if (brdp->iosize > 0)
                        release_region(brdp->iobase, brdp->iosize);
                kfree(brdp);
-               stli_brds[i] = NULL;
+               stli_brds[j] = NULL;
        }
 }
 
 
 static int stli_parsebrd(struct stlconf *confp, char **argp)
 {
+       unsigned int i;
        char *sp;
-       int i;
 
        if (argp[0] == NULL || *argp[0] == 0)
                return 0;
 {
        struct stlibrd *brdp;
        struct stliport *portp;
-       unsigned int minordev;
-       int brdnr, portnr, rc;
+       unsigned int minordev, brdnr, portnr;
+       int rc;
 
        minordev = tty->index;
        brdnr = MINOR2BRD(minordev);
        if ((brdp->state & BST_STARTED) == 0)
                return -ENODEV;
        portnr = MINOR2PORT(minordev);
-       if ((portnr < 0) || (portnr > brdp->nrports))
+       if (portnr > brdp->nrports)
                return -ENODEV;
 
        portp = brdp->ports[portnr];
                return -ENODEV;
        if (portp->tty == NULL)
                return -ENODEV;
-       if (portp->brdnr < 0 && portp->brdnr >= stli_nrbrds)
+       if (portp->brdnr >= stli_nrbrds)
                return -ENODEV;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
        portp = tty->driver_data;
        if (portp == NULL)
                return 0;
-       if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))
+       if (portp->brdnr >= stli_nrbrds)
                return 0;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
        portp = tty->driver_data;
        if (portp == NULL)
                return;
-       if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))
+       if (portp->brdnr >= stli_nrbrds)
                return;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
        portp = tty->driver_data;
        if (portp == NULL)
                return 0;
-       if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))
+       if (portp->brdnr >= stli_nrbrds)
                return 0;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
        portp = tty->driver_data;
        if (portp == NULL)
                return 0;
-       if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))
+       if (portp->brdnr >= stli_nrbrds)
                return 0;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
 
        if (portp == NULL)
                return -ENODEV;
-       if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
+       if (portp->brdnr >= stli_nrbrds)
                return 0;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
 
        if (portp == NULL)
                return -ENODEV;
-       if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
+       if (portp->brdnr >= stli_nrbrds)
                return 0;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
        portp = tty->driver_data;
        if (portp == NULL)
                return -ENODEV;
-       if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
+       if (portp->brdnr >= stli_nrbrds)
                return 0;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
        portp = tty->driver_data;
        if (portp == NULL)
                return;
-       if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
+       if (portp->brdnr >= stli_nrbrds)
                return;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
        portp = tty->driver_data;
        if (portp == NULL)
                return;
-       if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
+       if (portp->brdnr >= stli_nrbrds)
                return;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
        portp = tty->driver_data;
        if (portp == NULL)
                return;
-       if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
+       if (portp->brdnr >= stli_nrbrds)
                return;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
        portp = tty->driver_data;
        if (portp == NULL)
                return;
-       if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
+       if (portp->brdnr >= stli_nrbrds)
                return;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
        portp = tty->driver_data;
        if (portp == NULL)
                return;
-       if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
+       if (portp->brdnr >= stli_nrbrds)
                return;
        brdp = stli_brds[portp->brdnr];
        if (brdp == NULL)
 {
        struct stlibrd *brdp;
        struct stliport *portp;
-       int brdnr, portnr, totalport;
+       unsigned int brdnr, portnr, totalport;
        int curoff, maxoff;
        char *pos;
 
 {
        cdkhdr_t __iomem *hdrp;
        struct stlibrd *brdp;
-       int brdnr;
+       unsigned int brdnr;
 
        stli_timerlist.expires = STLI_TIMEOUT;
        add_timer(&stli_timerlist);
 static int stli_initports(struct stlibrd *brdp)
 {
        struct stliport *portp;
-       int             i, panelnr, panelport;
+       unsigned int i, panelnr, panelport;
 
        for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) {
                portp = kzalloc(sizeof(struct stliport), GFP_KERNEL);
        cdkmem_t __iomem *memp;
        cdkasy_t __iomem *ap;
        unsigned long flags;
+       unsigned int portnr, nrdevs, i;
        struct stliport *portp;
-       int portnr, nrdevs, i, rc = 0;
+       int rc = 0;
        u32 memoff;
 
        spin_lock_irqsave(&brd_lock, flags);
 
 static int stli_getbrdnr(void)
 {
-       int i;
+       unsigned int i;
 
        for (i = 0; i < STL_MAXBRDS; i++) {
                if (!stli_brds[i]) {
 static int stli_findeisabrds(void)
 {
        struct stlibrd *brdp;
-       unsigned int iobase, eid;
-       int i;
+       unsigned int iobase, eid, i;
+       int brdnr;
 
 /*
  *     Firstly check if this is an EISA system.  If this is not an EISA system then
  */
                if ((brdp = stli_allocbrd()) == NULL)
                        return -ENOMEM;
-               if ((brdp->brdnr = stli_getbrdnr()) < 0)
+               brdnr = stli_getbrdnr();
+               if (brdnr < 0)
                        return -ENOMEM;
+               brdp->brdnr = (unsigned int)brdnr;
                eid = inb(iobase + 0xc82);
                if (eid == ECP_EISAID)
                        brdp->brdtype = BRD_ECPE;
                const struct pci_device_id *ent)
 {
        struct stlibrd *brdp;
-       int retval = -EIO;
+       int brdnr, retval = -EIO;
 
        retval = pci_enable_device(pdev);
        if (retval)
                retval = -ENOMEM;
                goto err;
        }
-       if ((brdp->brdnr = stli_getbrdnr()) < 0) { /* TODO: locking */
+       brdnr = stli_getbrdnr();
+       if (brdnr < 0) { /* TODO: locking */
                printk(KERN_INFO "STALLION: too many boards found, "
                        "maximum supported %d\n", STL_MAXBRDS);
                retval = -EIO;
                goto err_fr;
        }
+       brdp->brdnr = (unsigned int)brdnr;
        brdp->brdtype = BRD_ECPPCI;
 /*
  *     We have all resources from the board, so lets setup the actual
 {
        struct stlibrd *brdp, *nxtbrdp;
        struct stlconf conf;
-       int i, j, retval;
+       unsigned int i, j;
+       int retval;
 
        for (stli_nrbrds = 0; stli_nrbrds < ARRAY_SIZE(stli_brdsp);
                        stli_nrbrds++) {
        unsigned long flags;
        void __iomem *memptr;
        struct stlibrd *brdp;
-       int brdnr, size, n;
+       unsigned int brdnr;
+       int size, n;
        void *p;
        loff_t off = *offp;
 
        void __iomem *memptr;
        struct stlibrd *brdp;
        char __user *chbuf;
-       int brdnr, size, n;
+       unsigned int brdnr;
+       int size, n;
        void *p;
        loff_t off = *offp;
 
 static int stli_getbrdstats(combrd_t __user *bp)
 {
        struct stlibrd *brdp;
-       int i;
+       unsigned int i;
 
        if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t)))
                return -EFAULT;
  *     Resolve the referenced port number into a port struct pointer.
  */
 
-static struct stliport *stli_getport(int brdnr, int panelnr, int portnr)
+static struct stliport *stli_getport(unsigned int brdnr, unsigned int panelnr,
+               unsigned int portnr)
 {
        struct stlibrd *brdp;
-       int i;
+       unsigned int i;
 
-       if (brdnr < 0 || brdnr >= STL_MAXBRDS)
+       if (brdnr >= STL_MAXBRDS)
                return NULL;
        brdp = stli_brds[brdnr];
        if (brdp == NULL)
                return NULL;
        for (i = 0; (i < panelnr); i++)
                portnr += brdp->panels[i];
-       if ((portnr < 0) || (portnr >= brdp->nrports))
+       if (portnr >= brdp->nrports)
                return NULL;
        return brdp->ports[portnr];
 }
 
 static int stli_getportstruct(struct stliport __user *arg)
 {
+       struct stliport stli_dummyport;
        struct stliport *portp;
 
        if (copy_from_user(&stli_dummyport, arg, sizeof(struct stliport)))
 
 static int stli_getbrdstruct(struct stlibrd __user *arg)
 {
+       struct stlibrd stli_dummybrd;
        struct stlibrd *brdp;
 
        if (copy_from_user(&stli_dummybrd, arg, sizeof(struct stlibrd)))
                return -EFAULT;
-       if ((stli_dummybrd.brdnr < 0) || (stli_dummybrd.brdnr >= STL_MAXBRDS))
+       if (stli_dummybrd.brdnr >= STL_MAXBRDS)
                return -ENODEV;
        brdp = stli_brds[stli_dummybrd.brdnr];
        if (!brdp)