aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-28 11:26:12 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-28 11:26:12 -0400
commit7a9787e1eba95a166265e6a260cf30af04ef0a99 (patch)
treee730a4565e0318140d2fbd2f0415d18a339d7336 /scripts/mod
parent41b9eb264c8407655db57b60b4457fe1b2ec9977 (diff)
parent0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff)
Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c107
-rw-r--r--scripts/mod/mk_elfconfig.c2
-rw-r--r--scripts/mod/modpost.c20
3 files changed, 115 insertions, 14 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 37d5c363fbcd..d4dc222a74f3 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -206,6 +206,20 @@ static void do_usb_table(void *symval, unsigned long size,
206 do_usb_entry_multi(symval + i, mod); 206 do_usb_entry_multi(symval + i, mod);
207} 207}
208 208
209/* Looks like: hid:bNvNpN */
210static int do_hid_entry(const char *filename,
211 struct hid_device_id *id, char *alias)
212{
213 id->vendor = TO_NATIVE(id->vendor);
214 id->product = TO_NATIVE(id->product);
215
216 sprintf(alias, "hid:b%04X", id->bus);
217 ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor);
218 ADD(alias, "p", id->product != HID_ANY_ID, id->product);
219
220 return 1;
221}
222
209/* Looks like: ieee1394:venNmoNspNverN */ 223/* Looks like: ieee1394:venNmoNspNverN */
210static int do_ieee1394_entry(const char *filename, 224static int do_ieee1394_entry(const char *filename,
211 struct ieee1394_device_id *id, char *alias) 225 struct ieee1394_device_id *id, char *alias)
@@ -340,11 +354,24 @@ static int do_acpi_entry(const char *filename,
340} 354}
341 355
342/* looks like: "pnp:dD" */ 356/* looks like: "pnp:dD" */
343static int do_pnp_entry(const char *filename, 357static void do_pnp_device_entry(void *symval, unsigned long size,
344 struct pnp_device_id *id, char *alias) 358 struct module *mod)
345{ 359{
346 sprintf(alias, "pnp:d%s*", id->id); 360 const unsigned long id_size = sizeof(struct pnp_device_id);
347 return 1; 361 const unsigned int count = (size / id_size)-1;
362 const struct pnp_device_id *devs = symval;
363 unsigned int i;
364
365 device_id_check(mod->name, "pnp", size, id_size, symval);
366
367 for (i = 0; i < count; i++) {
368 const char *id = (char *)devs[i].id;
369
370 buf_printf(&mod->dev_table_buf,
371 "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
372 buf_printf(&mod->dev_table_buf,
373 "MODULE_ALIAS(\"acpi*:%s:*\");\n", id);
374 }
348} 375}
349 376
350/* looks like: "pnp:dD" for every device of the card */ 377/* looks like: "pnp:dD" for every device of the card */
@@ -388,9 +415,12 @@ static void do_pnp_card_entries(void *symval, unsigned long size,
388 } 415 }
389 416
390 /* add an individual alias for every device entry */ 417 /* add an individual alias for every device entry */
391 if (!dup) 418 if (!dup) {
392 buf_printf(&mod->dev_table_buf, 419 buf_printf(&mod->dev_table_buf,
393 "MODULE_ALIAS(\"pnp:d%s*\");\n", id); 420 "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
421 buf_printf(&mod->dev_table_buf,
422 "MODULE_ALIAS(\"acpi*:%s:*\");\n", id);
423 }
394 } 424 }
395 } 425 }
396} 426}
@@ -613,7 +643,60 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
613 return 1; 643 return 1;
614} 644}
615 645
616/* Ignore any prefix, eg. v850 prepends _ */ 646static const struct dmifield {
647 const char *prefix;
648 int field;
649} dmi_fields[] = {
650 { "bvn", DMI_BIOS_VENDOR },
651 { "bvr", DMI_BIOS_VERSION },
652 { "bd", DMI_BIOS_DATE },
653 { "svn", DMI_SYS_VENDOR },
654 { "pn", DMI_PRODUCT_NAME },
655 { "pvr", DMI_PRODUCT_VERSION },
656 { "rvn", DMI_BOARD_VENDOR },
657 { "rn", DMI_BOARD_NAME },
658 { "rvr", DMI_BOARD_VERSION },
659 { "cvn", DMI_CHASSIS_VENDOR },
660 { "ct", DMI_CHASSIS_TYPE },
661 { "cvr", DMI_CHASSIS_VERSION },
662 { NULL, DMI_NONE }
663};
664
665static void dmi_ascii_filter(char *d, const char *s)
666{
667 /* Filter out characters we don't want to see in the modalias string */
668 for (; *s; s++)
669 if (*s > ' ' && *s < 127 && *s != ':')
670 *(d++) = *s;
671
672 *d = 0;
673}
674
675
676static int do_dmi_entry(const char *filename, struct dmi_system_id *id,
677 char *alias)
678{
679 int i, j;
680
681 sprintf(alias, "dmi*");
682
683 for (i = 0; i < ARRAY_SIZE(dmi_fields); i++) {
684 for (j = 0; j < 4; j++) {
685 if (id->matches[j].slot &&
686 id->matches[j].slot == dmi_fields[i].field) {
687 sprintf(alias + strlen(alias), ":%s*",
688 dmi_fields[i].prefix);
689 dmi_ascii_filter(alias + strlen(alias),
690 id->matches[j].substr);
691 strcat(alias, "*");
692 }
693 }
694 }
695
696 strcat(alias, ":");
697 return 1;
698}
699/* Ignore any prefix, eg. some architectures prepend _ */
617static inline int sym_is(const char *symbol, const char *name) 700static inline int sym_is(const char *symbol, const char *name)
618{ 701{
619 const char *match; 702 const char *match;
@@ -676,6 +759,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
676 else if (sym_is(symname, "__mod_usb_device_table")) 759 else if (sym_is(symname, "__mod_usb_device_table"))
677 /* special case to handle bcdDevice ranges */ 760 /* special case to handle bcdDevice ranges */
678 do_usb_table(symval, sym->st_size, mod); 761 do_usb_table(symval, sym->st_size, mod);
762 else if (sym_is(symname, "__mod_hid_device_table"))
763 do_table(symval, sym->st_size,
764 sizeof(struct hid_device_id), "hid",
765 do_hid_entry, mod);
679 else if (sym_is(symname, "__mod_ieee1394_device_table")) 766 else if (sym_is(symname, "__mod_ieee1394_device_table"))
680 do_table(symval, sym->st_size, 767 do_table(symval, sym->st_size,
681 sizeof(struct ieee1394_device_id), "ieee1394", 768 sizeof(struct ieee1394_device_id), "ieee1394",
@@ -701,9 +788,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
701 sizeof(struct acpi_device_id), "acpi", 788 sizeof(struct acpi_device_id), "acpi",
702 do_acpi_entry, mod); 789 do_acpi_entry, mod);
703 else if (sym_is(symname, "__mod_pnp_device_table")) 790 else if (sym_is(symname, "__mod_pnp_device_table"))
704 do_table(symval, sym->st_size, 791 do_pnp_device_entry(symval, sym->st_size, mod);
705 sizeof(struct pnp_device_id), "pnp",
706 do_pnp_entry, mod);
707 else if (sym_is(symname, "__mod_pnp_card_device_table")) 792 else if (sym_is(symname, "__mod_pnp_card_device_table"))
708 do_pnp_card_entries(symval, sym->st_size, mod); 793 do_pnp_card_entries(symval, sym->st_size, mod);
709 else if (sym_is(symname, "__mod_pcmcia_device_table")) 794 else if (sym_is(symname, "__mod_pcmcia_device_table"))
@@ -746,6 +831,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
746 do_table(symval, sym->st_size, 831 do_table(symval, sym->st_size,
747 sizeof(struct i2c_device_id), "i2c", 832 sizeof(struct i2c_device_id), "i2c",
748 do_i2c_entry, mod); 833 do_i2c_entry, mod);
834 else if (sym_is(symname, "__mod_dmi_device_table"))
835 do_table(symval, sym->st_size,
836 sizeof(struct dmi_system_id), "dmi",
837 do_dmi_entry, mod);
749 free(zeros); 838 free(zeros);
750} 839}
751 840
diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c
index db3881f14c2d..6a96d47bd1e6 100644
--- a/scripts/mod/mk_elfconfig.c
+++ b/scripts/mod/mk_elfconfig.c
@@ -55,7 +55,7 @@ main(int argc, char **argv)
55 else 55 else
56 exit(1); 56 exit(1);
57 57
58 if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0) 58 if ((strcmp(argv[1], "h8300") == 0)
59 || (strcmp(argv[1], "blackfin") == 0)) 59 || (strcmp(argv[1], "blackfin") == 0))
60 printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); 60 printf("#define MODULE_SYMBOL_PREFIX \"_\"\n");
61 else 61 else
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index a07f91aac920..88921611b22e 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1468,7 +1468,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
1468 * marked __initdata will be discarded when the module has been intialized. 1468 * marked __initdata will be discarded when the module has been intialized.
1469 * Likewise for modules used built-in the sections marked __exit 1469 * Likewise for modules used built-in the sections marked __exit
1470 * are discarded because __exit marked function are supposed to be called 1470 * are discarded because __exit marked function are supposed to be called
1471 * only when a moduel is unloaded which never happes for built-in modules. 1471 * only when a module is unloaded which never happens for built-in modules.
1472 * The check_sec_ref() function traverses all relocation records 1472 * The check_sec_ref() function traverses all relocation records
1473 * to find all references to a section that reference a section that will 1473 * to find all references to a section that reference a section that will
1474 * be discarded and warns about it. 1474 * be discarded and warns about it.
@@ -1726,6 +1726,14 @@ static void add_header(struct buffer *b, struct module *mod)
1726 buf_printf(b, "};\n"); 1726 buf_printf(b, "};\n");
1727} 1727}
1728 1728
1729void add_staging_flag(struct buffer *b, const char *name)
1730{
1731 static const char *staging_dir = "drivers/staging";
1732
1733 if (strncmp(staging_dir, name, strlen(staging_dir)) == 0)
1734 buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
1735}
1736
1729/** 1737/**
1730 * Record CRCs for unresolved symbols 1738 * Record CRCs for unresolved symbols
1731 **/ 1739 **/
@@ -1986,13 +1994,16 @@ static void read_markers(const char *fname)
1986 1994
1987 mod = find_module(modname); 1995 mod = find_module(modname);
1988 if (!mod) { 1996 if (!mod) {
1989 if (is_vmlinux(modname))
1990 have_vmlinux = 1;
1991 mod = new_module(NOFAIL(strdup(modname))); 1997 mod = new_module(NOFAIL(strdup(modname)));
1992 mod->skip = 1; 1998 mod->skip = 1;
1993 } 1999 }
2000 if (is_vmlinux(modname)) {
2001 have_vmlinux = 1;
2002 mod->skip = 0;
2003 }
1994 2004
1995 add_marker(mod, marker, fmt); 2005 if (!mod->skip)
2006 add_marker(mod, marker, fmt);
1996 } 2007 }
1997 return; 2008 return;
1998fail: 2009fail:
@@ -2132,6 +2143,7 @@ int main(int argc, char **argv)
2132 buf.pos = 0; 2143 buf.pos = 0;
2133 2144
2134 add_header(&buf, mod); 2145 add_header(&buf, mod);
2146 add_staging_flag(&buf, mod->name);
2135 err |= add_versions(&buf, mod); 2147 err |= add_versions(&buf, mod);
2136 add_depends(&buf, mod, modules); 2148 add_depends(&buf, mod, modules);
2137 add_moddevtable(&buf, mod); 2149 add_moddevtable(&buf, mod);