From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cantor2.suse.de ([195.135.220.15]:36687 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754933Ab3DWIpA (ORCPT ); Tue, 23 Apr 2013 04:45:00 -0400 Message-ID: <51764A0A.9000506@suse.cz> Date: Tue, 23 Apr 2013 10:44:58 +0200 From: Michal Marek MIME-Version: 1.0 Subject: Re: [PATCH 5/6] kconfig: implement KCONFIG_PROBABILITY for randconfig References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: "Yann E. MORIN" Cc: linux-kbuild@vger.kernel.org, Peter Korsgaard On 22.4.2013 23:31, Yann E. MORIN wrote: > diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c > index 13ddf11..8d8d853 100644 > --- a/scripts/kconfig/confdata.c > +++ b/scripts/kconfig/confdata.c > @@ -1106,7 +1106,16 @@ static void set_all_choice_values(struct symbol *csym) > void conf_set_all_new_symbols(enum conf_def_mode mode) > { > struct symbol *sym, *csym; > - int i, cnt; > + int i, cnt, prob = 50; > + [...] > case def_random: > - cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2; > - sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt); > + cnt = (rand() % 100) - (100 - prob); > + if (cnt < 0) > + sym->def[S_DEF_USER].tri = no; > + else > + if ((sym_get_type(sym) == S_TRISTATE) > + && (cnt > prob/2)) > + sym->def[S_DEF_USER].tri = mod; > + else > + sym->def[S_DEF_USER].tri = yes; Previously, the distribution was 50%-50% for boolean options and 33%-33%-33% for tristate options. Now the default for tristate options changed to 50%-25%-25% (no-mod-yes). Wouldn't it make more sense to have a special case for KCONFIG_PROBABILITY not set, that would use the same distribution as before. I.e. if (prob == -1) { cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2; sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt); } else { /* new math */ } Not building half of all drivers is rather boring :) Thanks, Michal