Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes:
kconfig: improve seed in randconfig
kconfig: fix randconfig for choice blocks

+51 -16
+15 -1
scripts/kconfig/conf.c
··· 11 11 #include <time.h> 12 12 #include <unistd.h> 13 13 #include <sys/stat.h> 14 + #include <sys/time.h> 14 15 15 16 #define LKC_DIRECT_LINK 16 17 #include "lkc.h" ··· 465 464 input_mode = set_yes; 466 465 break; 467 466 case 'r': 467 + { 468 + struct timeval now; 469 + unsigned int seed; 470 + 471 + /* 472 + * Use microseconds derived seed, 473 + * compensate for systems where it may be zero 474 + */ 475 + gettimeofday(&now, NULL); 476 + 477 + seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); 478 + srand(seed); 479 + 468 480 input_mode = set_random; 469 - srand(time(NULL)); 470 481 break; 482 + } 471 483 case 'h': 472 484 printf(_("See README for usage info\n")); 473 485 exit(0);
+36 -15
scripts/kconfig/confdata.c
··· 843 843 default: 844 844 continue; 845 845 } 846 - if (!sym_is_choice(sym) || mode != def_random) 846 + if (!(sym_is_choice(sym) && mode == def_random)) 847 847 sym->flags |= SYMBOL_DEF_USER; 848 848 break; 849 849 default: ··· 856 856 857 857 if (mode != def_random) 858 858 return; 859 - 859 + /* 860 + * We have different type of choice blocks. 861 + * If curr.tri equal to mod then we can select several 862 + * choice symbols in one block. 863 + * In this case we do nothing. 864 + * If curr.tri equal yes then only one symbol can be 865 + * selected in a choice block and we set it to yes, 866 + * and the rest to no. 867 + */ 860 868 for_all_symbols(i, csym) { 861 869 if (sym_has_value(csym) || !sym_is_choice(csym)) 862 870 continue; 863 871 864 872 sym_calc_value(csym); 873 + 874 + if (csym->curr.tri != yes) 875 + continue; 876 + 865 877 prop = sym_get_choice_prop(csym); 866 - def = -1; 867 - while (1) { 868 - cnt = 0; 869 - expr_list_for_each_sym(prop->expr, e, sym) { 870 - if (sym->visible == no) 871 - continue; 872 - if (def == cnt++) { 873 - csym->def[S_DEF_USER].val = sym; 874 - break; 875 - } 878 + 879 + /* count entries in choice block */ 880 + cnt = 0; 881 + expr_list_for_each_sym(prop->expr, e, sym) 882 + cnt++; 883 + 884 + /* 885 + * find a random value and set it to yes, 886 + * set the rest to no so we have only one set 887 + */ 888 + def = (rand() % cnt); 889 + 890 + cnt = 0; 891 + expr_list_for_each_sym(prop->expr, e, sym) { 892 + if (def == cnt++) { 893 + sym->def[S_DEF_USER].tri = yes; 894 + csym->def[S_DEF_USER].val = sym; 876 895 } 877 - if (def >= 0 || cnt < 2) 878 - break; 879 - def = (rand() % cnt) + 1; 896 + else { 897 + sym->def[S_DEF_USER].tri = no; 898 + } 880 899 } 881 900 csym->flags |= SYMBOL_DEF_USER; 901 + /* clear VALID to get value calculated */ 902 + csym->flags &= ~(SYMBOL_VALID); 882 903 } 883 904 }