diff options
-rw-r--r-- | Documentation/kbuild/kconfig-language.txt | 24 | ||||
-rw-r--r-- | scripts/kconfig/lkc.h | 6 | ||||
-rw-r--r-- | scripts/kconfig/mconf.c | 3 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 35 |
4 files changed, 31 insertions, 37 deletions
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index 00b950d1c193..c412c245848f 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt | |||
@@ -377,27 +377,3 @@ config FOO | |||
377 | 377 | ||
378 | limits FOO to module (=m) or disabled (=n). | 378 | limits FOO to module (=m) or disabled (=n). |
379 | 379 | ||
380 | |||
381 | Build limited by a third config symbol which may be =y or =m | ||
382 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
383 | A common idiom that we see (and sometimes have problems with) is this: | ||
384 | |||
385 | When option C in B (module or subsystem) uses interfaces from A (module | ||
386 | or subsystem), and both A and B are tristate (could be =y or =m if they | ||
387 | were independent of each other, but they aren't), then we need to limit | ||
388 | C such that it cannot be built statically if A is built as a loadable | ||
389 | module. (C already depends on B, so there is no dependency issue to | ||
390 | take care of here.) | ||
391 | |||
392 | If A is linked statically into the kernel image, C can be built | ||
393 | statically or as loadable module(s). However, if A is built as loadable | ||
394 | module(s), then C must be restricted to loadable module(s) also. This | ||
395 | can be expressed in kconfig language as: | ||
396 | |||
397 | config C | ||
398 | depends on A = y || A = B | ||
399 | |||
400 | or for real examples, use this command in a kernel tree: | ||
401 | |||
402 | $ find . -name Kconfig\* | xargs grep -ns "depends on.*=.*||.*=" | grep -v orig | ||
403 | |||
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 4bc68f20a73c..96521cb087ec 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -11,9 +11,9 @@ | |||
11 | #ifndef KBUILD_NO_NLS | 11 | #ifndef KBUILD_NO_NLS |
12 | # include <libintl.h> | 12 | # include <libintl.h> |
13 | #else | 13 | #else |
14 | # define gettext(Msgid) ((const char *) (Msgid)) | 14 | static inline const char *gettext(const char *txt) { return txt; } |
15 | # define textdomain(Domainname) ((const char *) (Domainname)) | 15 | static inline void textdomain(const char *domainname) {} |
16 | # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) | 16 | static inline void bindtextdomain(const char *name, const char *dir) {} |
17 | #endif | 17 | #endif |
18 | 18 | ||
19 | #ifdef __cplusplus | 19 | #ifdef __cplusplus |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 734cf4f3131e..6841e95c0989 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -773,7 +773,7 @@ static void conf_string(struct menu *menu) | |||
773 | 773 | ||
774 | while (1) { | 774 | while (1) { |
775 | int res; | 775 | int res; |
776 | char *heading; | 776 | const char *heading; |
777 | 777 | ||
778 | switch (sym_get_type(menu->sym)) { | 778 | switch (sym_get_type(menu->sym)) { |
779 | case S_INT: | 779 | case S_INT: |
@@ -925,3 +925,4 @@ int main(int ac, char **av) | |||
925 | 925 | ||
926 | return 0; | 926 | return 0; |
927 | } | 927 | } |
928 | |||
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 | } |