aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-09-19 12:42:16 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-09-23 15:28:01 -0400
commit759bdc7af450404382e937c76722ae8736daef92 (patch)
tree6c605ba19762d0d0a0afd42f2b4f5d1da99ad90a /drivers/mmc
parentf9996aee36921e8f1d499de1b2ea380855cf6d97 (diff)
sdio: store vendor strings
Store vendor strings found in CISTPL_VERS_1 so that function drivers can access them. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/bus.c3
-rw-r--r--drivers/mmc/core/sdio_bus.c3
-rw-r--r--drivers/mmc/core/sdio_cis.c50
3 files changed, 55 insertions, 1 deletions
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 1cc11714916f..733ac95331c7 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -187,6 +187,9 @@ static void mmc_release_card(struct device *dev)
187 187
188 sdio_free_common_cis(card); 188 sdio_free_common_cis(card);
189 189
190 if (card->info)
191 kfree(card->info);
192
190 kfree(card); 193 kfree(card);
191} 194}
192 195
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 683d91740109..0713a8c71e54 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -211,6 +211,9 @@ static void sdio_release_func(struct device *dev)
211 211
212 sdio_free_func_cis(func); 212 sdio_free_func_cis(func);
213 213
214 if (func->info)
215 kfree(func->info);
216
214 kfree(func); 217 kfree(func);
215} 218}
216 219
diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c
index 1d03f12bbb38..d5e51b1c7b3f 100644
--- a/drivers/mmc/core/sdio_cis.c
+++ b/drivers/mmc/core/sdio_cis.c
@@ -23,6 +23,54 @@
23#include "sdio_cis.h" 23#include "sdio_cis.h"
24#include "sdio_ops.h" 24#include "sdio_ops.h"
25 25
26static int cistpl_vers_1(struct mmc_card *card, struct sdio_func *func,
27 const unsigned char *buf, unsigned size)
28{
29 unsigned i, nr_strings;
30 char **buffer, *string;
31
32 buf += 2;
33 size -= 2;
34
35 nr_strings = 0;
36 for (i = 0; i < size; i++) {
37 if (buf[i] == 0xff)
38 break;
39 if (buf[i] == 0)
40 nr_strings++;
41 }
42
43 if (buf[i-1] != '\0') {
44 printk(KERN_WARNING "SDIO: ignoring broken CISTPL_VERS_1\n");
45 return 0;
46 }
47
48 size = i;
49
50 buffer = kzalloc(sizeof(char*) * nr_strings + size, GFP_KERNEL);
51 if (!buffer)
52 return -ENOMEM;
53
54 string = (char*)(buffer + nr_strings);
55
56 for (i = 0; i < nr_strings; i++) {
57 buffer[i] = string;
58 strcpy(string, buf);
59 string += strlen(string) + 1;
60 buf += strlen(buf) + 1;
61 }
62
63 if (func) {
64 func->num_info = nr_strings;
65 func->info = (const char**)buffer;
66 } else {
67 card->num_info = nr_strings;
68 card->info = (const char**)buffer;
69 }
70
71 return 0;
72}
73
26static int cistpl_manfid(struct mmc_card *card, struct sdio_func *func, 74static int cistpl_manfid(struct mmc_card *card, struct sdio_func *func,
27 const unsigned char *buf, unsigned size) 75 const unsigned char *buf, unsigned size)
28{ 76{
@@ -119,7 +167,7 @@ struct cis_tpl {
119}; 167};
120 168
121static const struct cis_tpl cis_tpl_list[] = { 169static const struct cis_tpl cis_tpl_list[] = {
122 { 0x15, 3, /* cistpl_vers_1 */ }, 170 { 0x15, 3, cistpl_vers_1 },
123 { 0x20, 4, cistpl_manfid }, 171 { 0x20, 4, cistpl_manfid },
124 { 0x21, 2, /* cistpl_funcid */ }, 172 { 0x21, 2, /* cistpl_funcid */ },
125 { 0x22, 0, cistpl_funce }, 173 { 0x22, 0, cistpl_funce },