aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/file2alias.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-06-27 19:28:12 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-27 21:03:07 -0400
commit90829cfe1df2466c98a831f6c44f71026665cec1 (patch)
tree6d755840d123bd06b16633fba784878d6fd0ac10 /scripts/mod/file2alias.c
parenta5b5577898d9330a78dea1c9e75da1540c36bf72 (diff)
[PATCH] pcmcia: file2alias
Create PCMCIA entries in modules.alias Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'scripts/mod/file2alias.c')
-rw-r--r--scripts/mod/file2alias.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 32197efe67ed..908bff6d1eef 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -287,6 +287,42 @@ static int do_pnp_card_entry(const char *filename,
287 return 1; 287 return 1;
288} 288}
289 289
290/* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */
291static int do_pcmcia_entry(const char *filename,
292 struct pcmcia_device_id *id, char *alias)
293{
294 unsigned int i;
295
296 id->manf_id = TO_NATIVE(id->manf_id);
297 id->card_id = TO_NATIVE(id->card_id);
298 id->func_id = TO_NATIVE(id->func_id);
299 id->function = TO_NATIVE(id->function);
300 id->device_no = TO_NATIVE(id->device_no);
301 for (i=0; i<4; i++) {
302 id->prod_id_hash[i] = TO_NATIVE(id->prod_id_hash[i]);
303 }
304
305 strcpy(alias, "pcmcia:");
306 ADD(alias, "m", id->match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID,
307 id->manf_id);
308 ADD(alias, "c", id->match_flags & PCMCIA_DEV_ID_MATCH_CARD_ID,
309 id->card_id);
310 ADD(alias, "f", id->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID,
311 id->func_id);
312 ADD(alias, "fn", id->match_flags & PCMCIA_DEV_ID_MATCH_FUNCTION,
313 id->function);
314 ADD(alias, "pfn", id->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO,
315 id->device_no);
316 ADD(alias, "pa", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1, id->prod_id_hash[0]);
317 ADD(alias, "pb", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2, id->prod_id_hash[1]);
318 ADD(alias, "pc", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, id->prod_id_hash[2]);
319 ADD(alias, "pd", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, id->prod_id_hash[3]);
320
321 return 1;
322}
323
324
325
290/* Ignore any prefix, eg. v850 prepends _ */ 326/* Ignore any prefix, eg. v850 prepends _ */
291static inline int sym_is(const char *symbol, const char *name) 327static inline int sym_is(const char *symbol, const char *name)
292{ 328{
@@ -362,6 +398,9 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
362 else if (sym_is(symname, "__mod_pnp_card_device_table")) 398 else if (sym_is(symname, "__mod_pnp_card_device_table"))
363 do_table(symval, sym->st_size, sizeof(struct pnp_card_device_id), 399 do_table(symval, sym->st_size, sizeof(struct pnp_card_device_id),
364 do_pnp_card_entry, mod); 400 do_pnp_card_entry, mod);
401 else if (sym_is(symname, "__mod_pcmcia_device_table"))
402 do_table(symval, sym->st_size, sizeof(struct pcmcia_device_id),
403 do_pcmcia_entry, mod);
365} 404}
366 405
367/* Now add out buffered information to the generated C source */ 406/* Now add out buffered information to the generated C source */