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