aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-08-29 16:40:27 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-29 16:40:27 -0400
commitc1b054d03f5b31c33eaa0b267c629b118eaf3790 (patch)
tree9333907ca767be24fcb3667877242976c3e3c8dd /scripts/mod
parent559fb51ba7e66fe298b8355fabde1275b7def35f (diff)
parentbf4e70e54cf31dcca48d279c7f7e71328eebe749 (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c61
-rw-r--r--scripts/mod/modpost.c9
2 files changed, 68 insertions, 2 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 32197efe67ed..5180405c1a84 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -25,6 +25,8 @@ typedef Elf64_Addr kernel_ulong_t;
25#include <stdint.h> 25#include <stdint.h>
26#endif 26#endif
27 27
28#include <ctype.h>
29
28typedef uint32_t __u32; 30typedef uint32_t __u32;
29typedef uint16_t __u16; 31typedef uint16_t __u16;
30typedef unsigned char __u8; 32typedef unsigned char __u8;
@@ -287,6 +289,58 @@ static int do_pnp_card_entry(const char *filename,
287 return 1; 289 return 1;
288} 290}
289 291
292/* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */
293static int do_pcmcia_entry(const char *filename,
294 struct pcmcia_device_id *id, char *alias)
295{
296 unsigned int i;
297
298 id->manf_id = TO_NATIVE(id->manf_id);
299 id->card_id = TO_NATIVE(id->card_id);
300 id->func_id = TO_NATIVE(id->func_id);
301 id->function = TO_NATIVE(id->function);
302 id->device_no = TO_NATIVE(id->device_no);
303 for (i=0; i<4; i++) {
304 id->prod_id_hash[i] = TO_NATIVE(id->prod_id_hash[i]);
305 }
306
307 strcpy(alias, "pcmcia:");
308 ADD(alias, "m", id->match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID,
309 id->manf_id);
310 ADD(alias, "c", id->match_flags & PCMCIA_DEV_ID_MATCH_CARD_ID,
311 id->card_id);
312 ADD(alias, "f", id->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID,
313 id->func_id);
314 ADD(alias, "fn", id->match_flags & PCMCIA_DEV_ID_MATCH_FUNCTION,
315 id->function);
316 ADD(alias, "pfn", id->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO,
317 id->device_no);
318 ADD(alias, "pa", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1, id->prod_id_hash[0]);
319 ADD(alias, "pb", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2, id->prod_id_hash[1]);
320 ADD(alias, "pc", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, id->prod_id_hash[2]);
321 ADD(alias, "pd", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, id->prod_id_hash[3]);
322
323 return 1;
324}
325
326
327
328static int do_of_entry (const char *filename, struct of_device_id *of, char *alias)
329{
330 char *tmp;
331 sprintf (alias, "of:N%sT%sC%s",
332 of->name[0] ? of->name : "*",
333 of->type[0] ? of->type : "*",
334 of->compatible[0] ? of->compatible : "*");
335
336 /* Replace all whitespace with underscores */
337 for (tmp = alias; tmp && *tmp; tmp++)
338 if (isspace (*tmp))
339 *tmp = '_';
340
341 return 1;
342}
343
290/* Ignore any prefix, eg. v850 prepends _ */ 344/* Ignore any prefix, eg. v850 prepends _ */
291static inline int sym_is(const char *symbol, const char *name) 345static inline int sym_is(const char *symbol, const char *name)
292{ 346{
@@ -362,6 +416,13 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
362 else if (sym_is(symname, "__mod_pnp_card_device_table")) 416 else if (sym_is(symname, "__mod_pnp_card_device_table"))
363 do_table(symval, sym->st_size, sizeof(struct pnp_card_device_id), 417 do_table(symval, sym->st_size, sizeof(struct pnp_card_device_id),
364 do_pnp_card_entry, mod); 418 do_pnp_card_entry, mod);
419 else if (sym_is(symname, "__mod_pcmcia_device_table"))
420 do_table(symval, sym->st_size, sizeof(struct pcmcia_device_id),
421 do_pcmcia_entry, mod);
422 else if (sym_is(symname, "__mod_of_device_table"))
423 do_table(symval, sym->st_size, sizeof(struct of_device_id),
424 do_of_entry, mod);
425
365} 426}
366 427
367/* Now add out buffered information to the generated C source */ 428/* Now add out buffered information to the generated C source */
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 9b9f94c915d2..09ffca54b373 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -359,11 +359,16 @@ handle_modversions(struct module *mod, struct elf_info *info,
359 /* ignore __this_module, it will be resolved shortly */ 359 /* ignore __this_module, it will be resolved shortly */
360 if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0) 360 if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
361 break; 361 break;
362#ifdef STT_REGISTER 362/* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */
363#if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER)
364/* add compatibility with older glibc */
365#ifndef STT_SPARC_REGISTER
366#define STT_SPARC_REGISTER STT_REGISTER
367#endif
363 if (info->hdr->e_machine == EM_SPARC || 368 if (info->hdr->e_machine == EM_SPARC ||
364 info->hdr->e_machine == EM_SPARCV9) { 369 info->hdr->e_machine == EM_SPARCV9) {
365 /* Ignore register directives. */ 370 /* Ignore register directives. */
366 if (ELF_ST_TYPE(sym->st_info) == STT_REGISTER) 371 if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER)
367 break; 372 break;
368 } 373 }
369#endif 374#endif