100-fix_nvram_two_devices.patch 667 B

1234567891011121314151617181920212223242526272829303132
  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. static vars_t *vars = NULL;
  6. +static int nvram_init_done = 0;
  7. extern char *nvram_buf[];
  8. int
  9. @@ -33,6 +34,10 @@ BCMATTACHFN(nvram_init)(void *si)
  10. uint nvs, bufsz;
  11. vars_t *new;
  12. + nvram_init_done++;
  13. + if (nvram_init_done != 1)
  14. + return 0;
  15. +
  16. osh = si_osh(sih);
  17. nvs = R_REG(osh, &nvh->len) - sizeof(struct nvram_header);
  18. @@ -79,6 +84,10 @@ BCMATTACHFN(nvram_exit)(void *si)
  19. vars_t *this, *next;
  20. si_t *sih;
  21. + nvram_init_done--;
  22. + if (nvram_init_done != 0)
  23. + return;
  24. +
  25. sih = (si_t *)si;
  26. this = vars;
  27. while (this) {