diff options
-rw-r--r-- | scripts/mod/file2alias.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index e04c4218cb52..cea4a790e1e9 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -51,6 +51,15 @@ do { \ | |||
51 | sprintf(str + strlen(str), "*"); \ | 51 | sprintf(str + strlen(str), "*"); \ |
52 | } while(0) | 52 | } while(0) |
53 | 53 | ||
54 | /* Always end in a wildcard, for future extension */ | ||
55 | static inline void add_wildcard(char *str) | ||
56 | { | ||
57 | int len = strlen(str); | ||
58 | |||
59 | if (str[len - 1] != '*') | ||
60 | strcat(str + len, "*"); | ||
61 | } | ||
62 | |||
54 | unsigned int cross_build = 0; | 63 | unsigned int cross_build = 0; |
55 | /** | 64 | /** |
56 | * Check that sizeof(device_id type) are consistent with size of section | 65 | * Check that sizeof(device_id type) are consistent with size of section |
@@ -133,9 +142,7 @@ static void do_usb_entry(struct usb_device_id *id, | |||
133 | id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL, | 142 | id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL, |
134 | id->bInterfaceProtocol); | 143 | id->bInterfaceProtocol); |
135 | 144 | ||
136 | /* Always end in a wildcard, for future extension */ | 145 | add_wildcard(alias); |
137 | if (alias[strlen(alias)-1] != '*') | ||
138 | strcat(alias, "*"); | ||
139 | buf_printf(&mod->dev_table_buf, | 146 | buf_printf(&mod->dev_table_buf, |
140 | "MODULE_ALIAS(\"%s\");\n", alias); | 147 | "MODULE_ALIAS(\"%s\");\n", alias); |
141 | } | 148 | } |
@@ -219,6 +226,7 @@ static int do_ieee1394_entry(const char *filename, | |||
219 | ADD(alias, "ver", id->match_flags & IEEE1394_MATCH_VERSION, | 226 | ADD(alias, "ver", id->match_flags & IEEE1394_MATCH_VERSION, |
220 | id->version); | 227 | id->version); |
221 | 228 | ||
229 | add_wildcard(alias); | ||
222 | return 1; | 230 | return 1; |
223 | } | 231 | } |
224 | 232 | ||
@@ -261,6 +269,7 @@ static int do_pci_entry(const char *filename, | |||
261 | ADD(alias, "bc", baseclass_mask == 0xFF, baseclass); | 269 | ADD(alias, "bc", baseclass_mask == 0xFF, baseclass); |
262 | ADD(alias, "sc", subclass_mask == 0xFF, subclass); | 270 | ADD(alias, "sc", subclass_mask == 0xFF, subclass); |
263 | ADD(alias, "i", interface_mask == 0xFF, interface); | 271 | ADD(alias, "i", interface_mask == 0xFF, interface); |
272 | add_wildcard(alias); | ||
264 | return 1; | 273 | return 1; |
265 | } | 274 | } |
266 | 275 | ||
@@ -283,6 +292,7 @@ static int do_ccw_entry(const char *filename, | |||
283 | id->dev_type); | 292 | id->dev_type); |
284 | ADD(alias, "dm", id->match_flags&CCW_DEVICE_ID_MATCH_DEVICE_MODEL, | 293 | ADD(alias, "dm", id->match_flags&CCW_DEVICE_ID_MATCH_DEVICE_MODEL, |
285 | id->dev_model); | 294 | id->dev_model); |
295 | add_wildcard(alias); | ||
286 | return 1; | 296 | return 1; |
287 | } | 297 | } |
288 | 298 | ||
@@ -290,7 +300,7 @@ static int do_ccw_entry(const char *filename, | |||
290 | static int do_ap_entry(const char *filename, | 300 | static int do_ap_entry(const char *filename, |
291 | struct ap_device_id *id, char *alias) | 301 | struct ap_device_id *id, char *alias) |
292 | { | 302 | { |
293 | sprintf(alias, "ap:t%02X", id->dev_type); | 303 | sprintf(alias, "ap:t%02X*", id->dev_type); |
294 | return 1; | 304 | return 1; |
295 | } | 305 | } |
296 | 306 | ||
@@ -309,6 +319,7 @@ static int do_serio_entry(const char *filename, | |||
309 | ADD(alias, "id", id->id != SERIO_ANY, id->id); | 319 | ADD(alias, "id", id->id != SERIO_ANY, id->id); |
310 | ADD(alias, "ex", id->extra != SERIO_ANY, id->extra); | 320 | ADD(alias, "ex", id->extra != SERIO_ANY, id->extra); |
311 | 321 | ||
322 | add_wildcard(alias); | ||
312 | return 1; | 323 | return 1; |
313 | } | 324 | } |
314 | 325 | ||
@@ -316,7 +327,7 @@ static int do_serio_entry(const char *filename, | |||
316 | static int do_acpi_entry(const char *filename, | 327 | static int do_acpi_entry(const char *filename, |
317 | struct acpi_device_id *id, char *alias) | 328 | struct acpi_device_id *id, char *alias) |
318 | { | 329 | { |
319 | sprintf(alias, "acpi*:%s:", id->id); | 330 | sprintf(alias, "acpi*:%s:*", id->id); |
320 | return 1; | 331 | return 1; |
321 | } | 332 | } |
322 | 333 | ||
@@ -324,7 +335,7 @@ static int do_acpi_entry(const char *filename, | |||
324 | static int do_pnp_entry(const char *filename, | 335 | static int do_pnp_entry(const char *filename, |
325 | struct pnp_device_id *id, char *alias) | 336 | struct pnp_device_id *id, char *alias) |
326 | { | 337 | { |
327 | sprintf(alias, "pnp:d%s", id->id); | 338 | sprintf(alias, "pnp:d%s*", id->id); |
328 | return 1; | 339 | return 1; |
329 | } | 340 | } |
330 | 341 | ||
@@ -409,6 +420,7 @@ static int do_pcmcia_entry(const char *filename, | |||
409 | ADD(alias, "pc", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, id->prod_id_hash[2]); | 420 | ADD(alias, "pc", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, id->prod_id_hash[2]); |
410 | ADD(alias, "pd", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, id->prod_id_hash[3]); | 421 | ADD(alias, "pd", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, id->prod_id_hash[3]); |
411 | 422 | ||
423 | add_wildcard(alias); | ||
412 | return 1; | 424 | return 1; |
413 | } | 425 | } |
414 | 426 | ||
@@ -432,6 +444,7 @@ static int do_of_entry (const char *filename, struct of_device_id *of, char *ali | |||
432 | if (isspace (*tmp)) | 444 | if (isspace (*tmp)) |
433 | *tmp = '_'; | 445 | *tmp = '_'; |
434 | 446 | ||
447 | add_wildcard(alias); | ||
435 | return 1; | 448 | return 1; |
436 | } | 449 | } |
437 | 450 | ||
@@ -448,6 +461,7 @@ static int do_vio_entry(const char *filename, struct vio_device_id *vio, | |||
448 | if (isspace (*tmp)) | 461 | if (isspace (*tmp)) |
449 | *tmp = '_'; | 462 | *tmp = '_'; |
450 | 463 | ||
464 | add_wildcard(alias); | ||
451 | return 1; | 465 | return 1; |
452 | } | 466 | } |
453 | 467 | ||
@@ -511,6 +525,8 @@ static int do_eisa_entry(const char *filename, struct eisa_device_id *eisa, | |||
511 | { | 525 | { |
512 | if (eisa->sig[0]) | 526 | if (eisa->sig[0]) |
513 | sprintf(alias, EISA_DEVICE_MODALIAS_FMT "*", eisa->sig); | 527 | sprintf(alias, EISA_DEVICE_MODALIAS_FMT "*", eisa->sig); |
528 | else | ||
529 | strcat(alias, "*"); | ||
514 | return 1; | 530 | return 1; |
515 | } | 531 | } |
516 | 532 | ||
@@ -529,6 +545,7 @@ static int do_parisc_entry(const char *filename, struct parisc_device_id *id, | |||
529 | ADD(alias, "rev", id->hversion_rev != PA_HVERSION_REV_ANY_ID, id->hversion_rev); | 545 | ADD(alias, "rev", id->hversion_rev != PA_HVERSION_REV_ANY_ID, id->hversion_rev); |
530 | ADD(alias, "sv", id->sversion != PA_SVERSION_ANY_ID, id->sversion); | 546 | ADD(alias, "sv", id->sversion != PA_SVERSION_ANY_ID, id->sversion); |
531 | 547 | ||
548 | add_wildcard(alias); | ||
532 | return 1; | 549 | return 1; |
533 | } | 550 | } |
534 | 551 | ||
@@ -544,6 +561,7 @@ static int do_sdio_entry(const char *filename, | |||
544 | ADD(alias, "c", id->class != (__u8)SDIO_ANY_ID, id->class); | 561 | ADD(alias, "c", id->class != (__u8)SDIO_ANY_ID, id->class); |
545 | ADD(alias, "v", id->vendor != (__u16)SDIO_ANY_ID, id->vendor); | 562 | ADD(alias, "v", id->vendor != (__u16)SDIO_ANY_ID, id->vendor); |
546 | ADD(alias, "d", id->device != (__u16)SDIO_ANY_ID, id->device); | 563 | ADD(alias, "d", id->device != (__u16)SDIO_ANY_ID, id->device); |
564 | add_wildcard(alias); | ||
547 | return 1; | 565 | return 1; |
548 | } | 566 | } |
549 | 567 | ||
@@ -559,6 +577,7 @@ static int do_ssb_entry(const char *filename, | |||
559 | ADD(alias, "v", id->vendor != SSB_ANY_VENDOR, id->vendor); | 577 | ADD(alias, "v", id->vendor != SSB_ANY_VENDOR, id->vendor); |
560 | ADD(alias, "id", id->coreid != SSB_ANY_ID, id->coreid); | 578 | ADD(alias, "id", id->coreid != SSB_ANY_ID, id->coreid); |
561 | ADD(alias, "rev", id->revision != SSB_ANY_REV, id->revision); | 579 | ADD(alias, "rev", id->revision != SSB_ANY_REV, id->revision); |
580 | add_wildcard(alias); | ||
562 | return 1; | 581 | return 1; |
563 | } | 582 | } |
564 | 583 | ||
@@ -573,6 +592,7 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id, | |||
573 | ADD(alias, "d", 1, id->device); | 592 | ADD(alias, "d", 1, id->device); |
574 | ADD(alias, "v", id->vendor != VIRTIO_DEV_ANY_ID, id->vendor); | 593 | ADD(alias, "v", id->vendor != VIRTIO_DEV_ANY_ID, id->vendor); |
575 | 594 | ||
595 | add_wildcard(alias); | ||
576 | return 1; | 596 | return 1; |
577 | } | 597 | } |
578 | 598 | ||
@@ -612,9 +632,6 @@ static void do_table(void *symval, unsigned long size, | |||
612 | 632 | ||
613 | for (i = 0; i < size; i += id_size) { | 633 | for (i = 0; i < size; i += id_size) { |
614 | if (do_entry(mod->name, symval+i, alias)) { | 634 | if (do_entry(mod->name, symval+i, alias)) { |
615 | /* Always end in a wildcard, for future extension */ | ||
616 | if (alias[strlen(alias)-1] != '*') | ||
617 | strcat(alias, "*"); | ||
618 | buf_printf(&mod->dev_table_buf, | 635 | buf_printf(&mod->dev_table_buf, |
619 | "MODULE_ALIAS(\"%s\");\n", alias); | 636 | "MODULE_ALIAS(\"%s\");\n", alias); |
620 | } | 637 | } |