diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2006-12-08 05:39:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:59 -0500 |
commit | 6b2c9457bb377bf843f0a3ca2f4eb2ef69c67985 (patch) | |
tree | 99934301b205c802d218ea26112f7f00ecbe3d85 /drivers/char | |
parent | c62429d93e003043109a0af86cb6bf1da45a1b71 (diff) |
[PATCH] Char: stallion, variables cleanup
- fix `gcc -W' un/signed warnings by converting some ints -> uints.
- move 3 global variables into functions, where are they used.
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/char')
-rw-r--r-- | drivers/char/stallion.c | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 2db2e9fbb5c6..97c7dc9c0cf0 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -63,7 +63,7 @@ | |||
63 | #define BRD_EASYIOPCI 28 | 63 | #define BRD_EASYIOPCI 28 |
64 | 64 | ||
65 | struct stlconf { | 65 | struct stlconf { |
66 | int brdtype; | 66 | unsigned int brdtype; |
67 | int ioaddr1; | 67 | int ioaddr1; |
68 | int ioaddr2; | 68 | int ioaddr2; |
69 | unsigned long memaddr; | 69 | unsigned long memaddr; |
@@ -121,15 +121,6 @@ static struct ktermios stl_deftermios = { | |||
121 | }; | 121 | }; |
122 | 122 | ||
123 | /* | 123 | /* |
124 | * Define global stats structures. Not used often, and can be | ||
125 | * re-used for each stats call. | ||
126 | */ | ||
127 | static comstats_t stl_comstats; | ||
128 | static combrd_t stl_brdstats; | ||
129 | static struct stlbrd stl_dummybrd; | ||
130 | static struct stlport stl_dummyport; | ||
131 | |||
132 | /* | ||
133 | * Define global place to put buffer overflow characters. | 124 | * Define global place to put buffer overflow characters. |
134 | */ | 125 | */ |
135 | static char stl_unwanted[SC26198_RXFIFOSIZE]; | 126 | static char stl_unwanted[SC26198_RXFIFOSIZE]; |
@@ -200,7 +191,7 @@ static char *stl_brdnames[] = { | |||
200 | * load line. These allow for easy board definitions, and easy | 191 | * load line. These allow for easy board definitions, and easy |
201 | * modification of the io, memory and irq resoucres. | 192 | * modification of the io, memory and irq resoucres. |
202 | */ | 193 | */ |
203 | static int stl_nargs = 0; | 194 | static unsigned int stl_nargs; |
204 | static char *board0[4]; | 195 | static char *board0[4]; |
205 | static char *board1[4]; | 196 | static char *board1[4]; |
206 | static char *board2[4]; | 197 | static char *board2[4]; |
@@ -632,7 +623,7 @@ static struct class *stallion_class; | |||
632 | static int __init stl_parsebrd(struct stlconf *confp, char **argp) | 623 | static int __init stl_parsebrd(struct stlconf *confp, char **argp) |
633 | { | 624 | { |
634 | char *sp; | 625 | char *sp; |
635 | int i; | 626 | unsigned int i; |
636 | 627 | ||
637 | pr_debug("stl_parsebrd(confp=%p,argp=%p)\n", confp, argp); | 628 | pr_debug("stl_parsebrd(confp=%p,argp=%p)\n", confp, argp); |
638 | 629 | ||
@@ -694,8 +685,8 @@ static int stl_open(struct tty_struct *tty, struct file *filp) | |||
694 | { | 685 | { |
695 | struct stlport *portp; | 686 | struct stlport *portp; |
696 | struct stlbrd *brdp; | 687 | struct stlbrd *brdp; |
697 | unsigned int minordev; | 688 | unsigned int minordev, brdnr, panelnr; |
698 | int brdnr, panelnr, portnr, rc; | 689 | int portnr, rc; |
699 | 690 | ||
700 | pr_debug("stl_open(tty=%p,filp=%p): device=%s\n", tty, filp, tty->name); | 691 | pr_debug("stl_open(tty=%p,filp=%p): device=%s\n", tty, filp, tty->name); |
701 | 692 | ||
@@ -1556,8 +1547,8 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof | |||
1556 | struct stlbrd *brdp; | 1547 | struct stlbrd *brdp; |
1557 | struct stlpanel *panelp; | 1548 | struct stlpanel *panelp; |
1558 | struct stlport *portp; | 1549 | struct stlport *portp; |
1559 | int brdnr, panelnr, portnr, totalport; | 1550 | unsigned int brdnr, panelnr, portnr; |
1560 | int curoff, maxoff; | 1551 | int totalport, curoff, maxoff; |
1561 | char *pos; | 1552 | char *pos; |
1562 | 1553 | ||
1563 | pr_debug("stl_readproc(page=%p,start=%p,off=%lx,count=%d,eof=%p," | 1554 | pr_debug("stl_readproc(page=%p,start=%p,off=%lx,count=%d,eof=%p," |
@@ -1675,8 +1666,7 @@ static int stl_eiointr(struct stlbrd *brdp) | |||
1675 | static int stl_echatintr(struct stlbrd *brdp) | 1666 | static int stl_echatintr(struct stlbrd *brdp) |
1676 | { | 1667 | { |
1677 | struct stlpanel *panelp; | 1668 | struct stlpanel *panelp; |
1678 | unsigned int ioaddr; | 1669 | unsigned int ioaddr, bnknr; |
1679 | int bnknr; | ||
1680 | int handled = 0; | 1670 | int handled = 0; |
1681 | 1671 | ||
1682 | outb((brdp->ioctrlval | ECH_BRDENABLE), brdp->ioctrl); | 1672 | outb((brdp->ioctrlval | ECH_BRDENABLE), brdp->ioctrl); |
@@ -1706,8 +1696,7 @@ static int stl_echatintr(struct stlbrd *brdp) | |||
1706 | static int stl_echmcaintr(struct stlbrd *brdp) | 1696 | static int stl_echmcaintr(struct stlbrd *brdp) |
1707 | { | 1697 | { |
1708 | struct stlpanel *panelp; | 1698 | struct stlpanel *panelp; |
1709 | unsigned int ioaddr; | 1699 | unsigned int ioaddr, bnknr; |
1710 | int bnknr; | ||
1711 | int handled = 0; | 1700 | int handled = 0; |
1712 | 1701 | ||
1713 | while (inb(brdp->iostatus) & ECH_INTRPEND) { | 1702 | while (inb(brdp->iostatus) & ECH_INTRPEND) { |
@@ -1732,8 +1721,7 @@ static int stl_echmcaintr(struct stlbrd *brdp) | |||
1732 | static int stl_echpciintr(struct stlbrd *brdp) | 1721 | static int stl_echpciintr(struct stlbrd *brdp) |
1733 | { | 1722 | { |
1734 | struct stlpanel *panelp; | 1723 | struct stlpanel *panelp; |
1735 | unsigned int ioaddr; | 1724 | unsigned int ioaddr, bnknr, recheck; |
1736 | int bnknr, recheck; | ||
1737 | int handled = 0; | 1725 | int handled = 0; |
1738 | 1726 | ||
1739 | while (1) { | 1727 | while (1) { |
@@ -1763,8 +1751,7 @@ static int stl_echpciintr(struct stlbrd *brdp) | |||
1763 | static int stl_echpci64intr(struct stlbrd *brdp) | 1751 | static int stl_echpci64intr(struct stlbrd *brdp) |
1764 | { | 1752 | { |
1765 | struct stlpanel *panelp; | 1753 | struct stlpanel *panelp; |
1766 | unsigned int ioaddr; | 1754 | unsigned int ioaddr, bnknr; |
1767 | int bnknr; | ||
1768 | int handled = 0; | 1755 | int handled = 0; |
1769 | 1756 | ||
1770 | while (inb(brdp->ioctrl) & 0x1) { | 1757 | while (inb(brdp->ioctrl) & 0x1) { |
@@ -1826,8 +1813,9 @@ static void stl_offintr(struct work_struct *work) | |||
1826 | 1813 | ||
1827 | static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp) | 1814 | static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp) |
1828 | { | 1815 | { |
1829 | struct stlport *portp; | 1816 | struct stlport *portp; |
1830 | int chipmask, i; | 1817 | unsigned int i; |
1818 | int chipmask; | ||
1831 | 1819 | ||
1832 | pr_debug("stl_initports(brdp=%p,panelp=%p)\n", brdp, panelp); | 1820 | pr_debug("stl_initports(brdp=%p,panelp=%p)\n", brdp, panelp); |
1833 | 1821 | ||
@@ -2052,8 +2040,8 @@ err: | |||
2052 | static int __devinit stl_initech(struct stlbrd *brdp) | 2040 | static int __devinit stl_initech(struct stlbrd *brdp) |
2053 | { | 2041 | { |
2054 | struct stlpanel *panelp; | 2042 | struct stlpanel *panelp; |
2055 | unsigned int status, nxtid, ioaddr, conflict; | 2043 | unsigned int status, nxtid, ioaddr, conflict, panelnr, banknr, i; |
2056 | int panelnr, banknr, i, retval; | 2044 | int retval; |
2057 | char *name; | 2045 | char *name; |
2058 | 2046 | ||
2059 | pr_debug("stl_initech(brdp=%p)\n", brdp); | 2047 | pr_debug("stl_initech(brdp=%p)\n", brdp); |
@@ -2337,7 +2325,7 @@ err: | |||
2337 | 2325 | ||
2338 | static int __devinit stl_getbrdnr(void) | 2326 | static int __devinit stl_getbrdnr(void) |
2339 | { | 2327 | { |
2340 | int i; | 2328 | unsigned int i; |
2341 | 2329 | ||
2342 | for (i = 0; i < STL_MAXBRDS; i++) | 2330 | for (i = 0; i < STL_MAXBRDS; i++) |
2343 | if (stl_brds[i] == NULL) { | 2331 | if (stl_brds[i] == NULL) { |
@@ -2361,7 +2349,7 @@ static int __devinit stl_pciprobe(struct pci_dev *pdev, | |||
2361 | { | 2349 | { |
2362 | struct stlbrd *brdp; | 2350 | struct stlbrd *brdp; |
2363 | unsigned int brdtype = ent->driver_data; | 2351 | unsigned int brdtype = ent->driver_data; |
2364 | int retval = -ENODEV; | 2352 | int brdnr, retval = -ENODEV; |
2365 | 2353 | ||
2366 | if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) | 2354 | if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) |
2367 | goto err; | 2355 | goto err; |
@@ -2378,13 +2366,14 @@ static int __devinit stl_pciprobe(struct pci_dev *pdev, | |||
2378 | goto err; | 2366 | goto err; |
2379 | } | 2367 | } |
2380 | mutex_lock(&stl_brdslock); | 2368 | mutex_lock(&stl_brdslock); |
2381 | brdp->brdnr = stl_getbrdnr(); | 2369 | brdnr = stl_getbrdnr(); |
2382 | if (brdp->brdnr < 0) { | 2370 | if (brdnr < 0) { |
2383 | dev_err(&pdev->dev, "too many boards found, " | 2371 | dev_err(&pdev->dev, "too many boards found, " |
2384 | "maximum supported %d\n", STL_MAXBRDS); | 2372 | "maximum supported %d\n", STL_MAXBRDS); |
2385 | mutex_unlock(&stl_brdslock); | 2373 | mutex_unlock(&stl_brdslock); |
2386 | goto err_fr; | 2374 | goto err_fr; |
2387 | } | 2375 | } |
2376 | brdp->brdnr = (unsigned int)brdnr; | ||
2388 | stl_brds[brdp->brdnr] = brdp; | 2377 | stl_brds[brdp->brdnr] = brdp; |
2389 | mutex_unlock(&stl_brdslock); | 2378 | mutex_unlock(&stl_brdslock); |
2390 | 2379 | ||
@@ -2460,9 +2449,10 @@ static struct pci_driver stl_pcidriver = { | |||
2460 | 2449 | ||
2461 | static int stl_getbrdstats(combrd_t __user *bp) | 2450 | static int stl_getbrdstats(combrd_t __user *bp) |
2462 | { | 2451 | { |
2452 | combrd_t stl_brdstats; | ||
2463 | struct stlbrd *brdp; | 2453 | struct stlbrd *brdp; |
2464 | struct stlpanel *panelp; | 2454 | struct stlpanel *panelp; |
2465 | int i; | 2455 | unsigned int i; |
2466 | 2456 | ||
2467 | if (copy_from_user(&stl_brdstats, bp, sizeof(combrd_t))) | 2457 | if (copy_from_user(&stl_brdstats, bp, sizeof(combrd_t))) |
2468 | return -EFAULT; | 2458 | return -EFAULT; |
@@ -2508,12 +2498,12 @@ static struct stlport *stl_getport(int brdnr, int panelnr, int portnr) | |||
2508 | brdp = stl_brds[brdnr]; | 2498 | brdp = stl_brds[brdnr]; |
2509 | if (brdp == NULL) | 2499 | if (brdp == NULL) |
2510 | return NULL; | 2500 | return NULL; |
2511 | if (panelnr < 0 || panelnr >= brdp->nrpanels) | 2501 | if (panelnr < 0 || (unsigned int)panelnr >= brdp->nrpanels) |
2512 | return NULL; | 2502 | return NULL; |
2513 | panelp = brdp->panels[panelnr]; | 2503 | panelp = brdp->panels[panelnr]; |
2514 | if (panelp == NULL) | 2504 | if (panelp == NULL) |
2515 | return NULL; | 2505 | return NULL; |
2516 | if (portnr < 0 || portnr >= panelp->nrports) | 2506 | if (portnr < 0 || (unsigned int)portnr >= panelp->nrports) |
2517 | return NULL; | 2507 | return NULL; |
2518 | return panelp->ports[portnr]; | 2508 | return panelp->ports[portnr]; |
2519 | } | 2509 | } |
@@ -2528,6 +2518,7 @@ static struct stlport *stl_getport(int brdnr, int panelnr, int portnr) | |||
2528 | 2518 | ||
2529 | static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) | 2519 | static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) |
2530 | { | 2520 | { |
2521 | comstats_t stl_comstats; | ||
2531 | unsigned char *head, *tail; | 2522 | unsigned char *head, *tail; |
2532 | unsigned long flags; | 2523 | unsigned long flags; |
2533 | 2524 | ||
@@ -2585,6 +2576,8 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) | |||
2585 | 2576 | ||
2586 | static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp) | 2577 | static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp) |
2587 | { | 2578 | { |
2579 | comstats_t stl_comstats; | ||
2580 | |||
2588 | if (!portp) { | 2581 | if (!portp) { |
2589 | if (copy_from_user(&stl_comstats, cp, sizeof(comstats_t))) | 2582 | if (copy_from_user(&stl_comstats, cp, sizeof(comstats_t))) |
2590 | return -EFAULT; | 2583 | return -EFAULT; |
@@ -2610,6 +2603,7 @@ static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp) | |||
2610 | 2603 | ||
2611 | static int stl_getportstruct(struct stlport __user *arg) | 2604 | static int stl_getportstruct(struct stlport __user *arg) |
2612 | { | 2605 | { |
2606 | struct stlport stl_dummyport; | ||
2613 | struct stlport *portp; | 2607 | struct stlport *portp; |
2614 | 2608 | ||
2615 | if (copy_from_user(&stl_dummyport, arg, sizeof(struct stlport))) | 2609 | if (copy_from_user(&stl_dummyport, arg, sizeof(struct stlport))) |
@@ -2629,11 +2623,12 @@ static int stl_getportstruct(struct stlport __user *arg) | |||
2629 | 2623 | ||
2630 | static int stl_getbrdstruct(struct stlbrd __user *arg) | 2624 | static int stl_getbrdstruct(struct stlbrd __user *arg) |
2631 | { | 2625 | { |
2626 | struct stlbrd stl_dummybrd; | ||
2632 | struct stlbrd *brdp; | 2627 | struct stlbrd *brdp; |
2633 | 2628 | ||
2634 | if (copy_from_user(&stl_dummybrd, arg, sizeof(struct stlbrd))) | 2629 | if (copy_from_user(&stl_dummybrd, arg, sizeof(struct stlbrd))) |
2635 | return -EFAULT; | 2630 | return -EFAULT; |
2636 | if ((stl_dummybrd.brdnr < 0) || (stl_dummybrd.brdnr >= STL_MAXBRDS)) | 2631 | if (stl_dummybrd.brdnr >= STL_MAXBRDS) |
2637 | return -ENODEV; | 2632 | return -ENODEV; |
2638 | brdp = stl_brds[stl_dummybrd.brdnr]; | 2633 | brdp = stl_brds[stl_dummybrd.brdnr]; |
2639 | if (!brdp) | 2634 | if (!brdp) |