packages: clean up the package folder
[openwrt/staging/yousong.git] / package / kernel / broadcom-wl / patches / 100-fix_nvram_two_devices.patch
1 --- a/driver/nvram_stub.c
2 +++ b/driver/nvram_stub.c
3 @@ -22,6 +22,7 @@ typedef struct _vars {
4 #define VARS_T_OH sizeof(vars_t)
5
6 static vars_t *vars = NULL;
7 +static int nvram_init_done = 0;
8 extern char *nvram_buf[];
9
10 int
11 @@ -33,6 +34,10 @@ BCMATTACHFN(nvram_init)(void *si)
12 uint nvs, bufsz;
13 vars_t *new;
14
15 + nvram_init_done++;
16 + if (nvram_init_done != 1)
17 + return 0;
18 +
19 osh = si_osh(sih);
20
21 nvs = R_REG(osh, &nvh->len) - sizeof(struct nvram_header);
22 @@ -79,6 +84,10 @@ BCMATTACHFN(nvram_exit)(void *si)
23 vars_t *this, *next;
24 si_t *sih;
25
26 + nvram_init_done--;
27 + if (nvram_init_done != 0)
28 + return 0;
29 +
30 sih = (si_t *)si;
31 this = vars;
32 while (this) {