diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2006-12-08 05:39:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:29:00 -0500 |
commit | 1328d737f510e9933a621f66aa8de81c02b647a7 (patch) | |
tree | 921c9c1c0d4eb4c2462e05016f63f242e83db072 /drivers | |
parent | 1f8ec435e3516eb831bb98110cc2b2b28057154b (diff) |
[PATCH] Char: istallion, variables cleanup
- wipe gcc -W warnings by int -> uint conversion
- move 2 global variables into their local place
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/istallion.c | 100 |
1 files changed, 55 insertions, 45 deletions
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 75b1e0cbf586..28e9230e887a 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -110,7 +110,7 @@ struct stlconf { | |||
110 | int irqtype; | 110 | int irqtype; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | static int stli_nrbrds; | 113 | static unsigned int stli_nrbrds; |
114 | 114 | ||
115 | /* stli_lock must NOT be taken holding brd_lock */ | 115 | /* stli_lock must NOT be taken holding brd_lock */ |
116 | static spinlock_t stli_lock; /* TTY logic lock */ | 116 | static spinlock_t stli_lock; /* TTY logic lock */ |
@@ -186,8 +186,6 @@ static struct ktermios stli_deftermios = { | |||
186 | static comstats_t stli_comstats; | 186 | static comstats_t stli_comstats; |
187 | static combrd_t stli_brdstats; | 187 | static combrd_t stli_brdstats; |
188 | static struct asystats stli_cdkstats; | 188 | static struct asystats stli_cdkstats; |
189 | static struct stlibrd stli_dummybrd; | ||
190 | static struct stliport stli_dummyport; | ||
191 | 189 | ||
192 | /*****************************************************************************/ | 190 | /*****************************************************************************/ |
193 | 191 | ||
@@ -682,7 +680,7 @@ static void stli_stalinit(struct stlibrd *brdp); | |||
682 | static void __iomem *stli_stalgetmemptr(struct stlibrd *brdp, unsigned long offset, int line); | 680 | static void __iomem *stli_stalgetmemptr(struct stlibrd *brdp, unsigned long offset, int line); |
683 | static void stli_stalreset(struct stlibrd *brdp); | 681 | static void stli_stalreset(struct stlibrd *brdp); |
684 | 682 | ||
685 | static struct stliport *stli_getport(int brdnr, int panelnr, int portnr); | 683 | static struct stliport *stli_getport(unsigned int brdnr, unsigned int panelnr, unsigned int portnr); |
686 | 684 | ||
687 | static int stli_initecp(struct stlibrd *brdp); | 685 | static int stli_initecp(struct stlibrd *brdp); |
688 | static int stli_initonb(struct stlibrd *brdp); | 686 | static int stli_initonb(struct stlibrd *brdp); |
@@ -755,6 +753,7 @@ static int __init istallion_module_init(void) | |||
755 | static void __exit istallion_module_exit(void) | 753 | static void __exit istallion_module_exit(void) |
756 | { | 754 | { |
757 | struct stlibrd *brdp; | 755 | struct stlibrd *brdp; |
756 | unsigned int j; | ||
758 | int i; | 757 | int i; |
759 | 758 | ||
760 | printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, | 759 | printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, |
@@ -777,8 +776,8 @@ static void __exit istallion_module_exit(void) | |||
777 | return; | 776 | return; |
778 | } | 777 | } |
779 | put_tty_driver(stli_serial); | 778 | put_tty_driver(stli_serial); |
780 | for (i = 0; i < 4; i++) | 779 | for (j = 0; j < 4; j++) |
781 | class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i)); | 780 | class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, j)); |
782 | class_destroy(istallion_class); | 781 | class_destroy(istallion_class); |
783 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) | 782 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) |
784 | printk("STALLION: failed to un-register serial memory device, " | 783 | printk("STALLION: failed to un-register serial memory device, " |
@@ -786,8 +785,8 @@ static void __exit istallion_module_exit(void) | |||
786 | 785 | ||
787 | kfree(stli_txcookbuf); | 786 | kfree(stli_txcookbuf); |
788 | 787 | ||
789 | for (i = 0; (i < stli_nrbrds); i++) { | 788 | for (j = 0; (j < stli_nrbrds); j++) { |
790 | if ((brdp = stli_brds[i]) == NULL) | 789 | if ((brdp = stli_brds[j]) == NULL) |
791 | continue; | 790 | continue; |
792 | 791 | ||
793 | stli_cleanup_ports(brdp); | 792 | stli_cleanup_ports(brdp); |
@@ -796,7 +795,7 @@ static void __exit istallion_module_exit(void) | |||
796 | if (brdp->iosize > 0) | 795 | if (brdp->iosize > 0) |
797 | release_region(brdp->iobase, brdp->iosize); | 796 | release_region(brdp->iobase, brdp->iosize); |
798 | kfree(brdp); | 797 | kfree(brdp); |
799 | stli_brds[i] = NULL; | 798 | stli_brds[j] = NULL; |
800 | } | 799 | } |
801 | } | 800 | } |
802 | 801 | ||
@@ -811,8 +810,8 @@ module_exit(istallion_module_exit); | |||
811 | 810 | ||
812 | static int stli_parsebrd(struct stlconf *confp, char **argp) | 811 | static int stli_parsebrd(struct stlconf *confp, char **argp) |
813 | { | 812 | { |
813 | unsigned int i; | ||
814 | char *sp; | 814 | char *sp; |
815 | int i; | ||
816 | 815 | ||
817 | if (argp[0] == NULL || *argp[0] == 0) | 816 | if (argp[0] == NULL || *argp[0] == 0) |
818 | return 0; | 817 | return 0; |
@@ -843,8 +842,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
843 | { | 842 | { |
844 | struct stlibrd *brdp; | 843 | struct stlibrd *brdp; |
845 | struct stliport *portp; | 844 | struct stliport *portp; |
846 | unsigned int minordev; | 845 | unsigned int minordev, brdnr, portnr; |
847 | int brdnr, portnr, rc; | 846 | int rc; |
848 | 847 | ||
849 | minordev = tty->index; | 848 | minordev = tty->index; |
850 | brdnr = MINOR2BRD(minordev); | 849 | brdnr = MINOR2BRD(minordev); |
@@ -856,7 +855,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
856 | if ((brdp->state & BST_STARTED) == 0) | 855 | if ((brdp->state & BST_STARTED) == 0) |
857 | return -ENODEV; | 856 | return -ENODEV; |
858 | portnr = MINOR2PORT(minordev); | 857 | portnr = MINOR2PORT(minordev); |
859 | if ((portnr < 0) || (portnr > brdp->nrports)) | 858 | if (portnr > brdp->nrports) |
860 | return -ENODEV; | 859 | return -ENODEV; |
861 | 860 | ||
862 | portp = brdp->ports[portnr]; | 861 | portp = brdp->ports[portnr]; |
@@ -1232,7 +1231,7 @@ static int stli_setport(struct stliport *portp) | |||
1232 | return -ENODEV; | 1231 | return -ENODEV; |
1233 | if (portp->tty == NULL) | 1232 | if (portp->tty == NULL) |
1234 | return -ENODEV; | 1233 | return -ENODEV; |
1235 | if (portp->brdnr < 0 && portp->brdnr >= stli_nrbrds) | 1234 | if (portp->brdnr >= stli_nrbrds) |
1236 | return -ENODEV; | 1235 | return -ENODEV; |
1237 | brdp = stli_brds[portp->brdnr]; | 1236 | brdp = stli_brds[portp->brdnr]; |
1238 | if (brdp == NULL) | 1237 | if (brdp == NULL) |
@@ -1324,7 +1323,7 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun | |||
1324 | portp = tty->driver_data; | 1323 | portp = tty->driver_data; |
1325 | if (portp == NULL) | 1324 | if (portp == NULL) |
1326 | return 0; | 1325 | return 0; |
1327 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1326 | if (portp->brdnr >= stli_nrbrds) |
1328 | return 0; | 1327 | return 0; |
1329 | brdp = stli_brds[portp->brdnr]; | 1328 | brdp = stli_brds[portp->brdnr]; |
1330 | if (brdp == NULL) | 1329 | if (brdp == NULL) |
@@ -1446,7 +1445,7 @@ static void stli_flushchars(struct tty_struct *tty) | |||
1446 | portp = tty->driver_data; | 1445 | portp = tty->driver_data; |
1447 | if (portp == NULL) | 1446 | if (portp == NULL) |
1448 | return; | 1447 | return; |
1449 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1448 | if (portp->brdnr >= stli_nrbrds) |
1450 | return; | 1449 | return; |
1451 | brdp = stli_brds[portp->brdnr]; | 1450 | brdp = stli_brds[portp->brdnr]; |
1452 | if (brdp == NULL) | 1451 | if (brdp == NULL) |
@@ -1524,7 +1523,7 @@ static int stli_writeroom(struct tty_struct *tty) | |||
1524 | portp = tty->driver_data; | 1523 | portp = tty->driver_data; |
1525 | if (portp == NULL) | 1524 | if (portp == NULL) |
1526 | return 0; | 1525 | return 0; |
1527 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1526 | if (portp->brdnr >= stli_nrbrds) |
1528 | return 0; | 1527 | return 0; |
1529 | brdp = stli_brds[portp->brdnr]; | 1528 | brdp = stli_brds[portp->brdnr]; |
1530 | if (brdp == NULL) | 1529 | if (brdp == NULL) |
@@ -1572,7 +1571,7 @@ static int stli_charsinbuffer(struct tty_struct *tty) | |||
1572 | portp = tty->driver_data; | 1571 | portp = tty->driver_data; |
1573 | if (portp == NULL) | 1572 | if (portp == NULL) |
1574 | return 0; | 1573 | return 0; |
1575 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1574 | if (portp->brdnr >= stli_nrbrds) |
1576 | return 0; | 1575 | return 0; |
1577 | brdp = stli_brds[portp->brdnr]; | 1576 | brdp = stli_brds[portp->brdnr]; |
1578 | if (brdp == NULL) | 1577 | if (brdp == NULL) |
@@ -1670,7 +1669,7 @@ static int stli_tiocmget(struct tty_struct *tty, struct file *file) | |||
1670 | 1669 | ||
1671 | if (portp == NULL) | 1670 | if (portp == NULL) |
1672 | return -ENODEV; | 1671 | return -ENODEV; |
1673 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) | 1672 | if (portp->brdnr >= stli_nrbrds) |
1674 | return 0; | 1673 | return 0; |
1675 | brdp = stli_brds[portp->brdnr]; | 1674 | brdp = stli_brds[portp->brdnr]; |
1676 | if (brdp == NULL) | 1675 | if (brdp == NULL) |
@@ -1694,7 +1693,7 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file, | |||
1694 | 1693 | ||
1695 | if (portp == NULL) | 1694 | if (portp == NULL) |
1696 | return -ENODEV; | 1695 | return -ENODEV; |
1697 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) | 1696 | if (portp->brdnr >= stli_nrbrds) |
1698 | return 0; | 1697 | return 0; |
1699 | brdp = stli_brds[portp->brdnr]; | 1698 | brdp = stli_brds[portp->brdnr]; |
1700 | if (brdp == NULL) | 1699 | if (brdp == NULL) |
@@ -1728,7 +1727,7 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm | |||
1728 | portp = tty->driver_data; | 1727 | portp = tty->driver_data; |
1729 | if (portp == NULL) | 1728 | if (portp == NULL) |
1730 | return -ENODEV; | 1729 | return -ENODEV; |
1731 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) | 1730 | if (portp->brdnr >= stli_nrbrds) |
1732 | return 0; | 1731 | return 0; |
1733 | brdp = stli_brds[portp->brdnr]; | 1732 | brdp = stli_brds[portp->brdnr]; |
1734 | if (brdp == NULL) | 1733 | if (brdp == NULL) |
@@ -1806,7 +1805,7 @@ static void stli_settermios(struct tty_struct *tty, struct ktermios *old) | |||
1806 | portp = tty->driver_data; | 1805 | portp = tty->driver_data; |
1807 | if (portp == NULL) | 1806 | if (portp == NULL) |
1808 | return; | 1807 | return; |
1809 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) | 1808 | if (portp->brdnr >= stli_nrbrds) |
1810 | return; | 1809 | return; |
1811 | brdp = stli_brds[portp->brdnr]; | 1810 | brdp = stli_brds[portp->brdnr]; |
1812 | if (brdp == NULL) | 1811 | if (brdp == NULL) |
@@ -1921,7 +1920,7 @@ static void stli_hangup(struct tty_struct *tty) | |||
1921 | portp = tty->driver_data; | 1920 | portp = tty->driver_data; |
1922 | if (portp == NULL) | 1921 | if (portp == NULL) |
1923 | return; | 1922 | return; |
1924 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) | 1923 | if (portp->brdnr >= stli_nrbrds) |
1925 | return; | 1924 | return; |
1926 | brdp = stli_brds[portp->brdnr]; | 1925 | brdp = stli_brds[portp->brdnr]; |
1927 | if (brdp == NULL) | 1926 | if (brdp == NULL) |
@@ -1974,7 +1973,7 @@ static void stli_flushbuffer(struct tty_struct *tty) | |||
1974 | portp = tty->driver_data; | 1973 | portp = tty->driver_data; |
1975 | if (portp == NULL) | 1974 | if (portp == NULL) |
1976 | return; | 1975 | return; |
1977 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) | 1976 | if (portp->brdnr >= stli_nrbrds) |
1978 | return; | 1977 | return; |
1979 | brdp = stli_brds[portp->brdnr]; | 1978 | brdp = stli_brds[portp->brdnr]; |
1980 | if (brdp == NULL) | 1979 | if (brdp == NULL) |
@@ -2011,7 +2010,7 @@ static void stli_breakctl(struct tty_struct *tty, int state) | |||
2011 | portp = tty->driver_data; | 2010 | portp = tty->driver_data; |
2012 | if (portp == NULL) | 2011 | if (portp == NULL) |
2013 | return; | 2012 | return; |
2014 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) | 2013 | if (portp->brdnr >= stli_nrbrds) |
2015 | return; | 2014 | return; |
2016 | brdp = stli_brds[portp->brdnr]; | 2015 | brdp = stli_brds[portp->brdnr]; |
2017 | if (brdp == NULL) | 2016 | if (brdp == NULL) |
@@ -2058,7 +2057,7 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) | |||
2058 | portp = tty->driver_data; | 2057 | portp = tty->driver_data; |
2059 | if (portp == NULL) | 2058 | if (portp == NULL) |
2060 | return; | 2059 | return; |
2061 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) | 2060 | if (portp->brdnr >= stli_nrbrds) |
2062 | return; | 2061 | return; |
2063 | brdp = stli_brds[portp->brdnr]; | 2062 | brdp = stli_brds[portp->brdnr]; |
2064 | if (brdp == NULL) | 2063 | if (brdp == NULL) |
@@ -2151,7 +2150,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo | |||
2151 | { | 2150 | { |
2152 | struct stlibrd *brdp; | 2151 | struct stlibrd *brdp; |
2153 | struct stliport *portp; | 2152 | struct stliport *portp; |
2154 | int brdnr, portnr, totalport; | 2153 | unsigned int brdnr, portnr, totalport; |
2155 | int curoff, maxoff; | 2154 | int curoff, maxoff; |
2156 | char *pos; | 2155 | char *pos; |
2157 | 2156 | ||
@@ -2603,7 +2602,7 @@ static void stli_poll(unsigned long arg) | |||
2603 | { | 2602 | { |
2604 | cdkhdr_t __iomem *hdrp; | 2603 | cdkhdr_t __iomem *hdrp; |
2605 | struct stlibrd *brdp; | 2604 | struct stlibrd *brdp; |
2606 | int brdnr; | 2605 | unsigned int brdnr; |
2607 | 2606 | ||
2608 | stli_timerlist.expires = STLI_TIMEOUT; | 2607 | stli_timerlist.expires = STLI_TIMEOUT; |
2609 | add_timer(&stli_timerlist); | 2608 | add_timer(&stli_timerlist); |
@@ -2787,7 +2786,7 @@ static long stli_mktiocm(unsigned long sigvalue) | |||
2787 | static int stli_initports(struct stlibrd *brdp) | 2786 | static int stli_initports(struct stlibrd *brdp) |
2788 | { | 2787 | { |
2789 | struct stliport *portp; | 2788 | struct stliport *portp; |
2790 | int i, panelnr, panelport; | 2789 | unsigned int i, panelnr, panelport; |
2791 | 2790 | ||
2792 | for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { | 2791 | for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { |
2793 | portp = kzalloc(sizeof(struct stliport), GFP_KERNEL); | 2792 | portp = kzalloc(sizeof(struct stliport), GFP_KERNEL); |
@@ -3570,8 +3569,9 @@ static int stli_startbrd(struct stlibrd *brdp) | |||
3570 | cdkmem_t __iomem *memp; | 3569 | cdkmem_t __iomem *memp; |
3571 | cdkasy_t __iomem *ap; | 3570 | cdkasy_t __iomem *ap; |
3572 | unsigned long flags; | 3571 | unsigned long flags; |
3572 | unsigned int portnr, nrdevs, i; | ||
3573 | struct stliport *portp; | 3573 | struct stliport *portp; |
3574 | int portnr, nrdevs, i, rc = 0; | 3574 | int rc = 0; |
3575 | u32 memoff; | 3575 | u32 memoff; |
3576 | 3576 | ||
3577 | spin_lock_irqsave(&brd_lock, flags); | 3577 | spin_lock_irqsave(&brd_lock, flags); |
@@ -3807,7 +3807,7 @@ static int stli_eisamemprobe(struct stlibrd *brdp) | |||
3807 | 3807 | ||
3808 | static int stli_getbrdnr(void) | 3808 | static int stli_getbrdnr(void) |
3809 | { | 3809 | { |
3810 | int i; | 3810 | unsigned int i; |
3811 | 3811 | ||
3812 | for (i = 0; i < STL_MAXBRDS; i++) { | 3812 | for (i = 0; i < STL_MAXBRDS; i++) { |
3813 | if (!stli_brds[i]) { | 3813 | if (!stli_brds[i]) { |
@@ -3834,8 +3834,8 @@ static int stli_getbrdnr(void) | |||
3834 | static int stli_findeisabrds(void) | 3834 | static int stli_findeisabrds(void) |
3835 | { | 3835 | { |
3836 | struct stlibrd *brdp; | 3836 | struct stlibrd *brdp; |
3837 | unsigned int iobase, eid; | 3837 | unsigned int iobase, eid, i; |
3838 | int i; | 3838 | int brdnr; |
3839 | 3839 | ||
3840 | /* | 3840 | /* |
3841 | * Firstly check if this is an EISA system. If this is not an EISA system then | 3841 | * Firstly check if this is an EISA system. If this is not an EISA system then |
@@ -3874,8 +3874,10 @@ static int stli_findeisabrds(void) | |||
3874 | */ | 3874 | */ |
3875 | if ((brdp = stli_allocbrd()) == NULL) | 3875 | if ((brdp = stli_allocbrd()) == NULL) |
3876 | return -ENOMEM; | 3876 | return -ENOMEM; |
3877 | if ((brdp->brdnr = stli_getbrdnr()) < 0) | 3877 | brdnr = stli_getbrdnr(); |
3878 | if (brdnr < 0) | ||
3878 | return -ENOMEM; | 3879 | return -ENOMEM; |
3880 | brdp->brdnr = (unsigned int)brdnr; | ||
3879 | eid = inb(iobase + 0xc82); | 3881 | eid = inb(iobase + 0xc82); |
3880 | if (eid == ECP_EISAID) | 3882 | if (eid == ECP_EISAID) |
3881 | brdp->brdtype = BRD_ECPE; | 3883 | brdp->brdtype = BRD_ECPE; |
@@ -3911,7 +3913,7 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev, | |||
3911 | const struct pci_device_id *ent) | 3913 | const struct pci_device_id *ent) |
3912 | { | 3914 | { |
3913 | struct stlibrd *brdp; | 3915 | struct stlibrd *brdp; |
3914 | int retval = -EIO; | 3916 | int brdnr, retval = -EIO; |
3915 | 3917 | ||
3916 | retval = pci_enable_device(pdev); | 3918 | retval = pci_enable_device(pdev); |
3917 | if (retval) | 3919 | if (retval) |
@@ -3921,12 +3923,14 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev, | |||
3921 | retval = -ENOMEM; | 3923 | retval = -ENOMEM; |
3922 | goto err; | 3924 | goto err; |
3923 | } | 3925 | } |
3924 | if ((brdp->brdnr = stli_getbrdnr()) < 0) { /* TODO: locking */ | 3926 | brdnr = stli_getbrdnr(); |
3927 | if (brdnr < 0) { /* TODO: locking */ | ||
3925 | printk(KERN_INFO "STALLION: too many boards found, " | 3928 | printk(KERN_INFO "STALLION: too many boards found, " |
3926 | "maximum supported %d\n", STL_MAXBRDS); | 3929 | "maximum supported %d\n", STL_MAXBRDS); |
3927 | retval = -EIO; | 3930 | retval = -EIO; |
3928 | goto err_fr; | 3931 | goto err_fr; |
3929 | } | 3932 | } |
3933 | brdp->brdnr = (unsigned int)brdnr; | ||
3930 | brdp->brdtype = BRD_ECPPCI; | 3934 | brdp->brdtype = BRD_ECPPCI; |
3931 | /* | 3935 | /* |
3932 | * We have all resources from the board, so lets setup the actual | 3936 | * We have all resources from the board, so lets setup the actual |
@@ -3998,7 +4002,8 @@ static int stli_initbrds(void) | |||
3998 | { | 4002 | { |
3999 | struct stlibrd *brdp, *nxtbrdp; | 4003 | struct stlibrd *brdp, *nxtbrdp; |
4000 | struct stlconf conf; | 4004 | struct stlconf conf; |
4001 | int i, j, retval; | 4005 | unsigned int i, j; |
4006 | int retval; | ||
4002 | 4007 | ||
4003 | for (stli_nrbrds = 0; stli_nrbrds < ARRAY_SIZE(stli_brdsp); | 4008 | for (stli_nrbrds = 0; stli_nrbrds < ARRAY_SIZE(stli_brdsp); |
4004 | stli_nrbrds++) { | 4009 | stli_nrbrds++) { |
@@ -4074,7 +4079,8 @@ static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, lof | |||
4074 | unsigned long flags; | 4079 | unsigned long flags; |
4075 | void __iomem *memptr; | 4080 | void __iomem *memptr; |
4076 | struct stlibrd *brdp; | 4081 | struct stlibrd *brdp; |
4077 | int brdnr, size, n; | 4082 | unsigned int brdnr; |
4083 | int size, n; | ||
4078 | void *p; | 4084 | void *p; |
4079 | loff_t off = *offp; | 4085 | loff_t off = *offp; |
4080 | 4086 | ||
@@ -4138,7 +4144,8 @@ static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t cou | |||
4138 | void __iomem *memptr; | 4144 | void __iomem *memptr; |
4139 | struct stlibrd *brdp; | 4145 | struct stlibrd *brdp; |
4140 | char __user *chbuf; | 4146 | char __user *chbuf; |
4141 | int brdnr, size, n; | 4147 | unsigned int brdnr; |
4148 | int size, n; | ||
4142 | void *p; | 4149 | void *p; |
4143 | loff_t off = *offp; | 4150 | loff_t off = *offp; |
4144 | 4151 | ||
@@ -4198,7 +4205,7 @@ out: | |||
4198 | static int stli_getbrdstats(combrd_t __user *bp) | 4205 | static int stli_getbrdstats(combrd_t __user *bp) |
4199 | { | 4206 | { |
4200 | struct stlibrd *brdp; | 4207 | struct stlibrd *brdp; |
4201 | int i; | 4208 | unsigned int i; |
4202 | 4209 | ||
4203 | if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t))) | 4210 | if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t))) |
4204 | return -EFAULT; | 4211 | return -EFAULT; |
@@ -4234,19 +4241,20 @@ static int stli_getbrdstats(combrd_t __user *bp) | |||
4234 | * Resolve the referenced port number into a port struct pointer. | 4241 | * Resolve the referenced port number into a port struct pointer. |
4235 | */ | 4242 | */ |
4236 | 4243 | ||
4237 | static struct stliport *stli_getport(int brdnr, int panelnr, int portnr) | 4244 | static struct stliport *stli_getport(unsigned int brdnr, unsigned int panelnr, |
4245 | unsigned int portnr) | ||
4238 | { | 4246 | { |
4239 | struct stlibrd *brdp; | 4247 | struct stlibrd *brdp; |
4240 | int i; | 4248 | unsigned int i; |
4241 | 4249 | ||
4242 | if (brdnr < 0 || brdnr >= STL_MAXBRDS) | 4250 | if (brdnr >= STL_MAXBRDS) |
4243 | return NULL; | 4251 | return NULL; |
4244 | brdp = stli_brds[brdnr]; | 4252 | brdp = stli_brds[brdnr]; |
4245 | if (brdp == NULL) | 4253 | if (brdp == NULL) |
4246 | return NULL; | 4254 | return NULL; |
4247 | for (i = 0; (i < panelnr); i++) | 4255 | for (i = 0; (i < panelnr); i++) |
4248 | portnr += brdp->panels[i]; | 4256 | portnr += brdp->panels[i]; |
4249 | if ((portnr < 0) || (portnr >= brdp->nrports)) | 4257 | if (portnr >= brdp->nrports) |
4250 | return NULL; | 4258 | return NULL; |
4251 | return brdp->ports[portnr]; | 4259 | return brdp->ports[portnr]; |
4252 | } | 4260 | } |
@@ -4405,6 +4413,7 @@ static int stli_clrportstats(struct stliport *portp, comstats_t __user *cp) | |||
4405 | 4413 | ||
4406 | static int stli_getportstruct(struct stliport __user *arg) | 4414 | static int stli_getportstruct(struct stliport __user *arg) |
4407 | { | 4415 | { |
4416 | struct stliport stli_dummyport; | ||
4408 | struct stliport *portp; | 4417 | struct stliport *portp; |
4409 | 4418 | ||
4410 | if (copy_from_user(&stli_dummyport, arg, sizeof(struct stliport))) | 4419 | if (copy_from_user(&stli_dummyport, arg, sizeof(struct stliport))) |
@@ -4426,11 +4435,12 @@ static int stli_getportstruct(struct stliport __user *arg) | |||
4426 | 4435 | ||
4427 | static int stli_getbrdstruct(struct stlibrd __user *arg) | 4436 | static int stli_getbrdstruct(struct stlibrd __user *arg) |
4428 | { | 4437 | { |
4438 | struct stlibrd stli_dummybrd; | ||
4429 | struct stlibrd *brdp; | 4439 | struct stlibrd *brdp; |
4430 | 4440 | ||
4431 | if (copy_from_user(&stli_dummybrd, arg, sizeof(struct stlibrd))) | 4441 | if (copy_from_user(&stli_dummybrd, arg, sizeof(struct stlibrd))) |
4432 | return -EFAULT; | 4442 | return -EFAULT; |
4433 | if ((stli_dummybrd.brdnr < 0) || (stli_dummybrd.brdnr >= STL_MAXBRDS)) | 4443 | if (stli_dummybrd.brdnr >= STL_MAXBRDS) |
4434 | return -ENODEV; | 4444 | return -ENODEV; |
4435 | brdp = stli_brds[stli_dummybrd.brdnr]; | 4445 | brdp = stli_brds[stli_dummybrd.brdnr]; |
4436 | if (!brdp) | 4446 | if (!brdp) |