aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2006-01-24 15:34:47 -0500
committerDave Kleikamp <shaggy@austin.ibm.com>2006-01-24 15:34:47 -0500
commit0a0fc0ddbe732779366ab6b1b879f62195e65967 (patch)
tree7b42490a676cf39ae0691b6859ecf7fd410f229b /scripts/mod
parent4d5dbd0945d9e0833dd7964a3d6ee33157f7cc7a (diff)
parent3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff)
Merge with /home/shaggy/git/linus-clean/
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c62
-rw-r--r--scripts/mod/modpost.c7
2 files changed, 64 insertions, 5 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index e3d144a3f10b..be97caf664bb 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -16,8 +16,10 @@
16 * use either stdint.h or inttypes.h for the rest. */ 16 * use either stdint.h or inttypes.h for the rest. */
17#if KERNEL_ELFCLASS == ELFCLASS32 17#if KERNEL_ELFCLASS == ELFCLASS32
18typedef Elf32_Addr kernel_ulong_t; 18typedef Elf32_Addr kernel_ulong_t;
19#define BITS_PER_LONG 32
19#else 20#else
20typedef Elf64_Addr kernel_ulong_t; 21typedef Elf64_Addr kernel_ulong_t;
22#define BITS_PER_LONG 64
21#endif 23#endif
22#ifdef __sun__ 24#ifdef __sun__
23#include <inttypes.h> 25#include <inttypes.h>
@@ -35,6 +37,7 @@ typedef unsigned char __u8;
35 * even potentially has different endianness and word sizes, since 37 * even potentially has different endianness and word sizes, since
36 * we handle those differences explicitly below */ 38 * we handle those differences explicitly below */
37#include "../../include/linux/mod_devicetable.h" 39#include "../../include/linux/mod_devicetable.h"
40#include "../../include/linux/input.h"
38 41
39#define ADD(str, sep, cond, field) \ 42#define ADD(str, sep, cond, field) \
40do { \ 43do { \
@@ -366,6 +369,61 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *i2c, char *a
366 return 1; 369 return 1;
367} 370}
368 371
372#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
373
374static void do_input(char *alias,
375 kernel_ulong_t *arr, unsigned int min, unsigned int max)
376{
377 unsigned int i;
378 for (i = min; i < max; i++) {
379 if (arr[i/BITS_PER_LONG] & (1 << (i%BITS_PER_LONG)))
380 sprintf(alias+strlen(alias), "%X,*", i);
381 }
382}
383
384/* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */
385static int do_input_entry(const char *filename, struct input_device_id *id,
386 char *alias)
387{
388 sprintf(alias, "input:");
389
390 ADD(alias, "b", id->flags&INPUT_DEVICE_ID_MATCH_BUS, id->id.bustype);
391 ADD(alias, "v", id->flags&INPUT_DEVICE_ID_MATCH_VENDOR, id->id.vendor);
392 ADD(alias, "p", id->flags&INPUT_DEVICE_ID_MATCH_PRODUCT,
393 id->id.product);
394 ADD(alias, "e", id->flags&INPUT_DEVICE_ID_MATCH_VERSION,
395 id->id.version);
396
397 sprintf(alias + strlen(alias), "-e*");
398 if (id->flags&INPUT_DEVICE_ID_MATCH_EVBIT)
399 do_input(alias, id->evbit, 0, EV_MAX);
400 sprintf(alias + strlen(alias), "k*");
401 if (id->flags&INPUT_DEVICE_ID_MATCH_KEYBIT)
402 do_input(alias, id->keybit, KEY_MIN_INTERESTING, KEY_MAX);
403 sprintf(alias + strlen(alias), "r*");
404 if (id->flags&INPUT_DEVICE_ID_MATCH_RELBIT)
405 do_input(alias, id->relbit, 0, REL_MAX);
406 sprintf(alias + strlen(alias), "a*");
407 if (id->flags&INPUT_DEVICE_ID_MATCH_ABSBIT)
408 do_input(alias, id->absbit, 0, ABS_MAX);
409 sprintf(alias + strlen(alias), "m*");
410 if (id->flags&INPUT_DEVICE_ID_MATCH_MSCIT)
411 do_input(alias, id->mscbit, 0, MSC_MAX);
412 sprintf(alias + strlen(alias), "l*");
413 if (id->flags&INPUT_DEVICE_ID_MATCH_LEDBIT)
414 do_input(alias, id->ledbit, 0, LED_MAX);
415 sprintf(alias + strlen(alias), "s*");
416 if (id->flags&INPUT_DEVICE_ID_MATCH_SNDBIT)
417 do_input(alias, id->sndbit, 0, SND_MAX);
418 sprintf(alias + strlen(alias), "f*");
419 if (id->flags&INPUT_DEVICE_ID_MATCH_FFBIT)
420 do_input(alias, id->ffbit, 0, FF_MAX);
421 sprintf(alias + strlen(alias), "w*");
422 if (id->flags&INPUT_DEVICE_ID_MATCH_SWBIT)
423 do_input(alias, id->swbit, 0, SW_MAX);
424 return 1;
425}
426
369/* Ignore any prefix, eg. v850 prepends _ */ 427/* Ignore any prefix, eg. v850 prepends _ */
370static inline int sym_is(const char *symbol, const char *name) 428static inline int sym_is(const char *symbol, const char *name)
371{ 429{
@@ -453,7 +511,9 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
453 else if (sym_is(symname, "__mod_i2c_device_table")) 511 else if (sym_is(symname, "__mod_i2c_device_table"))
454 do_table(symval, sym->st_size, sizeof(struct i2c_device_id), 512 do_table(symval, sym->st_size, sizeof(struct i2c_device_id),
455 do_i2c_entry, mod); 513 do_i2c_entry, mod);
456 514 else if (sym_is(symname, "__mod_input_device_table"))
515 do_table(symval, sym->st_size, sizeof(struct input_device_id),
516 do_input_entry, mod);
457} 517}
458 518
459/* Now add out buffered information to the generated C source */ 519/* Now add out buffered information to the generated C source */
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 3bed09e625c0..f70ff13d4818 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -326,8 +326,8 @@ parse_elf_finish(struct elf_info *info)
326 release_file(info->hdr, info->size); 326 release_file(info->hdr, info->size);
327} 327}
328 328
329#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_" 329#define CRC_PFX "__crc_"
330#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_" 330#define KSYMTAB_PFX "__ksymtab_"
331 331
332void 332void
333handle_modversions(struct module *mod, struct elf_info *info, 333handle_modversions(struct module *mod, struct elf_info *info,
@@ -539,10 +539,9 @@ add_header(struct buffer *b, struct module *mod)
539 buf_printf(b, "\n"); 539 buf_printf(b, "\n");
540 buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); 540 buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
541 buf_printf(b, "\n"); 541 buf_printf(b, "\n");
542 buf_printf(b, "#undef unix\n"); /* We have a module called "unix" */
543 buf_printf(b, "struct module __this_module\n"); 542 buf_printf(b, "struct module __this_module\n");
544 buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); 543 buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
545 buf_printf(b, " .name = __stringify(KBUILD_MODNAME),\n"); 544 buf_printf(b, " .name = KBUILD_MODNAME,\n");
546 if (mod->has_init) 545 if (mod->has_init)
547 buf_printf(b, " .init = init_module,\n"); 546 buf_printf(b, " .init = init_module,\n");
548 if (mod->has_cleanup) 547 if (mod->has_cleanup)