make broadcom-wl robust against implicit kernel config changes (e.g. netfilter),...
[openwrt.git] / package / pcmcia-cs / patches / 003-cardmgr_c.patch
1 Index: pcmcia-cs-3.2.8/cardmgr/cardmgr.c
2 ===================================================================
3 --- pcmcia-cs-3.2.8.orig/cardmgr/cardmgr.c      2007-06-04 13:23:59.491689784 +0200
4 +++ pcmcia-cs-3.2.8/cardmgr/cardmgr.c   2007-06-04 13:24:00.561527144 +0200
5 @@ -739,10 +739,7 @@
6      int ret;
7  
8      strcpy(cmd, "insmod ");
9 -    if (strchr(mod, '/') != NULL)
10 -       sprintf(cmd+7, "%s/%s.o", modpath, mod);
11 -    else
12 -       sprintf(cmd+7, "%s/pcmcia/%s.o", modpath, mod);
13 +    sprintf(cmd+7, "%s/%s.o", modpath, mod);
14      if (access(cmd+7, R_OK) != 0) {
15         syslog(LOG_NOTICE, "module %s not available", cmd+7);
16         free(cmd);
17 @@ -808,11 +805,13 @@
18      }
19  
20      if (do_modprobe) {
21 -       if (try_modprobe(mod, opts) != 0)
22 +       if (try_modprobe(mod, opts) != 0) {
23             try_insmod(mod, opts);
24 +       }
25      } else {
26 -       if (try_insmod(mod, opts) != 0)
27 +       if (try_insmod(mod, opts) != 0) {
28             try_modprobe(mod, opts);
29 +       }
30      }
31  }
32  
33 @@ -1113,8 +1112,9 @@
34  
35      /* remove kernel modules in inverse order */
36      for (i = 0; i < card->bindings; i++) {
37 -       for (j = dev[i]->modules-1; j >= 0; j--)
38 +       for (j = dev[i]->modules-1; j >= 0; j--) {
39             remove_module(dev[i]->module[j]);
40 +       }
41         free_device(dev[i]);
42      }
43      /* Remove any MTD's bound to this socket */