aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2005-07-06 15:44:41 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-06 15:55:20 -0400
commit5e6557722e69840506eb8bc5a1edcdb4e447a917 (patch)
tree965d19e55a56d2daaed47711c01a8c27e29e592c /scripts/mod
parent159f597a8bd0f1d7650d5e580c93a2666c9c26d1 (diff)
[PATCH] openfirmware: generate device table for userspace
This converts the usage of struct of_match to struct of_device_id, similar to pci_device_id. This allows a device table to be generated, which can be parsed by depmod(8) to generate a map file for module loading. In order for hotplug to work with macio devices, patches to module-init-tools and hotplug must be applied. Those patches are available at: ftp://ftp.suse.com/pub/people/jeffm/linux/macio-hotplug/ Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 908bff6d1eef..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;
@@ -323,6 +325,22 @@ static int do_pcmcia_entry(const char *filename,
323 325
324 326
325 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
326/* Ignore any prefix, eg. v850 prepends _ */ 344/* Ignore any prefix, eg. v850 prepends _ */
327static inline int sym_is(const char *symbol, const char *name) 345static inline int sym_is(const char *symbol, const char *name)
328{ 346{
@@ -401,6 +419,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
401 else if (sym_is(symname, "__mod_pcmcia_device_table")) 419 else if (sym_is(symname, "__mod_pcmcia_device_table"))
402 do_table(symval, sym->st_size, sizeof(struct pcmcia_device_id), 420 do_table(symval, sym->st_size, sizeof(struct pcmcia_device_id),
403 do_pcmcia_entry, mod); 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
404} 426}
405 427
406/* Now add out buffered information to the generated C source */ 428/* Now add out buffered information to the generated C source */