aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/file2alias.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:49:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:49:58 -0400
commite80ab411e589e00550e2e6e5a6a02d59cc730357 (patch)
tree870225ff7b5b8d03e82a996963213a4bb9cce248 /scripts/mod/file2alias.c
parent529a41e36673b518c9e091f3a8d932b6b9e3c461 (diff)
parentee959b00c335d7780136c5abda37809191fe52c3 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (36 commits) SCSI: convert struct class_device to struct device DRM: remove unused dev_class IB: rename "dev" to "srp_dev" in srp_host structure IB: convert struct class_device to struct device memstick: convert struct class_device to struct device driver core: replace remaining __FUNCTION__ occurrences sysfs: refill attribute buffer when reading from offset 0 PM: Remove destroy_suspended_device() Firmware: add iSCSI iBFT Support PM: Remove legacy PM (fix) Kobject: Replace list_for_each() with list_for_each_entry(). SYSFS: Explicitly include required header file slab.h. Driver core: make device_is_registered() work for class devices PM: Convert wakeup flag accessors to inline functions PM: Make wakeup flags available whenever CONFIG_PM is set PM: Fix misuse of wakeup flag accessors in serial core Driver core: Call device_pm_add() after bus_add_device() in device_add() PM: Handle device registrations during suspend/resume block: send disk "change" event for rescan_partitions() sysdev: detect multiple driver registrations ... Fixed trivial conflict in include/linux/memory.h due to semaphore header file change (made irrelevant by the change to mutex).
Diffstat (limited to 'scripts/mod/file2alias.c')
-rw-r--r--scripts/mod/file2alias.c57
1 files changed, 44 insertions, 13 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 348d8687b7c9..769b69db89c1 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -328,19 +328,52 @@ static int do_pnp_entry(const char *filename,
328 return 1; 328 return 1;
329} 329}
330 330
331/* looks like: "pnp:cCdD..." */ 331/* looks like: "pnp:dD" for every device of the card */
332static int do_pnp_card_entry(const char *filename, 332static void do_pnp_card_entries(void *symval, unsigned long size,
333 struct pnp_card_device_id *id, char *alias) 333 struct module *mod)
334{ 334{
335 int i; 335 const unsigned long id_size = sizeof(struct pnp_card_device_id);
336 const unsigned int count = (size / id_size)-1;
337 const struct pnp_card_device_id *cards = symval;
338 unsigned int i;
336 339
337 sprintf(alias, "pnp:c%s", id->id); 340 device_id_check(mod->name, "pnp", size, id_size, symval);
338 for (i = 0; i < PNP_MAX_DEVICES; i++) { 341
339 if (! *id->devs[i].id) 342 for (i = 0; i < count; i++) {
340 break; 343 unsigned int j;
341 sprintf(alias + strlen(alias), "d%s", id->devs[i].id); 344 const struct pnp_card_device_id *card = &cards[i];
345
346 for (j = 0; j < PNP_MAX_DEVICES; j++) {
347 const char *id = (char *)card->devs[j].id;
348 int i2, j2;
349 int dup = 0;
350
351 if (!id[0])
352 break;
353
354 /* find duplicate, already added value */
355 for (i2 = 0; i2 < i && !dup; i2++) {
356 const struct pnp_card_device_id *card2 = &cards[i2];
357
358 for (j2 = 0; j2 < PNP_MAX_DEVICES; j2++) {
359 const char *id2 = (char *)card2->devs[j2].id;
360
361 if (!id2[0])
362 break;
363
364 if (!strcmp(id, id2)) {
365 dup = 1;
366 break;
367 }
368 }
369 }
370
371 /* add an individual alias for every device entry */
372 if (!dup)
373 buf_printf(&mod->dev_table_buf,
374 "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
375 }
342 } 376 }
343 return 1;
344} 377}
345 378
346/* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */ 379/* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */
@@ -634,9 +667,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
634 sizeof(struct pnp_device_id), "pnp", 667 sizeof(struct pnp_device_id), "pnp",
635 do_pnp_entry, mod); 668 do_pnp_entry, mod);
636 else if (sym_is(symname, "__mod_pnp_card_device_table")) 669 else if (sym_is(symname, "__mod_pnp_card_device_table"))
637 do_table(symval, sym->st_size, 670 do_pnp_card_entries(symval, sym->st_size, mod);
638 sizeof(struct pnp_card_device_id), "pnp_card",
639 do_pnp_card_entry, mod);
640 else if (sym_is(symname, "__mod_pcmcia_device_table")) 671 else if (sym_is(symname, "__mod_pcmcia_device_table"))
641 do_table(symval, sym->st_size, 672 do_table(symval, sym->st_size,
642 sizeof(struct pcmcia_device_id), "pcmcia", 673 sizeof(struct pcmcia_device_id), "pcmcia",