diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2006-12-08 05:39:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:59 -0500 |
commit | a3f8d9d5e1e00e5953d7727f0b8426224af2ca15 (patch) | |
tree | c2789913006d711325c345ce53a8878b501fac50 /drivers/char/istallion.c | |
parent | 845bead4c3f2a65d2c25f0cb2fe82444b9057cbc (diff) |
[PATCH] Char: istallion, remove the mess
- remove unneeded license text
- remove functions, that are implemented in kernel -- call them (strtoul,
min, tolower)
- do not cast NULL
- there is no static table, throw away code, which takes care of it --
find module param cards in that place instead.
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/istallion.c')
-rw-r--r-- | drivers/char/istallion.c | 206 |
1 files changed, 36 insertions, 170 deletions
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index ec4e8f121173..2f56bc7d147b 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -14,14 +14,6 @@ | |||
14 | * the Free Software Foundation; either version 2 of the License, or | 14 | * the Free Software Foundation; either version 2 of the License, or |
15 | * (at your option) any later version. | 15 | * (at your option) any later version. |
16 | * | 16 | * |
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | */ | 17 | */ |
26 | 18 | ||
27 | /*****************************************************************************/ | 19 | /*****************************************************************************/ |
@@ -41,6 +33,7 @@ | |||
41 | #include <linux/device.h> | 33 | #include <linux/device.h> |
42 | #include <linux/wait.h> | 34 | #include <linux/wait.h> |
43 | #include <linux/eisa.h> | 35 | #include <linux/eisa.h> |
36 | #include <linux/ctype.h> | ||
44 | 37 | ||
45 | #include <asm/io.h> | 38 | #include <asm/io.h> |
46 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
@@ -61,21 +54,10 @@ | |||
61 | #define BRD_BRUMBY4 2 | 54 | #define BRD_BRUMBY4 2 |
62 | #define BRD_ONBOARD2 3 | 55 | #define BRD_ONBOARD2 3 |
63 | #define BRD_ONBOARD 4 | 56 | #define BRD_ONBOARD 4 |
64 | #define BRD_BRUMBY8 5 | ||
65 | #define BRD_BRUMBY16 6 | ||
66 | #define BRD_ONBOARDE 7 | 57 | #define BRD_ONBOARDE 7 |
67 | #define BRD_ONBOARD32 9 | ||
68 | #define BRD_ONBOARD2_32 10 | ||
69 | #define BRD_ONBOARDRS 11 | ||
70 | #define BRD_EASYIO 20 | ||
71 | #define BRD_ECH 21 | ||
72 | #define BRD_ECHMC 22 | ||
73 | #define BRD_ECP 23 | 58 | #define BRD_ECP 23 |
74 | #define BRD_ECPE 24 | 59 | #define BRD_ECPE 24 |
75 | #define BRD_ECPMC 25 | 60 | #define BRD_ECPMC 25 |
76 | #define BRD_ECHPCI 26 | ||
77 | #define BRD_ECH64PCI 27 | ||
78 | #define BRD_EASYIOPCI 28 | ||
79 | #define BRD_ECPPCI 29 | 61 | #define BRD_ECPPCI 29 |
80 | 62 | ||
81 | #define BRD_BRUMBY BRD_BRUMBY4 | 63 | #define BRD_BRUMBY BRD_BRUMBY4 |
@@ -128,11 +110,7 @@ typedef struct { | |||
128 | int irqtype; | 110 | int irqtype; |
129 | } stlconf_t; | 111 | } stlconf_t; |
130 | 112 | ||
131 | static stlconf_t stli_brdconf[] = { | 113 | static int stli_nrbrds; |
132 | /*{ BRD_ECP, 0x2a0, 0, 0xcc000, 0, 0 },*/ | ||
133 | }; | ||
134 | |||
135 | static int stli_nrbrds = ARRAY_SIZE(stli_brdconf); | ||
136 | 114 | ||
137 | /* stli_lock must NOT be taken holding brd_lock */ | 115 | /* stli_lock must NOT be taken holding brd_lock */ |
138 | static spinlock_t stli_lock; /* TTY logic lock */ | 116 | static spinlock_t stli_lock; /* TTY logic lock */ |
@@ -257,18 +235,18 @@ static char *stli_brdnames[] = { | |||
257 | "Brumby", | 235 | "Brumby", |
258 | "Brumby", | 236 | "Brumby", |
259 | "ONboard-EI", | 237 | "ONboard-EI", |
260 | (char *) NULL, | 238 | NULL, |
261 | "ONboard", | 239 | "ONboard", |
262 | "ONboard-MC", | 240 | "ONboard-MC", |
263 | "ONboard-MC", | 241 | "ONboard-MC", |
264 | (char *) NULL, | 242 | NULL, |
265 | (char *) NULL, | 243 | NULL, |
266 | (char *) NULL, | 244 | NULL, |
267 | (char *) NULL, | 245 | NULL, |
268 | (char *) NULL, | 246 | NULL, |
269 | (char *) NULL, | 247 | NULL, |
270 | (char *) NULL, | 248 | NULL, |
271 | (char *) NULL, | 249 | NULL, |
272 | "EasyIO", | 250 | "EasyIO", |
273 | "EC8/32-AT", | 251 | "EC8/32-AT", |
274 | "EC8/32-MC", | 252 | "EC8/32-MC", |
@@ -402,9 +380,6 @@ static int stli_eisamempsize = ARRAY_SIZE(stli_eisamemprobeaddrs); | |||
402 | /* | 380 | /* |
403 | * Define the Stallion PCI vendor and device IDs. | 381 | * Define the Stallion PCI vendor and device IDs. |
404 | */ | 382 | */ |
405 | #ifndef PCI_VENDOR_ID_STALLION | ||
406 | #define PCI_VENDOR_ID_STALLION 0x124d | ||
407 | #endif | ||
408 | #ifndef PCI_DEVICE_ID_ECRA | 383 | #ifndef PCI_DEVICE_ID_ECRA |
409 | #define PCI_DEVICE_ID_ECRA 0x0004 | 384 | #define PCI_DEVICE_ID_ECRA 0x0004 |
410 | #endif | 385 | #endif |
@@ -616,17 +591,6 @@ static struct pci_driver stli_pcidriver; | |||
616 | /*****************************************************************************/ | 591 | /*****************************************************************************/ |
617 | 592 | ||
618 | /* | 593 | /* |
619 | * Define some handy local macros... | ||
620 | */ | ||
621 | #undef MIN | ||
622 | #define MIN(a,b) (((a) <= (b)) ? (a) : (b)) | ||
623 | |||
624 | #undef TOLOWER | ||
625 | #define TOLOWER(x) ((((x) >= 'A') && ((x) <= 'Z')) ? ((x) + 0x20) : (x)) | ||
626 | |||
627 | /*****************************************************************************/ | ||
628 | |||
629 | /* | ||
630 | * Prototype all functions in this driver! | 594 | * Prototype all functions in this driver! |
631 | */ | 595 | */ |
632 | 596 | ||
@@ -844,69 +808,6 @@ module_exit(istallion_module_exit); | |||
844 | /*****************************************************************************/ | 808 | /*****************************************************************************/ |
845 | 809 | ||
846 | /* | 810 | /* |
847 | * Check for any arguments passed in on the module load command line. | ||
848 | */ | ||
849 | |||
850 | static void stli_argbrds(void) | ||
851 | { | ||
852 | stlconf_t conf; | ||
853 | stlibrd_t *brdp; | ||
854 | int i; | ||
855 | |||
856 | for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) { | ||
857 | memset(&conf, 0, sizeof(conf)); | ||
858 | if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) | ||
859 | continue; | ||
860 | if ((brdp = stli_allocbrd()) == NULL) | ||
861 | continue; | ||
862 | stli_nrbrds = i + 1; | ||
863 | brdp->brdnr = i; | ||
864 | brdp->brdtype = conf.brdtype; | ||
865 | brdp->iobase = conf.ioaddr1; | ||
866 | brdp->memaddr = conf.memaddr; | ||
867 | stli_brdinit(brdp); | ||
868 | } | ||
869 | } | ||
870 | |||
871 | /*****************************************************************************/ | ||
872 | |||
873 | /* | ||
874 | * Convert an ascii string number into an unsigned long. | ||
875 | */ | ||
876 | |||
877 | static unsigned long stli_atol(char *str) | ||
878 | { | ||
879 | unsigned long val; | ||
880 | int base, c; | ||
881 | char *sp; | ||
882 | |||
883 | val = 0; | ||
884 | sp = str; | ||
885 | if ((*sp == '0') && (*(sp+1) == 'x')) { | ||
886 | base = 16; | ||
887 | sp += 2; | ||
888 | } else if (*sp == '0') { | ||
889 | base = 8; | ||
890 | sp++; | ||
891 | } else { | ||
892 | base = 10; | ||
893 | } | ||
894 | |||
895 | for (; (*sp != 0); sp++) { | ||
896 | c = (*sp > '9') ? (TOLOWER(*sp) - 'a' + 10) : (*sp - '0'); | ||
897 | if ((c < 0) || (c >= base)) { | ||
898 | printk("STALLION: invalid argument %s\n", str); | ||
899 | val = 0; | ||
900 | break; | ||
901 | } | ||
902 | val = (val * base) + c; | ||
903 | } | ||
904 | return(val); | ||
905 | } | ||
906 | |||
907 | /*****************************************************************************/ | ||
908 | |||
909 | /* | ||
910 | * Parse the supplied argument string, into the board conf struct. | 811 | * Parse the supplied argument string, into the board conf struct. |
911 | */ | 812 | */ |
912 | 813 | ||
@@ -919,7 +820,7 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) | |||
919 | return 0; | 820 | return 0; |
920 | 821 | ||
921 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) | 822 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) |
922 | *sp = TOLOWER(*sp); | 823 | *sp = tolower(*sp); |
923 | 824 | ||
924 | for (i = 0; i < ARRAY_SIZE(stli_brdstr); i++) { | 825 | for (i = 0; i < ARRAY_SIZE(stli_brdstr); i++) { |
925 | if (strcmp(stli_brdstr[i].name, argp[0]) == 0) | 826 | if (strcmp(stli_brdstr[i].name, argp[0]) == 0) |
@@ -932,9 +833,9 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) | |||
932 | 833 | ||
933 | confp->brdtype = stli_brdstr[i].type; | 834 | confp->brdtype = stli_brdstr[i].type; |
934 | if (argp[1] != NULL && *argp[1] != 0) | 835 | if (argp[1] != NULL && *argp[1] != 0) |
935 | confp->ioaddr1 = stli_atol(argp[1]); | 836 | confp->ioaddr1 = simple_strtoul(argp[1], NULL, 0); |
936 | if (argp[2] != NULL && *argp[2] != 0) | 837 | if (argp[2] != NULL && *argp[2] != 0) |
937 | confp->memaddr = stli_atol(argp[2]); | 838 | confp->memaddr = simple_strtoul(argp[2], NULL, 0); |
938 | return(1); | 839 | return(1); |
939 | } | 840 | } |
940 | 841 | ||
@@ -1451,12 +1352,12 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun | |||
1451 | stlen = len; | 1352 | stlen = len; |
1452 | } | 1353 | } |
1453 | 1354 | ||
1454 | len = MIN(len, count); | 1355 | len = min(len, (unsigned int)count); |
1455 | count = 0; | 1356 | count = 0; |
1456 | shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->txoffset); | 1357 | shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->txoffset); |
1457 | 1358 | ||
1458 | while (len > 0) { | 1359 | while (len > 0) { |
1459 | stlen = MIN(len, stlen); | 1360 | stlen = min(len, stlen); |
1460 | memcpy_toio(shbuf + head, chbuf, stlen); | 1361 | memcpy_toio(shbuf + head, chbuf, stlen); |
1461 | chbuf += stlen; | 1362 | chbuf += stlen; |
1462 | len -= stlen; | 1363 | len -= stlen; |
@@ -1570,13 +1471,13 @@ static void stli_flushchars(struct tty_struct *tty) | |||
1570 | stlen = len; | 1471 | stlen = len; |
1571 | } | 1472 | } |
1572 | 1473 | ||
1573 | len = MIN(len, cooksize); | 1474 | len = min(len, cooksize); |
1574 | count = 0; | 1475 | count = 0; |
1575 | shbuf = EBRDGETMEMPTR(brdp, portp->txoffset); | 1476 | shbuf = EBRDGETMEMPTR(brdp, portp->txoffset); |
1576 | buf = stli_txcookbuf; | 1477 | buf = stli_txcookbuf; |
1577 | 1478 | ||
1578 | while (len > 0) { | 1479 | while (len > 0) { |
1579 | stlen = MIN(len, stlen); | 1480 | stlen = min(len, stlen); |
1580 | memcpy_toio(shbuf + head, buf, stlen); | 1481 | memcpy_toio(shbuf + head, buf, stlen); |
1581 | buf += stlen; | 1482 | buf += stlen; |
1582 | len -= stlen; | 1483 | len -= stlen; |
@@ -2412,7 +2313,7 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) | |||
2412 | while (len > 0) { | 2313 | while (len > 0) { |
2413 | unsigned char *cptr; | 2314 | unsigned char *cptr; |
2414 | 2315 | ||
2415 | stlen = MIN(len, stlen); | 2316 | stlen = min(len, stlen); |
2416 | tty_prepare_flip_string(tty, &cptr, stlen); | 2317 | tty_prepare_flip_string(tty, &cptr, stlen); |
2417 | memcpy_fromio(cptr, shbuf + tail, stlen); | 2318 | memcpy_fromio(cptr, shbuf + tail, stlen); |
2418 | len -= stlen; | 2319 | len -= stlen; |
@@ -3394,7 +3295,6 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3394 | */ | 3295 | */ |
3395 | switch (brdp->brdtype) { | 3296 | switch (brdp->brdtype) { |
3396 | case BRD_ECP: | 3297 | case BRD_ECP: |
3397 | brdp->membase = (void *) brdp->memaddr; | ||
3398 | brdp->memsize = ECP_MEMSIZE; | 3298 | brdp->memsize = ECP_MEMSIZE; |
3399 | brdp->pagesize = ECP_ATPAGESIZE; | 3299 | brdp->pagesize = ECP_ATPAGESIZE; |
3400 | brdp->init = stli_ecpinit; | 3300 | brdp->init = stli_ecpinit; |
@@ -3408,7 +3308,6 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3408 | break; | 3308 | break; |
3409 | 3309 | ||
3410 | case BRD_ECPE: | 3310 | case BRD_ECPE: |
3411 | brdp->membase = (void *) brdp->memaddr; | ||
3412 | brdp->memsize = ECP_MEMSIZE; | 3311 | brdp->memsize = ECP_MEMSIZE; |
3413 | brdp->pagesize = ECP_EIPAGESIZE; | 3312 | brdp->pagesize = ECP_EIPAGESIZE; |
3414 | brdp->init = stli_ecpeiinit; | 3313 | brdp->init = stli_ecpeiinit; |
@@ -3422,7 +3321,6 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3422 | break; | 3321 | break; |
3423 | 3322 | ||
3424 | case BRD_ECPMC: | 3323 | case BRD_ECPMC: |
3425 | brdp->membase = (void *) brdp->memaddr; | ||
3426 | brdp->memsize = ECP_MEMSIZE; | 3324 | brdp->memsize = ECP_MEMSIZE; |
3427 | brdp->pagesize = ECP_MCPAGESIZE; | 3325 | brdp->pagesize = ECP_MCPAGESIZE; |
3428 | brdp->init = NULL; | 3326 | brdp->init = NULL; |
@@ -3436,7 +3334,6 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3436 | break; | 3334 | break; |
3437 | 3335 | ||
3438 | case BRD_ECPPCI: | 3336 | case BRD_ECPPCI: |
3439 | brdp->membase = (void *) brdp->memaddr; | ||
3440 | brdp->memsize = ECP_PCIMEMSIZE; | 3337 | brdp->memsize = ECP_PCIMEMSIZE; |
3441 | brdp->pagesize = ECP_PCIPAGESIZE; | 3338 | brdp->pagesize = ECP_PCIPAGESIZE; |
3442 | brdp->init = stli_ecppciinit; | 3339 | brdp->init = stli_ecppciinit; |
@@ -3543,10 +3440,7 @@ static int stli_initonb(stlibrd_t *brdp) | |||
3543 | */ | 3440 | */ |
3544 | switch (brdp->brdtype) { | 3441 | switch (brdp->brdtype) { |
3545 | case BRD_ONBOARD: | 3442 | case BRD_ONBOARD: |
3546 | case BRD_ONBOARD32: | ||
3547 | case BRD_ONBOARD2: | 3443 | case BRD_ONBOARD2: |
3548 | case BRD_ONBOARD2_32: | ||
3549 | case BRD_ONBOARDRS: | ||
3550 | brdp->memsize = ONB_MEMSIZE; | 3444 | brdp->memsize = ONB_MEMSIZE; |
3551 | brdp->pagesize = ONB_ATPAGESIZE; | 3445 | brdp->pagesize = ONB_ATPAGESIZE; |
3552 | brdp->init = stli_onbinit; | 3446 | brdp->init = stli_onbinit; |
@@ -3577,8 +3471,6 @@ static int stli_initonb(stlibrd_t *brdp) | |||
3577 | break; | 3471 | break; |
3578 | 3472 | ||
3579 | case BRD_BRUMBY4: | 3473 | case BRD_BRUMBY4: |
3580 | case BRD_BRUMBY8: | ||
3581 | case BRD_BRUMBY16: | ||
3582 | brdp->memsize = BBY_MEMSIZE; | 3474 | brdp->memsize = BBY_MEMSIZE; |
3583 | brdp->pagesize = BBY_PAGESIZE; | 3475 | brdp->pagesize = BBY_PAGESIZE; |
3584 | brdp->init = stli_bbyinit; | 3476 | brdp->init = stli_bbyinit; |
@@ -3795,22 +3687,10 @@ static int __devinit stli_brdinit(stlibrd_t *brdp) | |||
3795 | case BRD_ONBOARD: | 3687 | case BRD_ONBOARD: |
3796 | case BRD_ONBOARDE: | 3688 | case BRD_ONBOARDE: |
3797 | case BRD_ONBOARD2: | 3689 | case BRD_ONBOARD2: |
3798 | case BRD_ONBOARD32: | ||
3799 | case BRD_ONBOARD2_32: | ||
3800 | case BRD_ONBOARDRS: | ||
3801 | case BRD_BRUMBY4: | 3690 | case BRD_BRUMBY4: |
3802 | case BRD_BRUMBY8: | ||
3803 | case BRD_BRUMBY16: | ||
3804 | case BRD_STALLION: | 3691 | case BRD_STALLION: |
3805 | stli_initonb(brdp); | 3692 | stli_initonb(brdp); |
3806 | break; | 3693 | break; |
3807 | case BRD_EASYIO: | ||
3808 | case BRD_ECH: | ||
3809 | case BRD_ECHMC: | ||
3810 | case BRD_ECHPCI: | ||
3811 | printk(KERN_ERR "STALLION: %s board type not supported in " | ||
3812 | "this driver\n", stli_brdnames[brdp->brdtype]); | ||
3813 | return -ENODEV; | ||
3814 | default: | 3694 | default: |
3815 | printk(KERN_ERR "STALLION: board=%d is unknown board " | 3695 | printk(KERN_ERR "STALLION: board=%d is unknown board " |
3816 | "type=%d\n", brdp->brdnr, brdp->brdtype); | 3696 | "type=%d\n", brdp->brdnr, brdp->brdtype); |
@@ -4119,37 +3999,23 @@ static stlibrd_t *stli_allocbrd(void) | |||
4119 | static int stli_initbrds(void) | 3999 | static int stli_initbrds(void) |
4120 | { | 4000 | { |
4121 | stlibrd_t *brdp, *nxtbrdp; | 4001 | stlibrd_t *brdp, *nxtbrdp; |
4122 | stlconf_t *confp; | 4002 | stlconf_t conf; |
4123 | int i, j, retval; | 4003 | int i, j, retval; |
4124 | 4004 | ||
4125 | if (stli_nrbrds > STL_MAXBRDS) { | 4005 | for (stli_nrbrds = 0; stli_nrbrds < ARRAY_SIZE(stli_brdsp); |
4126 | printk(KERN_INFO "STALLION: too many boards in configuration " | 4006 | stli_nrbrds++) { |
4127 | "table, truncating to %d\n", STL_MAXBRDS); | 4007 | memset(&conf, 0, sizeof(conf)); |
4128 | stli_nrbrds = STL_MAXBRDS; | 4008 | if (stli_parsebrd(&conf, stli_brdsp[stli_nrbrds]) == 0) |
4129 | } | 4009 | continue; |
4130 | |||
4131 | /* | ||
4132 | * Firstly scan the list of static boards configured. Allocate | ||
4133 | * resources and initialize the boards as found. If this is a | ||
4134 | * module then let the module args override static configuration. | ||
4135 | */ | ||
4136 | for (i = 0; (i < stli_nrbrds); i++) { | ||
4137 | confp = &stli_brdconf[i]; | ||
4138 | stli_parsebrd(confp, stli_brdsp[i]); | ||
4139 | if ((brdp = stli_allocbrd()) == NULL) | 4010 | if ((brdp = stli_allocbrd()) == NULL) |
4140 | return -ENOMEM; | 4011 | continue; |
4141 | brdp->brdnr = i; | 4012 | brdp->brdnr = stli_nrbrds; |
4142 | brdp->brdtype = confp->brdtype; | 4013 | brdp->brdtype = conf.brdtype; |
4143 | brdp->iobase = confp->ioaddr1; | 4014 | brdp->iobase = conf.ioaddr1; |
4144 | brdp->memaddr = confp->memaddr; | 4015 | brdp->memaddr = conf.memaddr; |
4145 | stli_brdinit(brdp); | 4016 | stli_brdinit(brdp); |
4146 | } | 4017 | } |
4147 | 4018 | ||
4148 | /* | ||
4149 | * Static configuration table done, so now use dynamic methods to | ||
4150 | * see if any more boards should be configured. | ||
4151 | */ | ||
4152 | stli_argbrds(); | ||
4153 | if (STLI_EISAPROBE) | 4019 | if (STLI_EISAPROBE) |
4154 | stli_findeisabrds(); | 4020 | stli_findeisabrds(); |
4155 | 4021 | ||
@@ -4225,7 +4091,7 @@ static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, lof | |||
4225 | if (off >= brdp->memsize || off + count < off) | 4091 | if (off >= brdp->memsize || off + count < off) |
4226 | return 0; | 4092 | return 0; |
4227 | 4093 | ||
4228 | size = MIN(count, (brdp->memsize - off)); | 4094 | size = min(count, (size_t)(brdp->memsize - off)); |
4229 | 4095 | ||
4230 | /* | 4096 | /* |
4231 | * Copy the data a page at a time | 4097 | * Copy the data a page at a time |
@@ -4239,8 +4105,8 @@ static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, lof | |||
4239 | spin_lock_irqsave(&brd_lock, flags); | 4105 | spin_lock_irqsave(&brd_lock, flags); |
4240 | EBRDENABLE(brdp); | 4106 | EBRDENABLE(brdp); |
4241 | memptr = EBRDGETMEMPTR(brdp, off); | 4107 | memptr = EBRDGETMEMPTR(brdp, off); |
4242 | n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); | 4108 | n = min(size, (int)(brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); |
4243 | n = MIN(n, PAGE_SIZE); | 4109 | n = min(n, (int)PAGE_SIZE); |
4244 | memcpy_fromio(p, memptr, n); | 4110 | memcpy_fromio(p, memptr, n); |
4245 | EBRDDISABLE(brdp); | 4111 | EBRDDISABLE(brdp); |
4246 | spin_unlock_irqrestore(&brd_lock, flags); | 4112 | spin_unlock_irqrestore(&brd_lock, flags); |
@@ -4291,7 +4157,7 @@ static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t cou | |||
4291 | return 0; | 4157 | return 0; |
4292 | 4158 | ||
4293 | chbuf = (char __user *) buf; | 4159 | chbuf = (char __user *) buf; |
4294 | size = MIN(count, (brdp->memsize - off)); | 4160 | size = min(count, (size_t)(brdp->memsize - off)); |
4295 | 4161 | ||
4296 | /* | 4162 | /* |
4297 | * Copy the data a page at a time | 4163 | * Copy the data a page at a time |
@@ -4302,8 +4168,8 @@ static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t cou | |||
4302 | return -ENOMEM; | 4168 | return -ENOMEM; |
4303 | 4169 | ||
4304 | while (size > 0) { | 4170 | while (size > 0) { |
4305 | n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); | 4171 | n = min(size, (int)(brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); |
4306 | n = MIN(n, PAGE_SIZE); | 4172 | n = min(n, (int)PAGE_SIZE); |
4307 | if (copy_from_user(p, chbuf, n)) { | 4173 | if (copy_from_user(p, chbuf, n)) { |
4308 | if (count == 0) | 4174 | if (count == 0) |
4309 | count = -EFAULT; | 4175 | count = -EFAULT; |