Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 65637
b: refs/heads/master
c: 759bdc7
h: refs/heads/master
i:
  65635: 4d3b916
v: v3
  • Loading branch information
Pierre Ossman committed Sep 23, 2007
1 parent d247f0b commit 0e2a455
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f9996aee36921e8f1d499de1b2ea380855cf6d97
refs/heads/master: 759bdc7af450404382e937c76722ae8736daef92
3 changes: 3 additions & 0 deletions trunk/drivers/mmc/core/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ static void mmc_release_card(struct device *dev)

sdio_free_common_cis(card);

if (card->info)
kfree(card->info);

kfree(card);
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/mmc/core/sdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ static void sdio_release_func(struct device *dev)

sdio_free_func_cis(func);

if (func->info)
kfree(func->info);

kfree(func);
}

Expand Down
50 changes: 49 additions & 1 deletion trunk/drivers/mmc/core/sdio_cis.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,54 @@
#include "sdio_cis.h"
#include "sdio_ops.h"

static int cistpl_vers_1(struct mmc_card *card, struct sdio_func *func,
const unsigned char *buf, unsigned size)
{
unsigned i, nr_strings;
char **buffer, *string;

buf += 2;
size -= 2;

nr_strings = 0;
for (i = 0; i < size; i++) {
if (buf[i] == 0xff)
break;
if (buf[i] == 0)
nr_strings++;
}

if (buf[i-1] != '\0') {
printk(KERN_WARNING "SDIO: ignoring broken CISTPL_VERS_1\n");
return 0;
}

size = i;

buffer = kzalloc(sizeof(char*) * nr_strings + size, GFP_KERNEL);
if (!buffer)
return -ENOMEM;

string = (char*)(buffer + nr_strings);

for (i = 0; i < nr_strings; i++) {
buffer[i] = string;
strcpy(string, buf);
string += strlen(string) + 1;
buf += strlen(buf) + 1;
}

if (func) {
func->num_info = nr_strings;
func->info = (const char**)buffer;
} else {
card->num_info = nr_strings;
card->info = (const char**)buffer;
}

return 0;
}

static int cistpl_manfid(struct mmc_card *card, struct sdio_func *func,
const unsigned char *buf, unsigned size)
{
Expand Down Expand Up @@ -119,7 +167,7 @@ struct cis_tpl {
};

static const struct cis_tpl cis_tpl_list[] = {
{ 0x15, 3, /* cistpl_vers_1 */ },
{ 0x15, 3, cistpl_vers_1 },
{ 0x20, 4, cistpl_manfid },
{ 0x21, 2, /* cistpl_funcid */ },
{ 0x22, 0, cistpl_funce },
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/mmc/card.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ struct mmc_card {
struct sdio_cccr cccr; /* common card info */
struct sdio_cis cis; /* common tuple info */
struct sdio_func *sdio_func[SDIO_MAX_FUNCS]; /* SDIO functions (devices) */
unsigned num_info; /* number of info strings */
const char **info; /* info strings */
struct sdio_func_tuple *tuples; /* unknown common tuples */
};

Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/mmc/sdio_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ struct sdio_func {

u8 tmpbuf[4]; /* DMA:able scratch buffer */

unsigned num_info; /* number of info strings */
const char **info; /* info strings */

struct sdio_func_tuple *tuples;
};

Expand Down

0 comments on commit 0e2a455

Please sign in to comment.