Subject: kern/18434: wi.c can't compile on hpcmips (maybe all mips ports)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <naoki@fukaumi.org>
List: netbsd-bugs
Date: 09/27/2002 18:13:39
>Number: 18434
>Category: kern
>Synopsis: wi.c can't compile on hpcmips (maybe all mips ports)
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Sep 27 02:15:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: FUKAUMI Naoki
>Release: NetBSD 1.6I (2002/9/26 source)
>Organization:
FUKAUMI Naoki
>Environment:
NetBSD 1.6I
>Description:
When I compiled hpcmips kernel, I got error:
/home/t/hpcmips/bin/mipsel--netbsd-gcc -mips2 -EL -G 10 -mno-abicalls -mno-half-pic -ffreestanding -Os -mmemcpy -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wno-uninitialized -Dhpcmips -I. -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DSOFTFLOAT -DMIPS3 -DMIPS3_4100 -DMIPS1 -DENABLE_MIPS_TX3900 -DKSEG2IOBUFSIZE="0x8000000" -DTX392X -DMSGBUFSIZE="0x2000" -DLKM -DMAXUSERS=16 -D_KERNEL -D_KERNEL_OPT -c /usr/src/sys/dev/ic/wi.c
/usr/src/sys/dev/ic/wi.c: In function `wi_cmd':
/usr/src/sys/dev/ic/wi.c:1410: parse error before `{'
/usr/src/sys/dev/ic/wi.c:1410: `N' undeclared (first use in this function)
/usr/src/sys/dev/ic/wi.c:1410: (Each undeclared identifier is reported only once
/usr/src/sys/dev/ic/wi.c:1410: for each function it appears in.)
cc1: warnings being treated as errors
/usr/src/sys/dev/ic/wi.c:1407: warning: unused variable `s'
/usr/src/sys/dev/ic/wi.c:1410: warning: control reaches end of non-void function
/usr/src/sys/dev/ic/wi.c: At top level:
/usr/src/sys/dev/ic/wi.c:1410: parse error before `)'
/usr/src/sys/dev/ic/wi.c:1421: parse error before `bus_space_tag_t'
/usr/src/sys/dev/ic/wi.c:1422: parse error before `bus_space_tag_t'
/usr/src/sys/dev/ic/wi.c:1423: parse error before `bus_space_tag_t'
/usr/src/sys/dev/ic/wi.c:1424: parse error before `bus_space_tag_t'
/usr/src/sys/dev/ic/wi.c:1438: parse error before `bus_space_tag_t'
/usr/src/sys/dev/ic/wi.c: In function `wi_reset':
/usr/src/sys/dev/ic/wi.c:1471: parse error before `{'
/usr/src/sys/dev/ic/wi.c:1471: `N' undeclared (first use in this function)
/usr/src/sys/dev/ic/wi.c: At top level:
/usr/src/sys/dev/ic/wi.c:1471: parse error before `)'
/usr/src/sys/dev/ic/wi.c:1481: parse error before `bus_space_tag_t'
/usr/src/sys/dev/ic/wi.c:1482: parse error before `bus_space_tag_t'
/usr/src/sys/dev/ic/wi.c:1485: parse error before `&'
/usr/src/sys/dev/ic/wi.c:1485: warning: type defaults to `int' in declaration of `wi_write_record'
/usr/src/sys/dev/ic/wi.c:1485: warning: function declaration isn't a prototype
/usr/src/sys/dev/ic/wi.c:1485: warning: data definition has no type or storage class
/usr/src/sys/dev/ic/wi.c: In function `wi_seek':
/usr/src/sys/dev/ic/wi.c:1761: parse error before `{'
/usr/src/sys/dev/ic/wi.c:1761: `N' undeclared (first use in this function)
/usr/src/sys/dev/ic/wi.c:1726: warning: unused variable `status'
/usr/src/sys/dev/ic/wi.c:1761: warning: control reaches end of non-void function
/usr/src/sys/dev/ic/wi.c: At top level:
/usr/src/sys/dev/ic/wi.c:1761: parse error before `)'
/usr/src/sys/dev/ic/wi.c: In function `wi_alloc_nicmem':
/usr/src/sys/dev/ic/wi.c:1889: parse error before `{'
/usr/src/sys/dev/ic/wi.c:1889: `N' undeclared (first use in this function)
/usr/src/sys/dev/ic/wi.c:1889: warning: control reaches end of non-void function
/usr/src/sys/dev/ic/wi.c: At top level:
/usr/src/sys/dev/ic/wi.c:1889: parse error before `)'
/usr/src/sys/dev/ic/wi.c:1899: warning: type defaults to `int' in declaration of `id'
/usr/src/sys/dev/ic/wi.c:1899: `sc' undeclared here (not in a function)
/usr/src/sys/dev/ic/wi.c:1899: `sc' undeclared here (not in a function)
/usr/src/sys/dev/ic/wi.c:1899: `sc' undeclared here (not in a function)
/usr/src/sys/dev/ic/wi.c:1899: `sc' undeclared here (not in a function)
/usr/src/sys/dev/ic/wi.c:1899: warning: data definition has no type or storage class
/usr/src/sys/dev/ic/wi.c:1900: parse error before `bus_space_tag_t'
*** Error code 1
Stop.
nbmake: stopped in /usr/obj/hpcmips/sys/arch/hpcmips/compile/GENERIC
>How-To-Repeat:
Compile recent hpcmips kernel.
>Fix:
DELAY() on mips ports are different to another ports.
See sys/arch/*/include/param.h.
wi.c after rev. 1.84 uses "for (;; DELAY())" style code.
Is it wrong? I don't know. But I changed this style, I can
compile wi.c without errors.
This is diffs, please review it :)
--- wi.c.orig Fri Sep 27 10:52:24 2002
+++ wi.c Fri Sep 27 17:30:52 2002
@@ -1407,9 +1407,10 @@
int i, s = 0;
/* Wait 100us for the busy bit to clear. */
- for (i = 10; i--; DELAY(10)) {
+ for (i = 10; i > 0; i--) {
if (!(CSR_READ_2(sc, WI_COMMAND) & WI_CMD_BUSY))
break;
+ DELAY(10);
}
if (i < 0) {
@@ -1426,7 +1427,7 @@
/* wait .4 second for the command to complete. study the
* distribution of times.
*/
- for (i = 2000; i--; DELAY(200)) {
+ for (i = 2000; i > 0; i--) {
/*
* Wait for 'command complete' bit to be
* set in the event status register.
@@ -1444,6 +1445,7 @@
return(EIO);
break;
}
+ DELAY(200);
}
if (i < 0) {
@@ -1468,9 +1470,10 @@
bzero(&sc->wi_current_bssid, sizeof(sc->wi_current_bssid));
bzero(&sc->wi_stats, sizeof(sc->wi_stats));
- for (i = 5; i--; DELAY(5 * 1000)) {
+ for (i = 5; i > 0; i--) {
if (wi_cmd(sc, WI_CMD_INI, 0, 0, 0) == 0)
break;
+ DELAY(5 * 1000);
}
if (i < 0)
@@ -1758,9 +1761,11 @@
CSR_WRITE_2(sc, selreg, id);
CSR_WRITE_2(sc, offreg, off);
- for (i = WI_TIMEOUT; i--; DELAY(10))
+ for (i = WI_TIMEOUT; i > 0; i--) {
if (!(CSR_READ_2(sc, offreg) & (WI_OFF_BUSY|WI_OFF_ERR)))
break;
+ DELAY(10);
+ }
if (i < 0) {
printf("%s: timeout in wi_seek to %x/%x; last status %x\n",
@@ -1886,9 +1891,10 @@
return(ENOMEM);
}
- for (i = WI_TIMEOUT; i--; DELAY(10)) {
+ for (i = WI_TIMEOUT; i > 0; i--) {
if (CSR_READ_2(sc, WI_EVENT_STAT) & WI_EV_ALLOC)
break;
+ DELAY(10);
}
if (i < 0) {
>Release-Note:
>Audit-Trail:
>Unformatted: