aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
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 */