Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91392
b: refs/heads/master
c: 0c81eed
h: refs/heads/master
v: v3
  • Loading branch information
Kay Sievers authored and Greg Kroah-Hartman committed Apr 20, 2008
1 parent 168191d commit 757b205
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 14 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: 4b65fc8cfbd1d1cfcc78865af72608e3b6cc9d9b
refs/heads/master: 0c81eed4b9d6273124c7ab5eb99760b4d3a3cb9e
57 changes: 44 additions & 13 deletions trunk/scripts/mod/file2alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,19 +328,52 @@ static int do_pnp_entry(const char *filename,
return 1;
}

/* looks like: "pnp:cCdD..." */
static int do_pnp_card_entry(const char *filename,
struct pnp_card_device_id *id, char *alias)
/* looks like: "pnp:dD" for every device of the card */
static void do_pnp_card_entries(void *symval, unsigned long size,
struct module *mod)
{
int i;
const unsigned long id_size = sizeof(struct pnp_card_device_id);
const unsigned int count = (size / id_size)-1;
const struct pnp_card_device_id *cards = symval;
unsigned int i;

sprintf(alias, "pnp:c%s", id->id);
for (i = 0; i < PNP_MAX_DEVICES; i++) {
if (! *id->devs[i].id)
break;
sprintf(alias + strlen(alias), "d%s", id->devs[i].id);
device_id_check(mod->name, "pnp", size, id_size, symval);

for (i = 0; i < count; i++) {
unsigned int j;
const struct pnp_card_device_id *card = &cards[i];

for (j = 0; j < PNP_MAX_DEVICES; j++) {
const char *id = (char *)card->devs[j].id;
int i2, j2;
int dup = 0;

if (!id[0])
break;

/* find duplicate, already added value */
for (i2 = 0; i2 < i && !dup; i2++) {
const struct pnp_card_device_id *card2 = &cards[i2];

for (j2 = 0; j2 < PNP_MAX_DEVICES; j2++) {
const char *id2 = (char *)card2->devs[j2].id;

if (!id2[0])
break;

if (!strcmp(id, id2)) {
dup = 1;
break;
}
}
}

/* add an individual alias for every device entry */
if (!dup)
buf_printf(&mod->dev_table_buf,
"MODULE_ALIAS(\"pnp:d%s*\");\n", id);
}
}
return 1;
}

/* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */
Expand Down Expand Up @@ -634,9 +667,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
sizeof(struct pnp_device_id), "pnp",
do_pnp_entry, mod);
else if (sym_is(symname, "__mod_pnp_card_device_table"))
do_table(symval, sym->st_size,
sizeof(struct pnp_card_device_id), "pnp_card",
do_pnp_card_entry, mod);
do_pnp_card_entries(symval, sym->st_size, mod);
else if (sym_is(symname, "__mod_pcmcia_device_table"))
do_table(symval, sym->st_size,
sizeof(struct pcmcia_device_id), "pcmcia",
Expand Down

0 comments on commit 757b205

Please sign in to comment.