From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvRZt-0005Jm-7G for qemu-devel@nongnu.org; Tue, 24 Dec 2013 07:59:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VvRZj-00041i-IT for qemu-devel@nongnu.org; Tue, 24 Dec 2013 07:59:16 -0500 Received: from cantor2.suse.de ([195.135.220.15]:52005 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvRZj-00041e-Bn for qemu-devel@nongnu.org; Tue, 24 Dec 2013 07:59:07 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 24 Dec 2013 13:59:01 +0100 Message-Id: <1387889941-9896-11-git-send-email-afaerber@suse.de> In-Reply-To: <1387889941-9896-1-git-send-email-afaerber@suse.de> References: <1387889941-9896-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 10/10] target-i386: Cleanup 'foo=val' feature handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Igor Mammedov Features family, model, stepping, level, hv_spinlocks are treated similar= ly when passed from command line, so it's not necessary to handle each of th= em individually. Collapse them to one catch-all branch which will treat any not explicitly handled feature in format 'foo=3Dval'. Any unknown feature will be rejected by property setter so there is no need to check for unknown feature in cpu_x86_parse_featurestr(), therefor= e it's replaced by above mentioned catch-all handler. Signed-off-by: Igor Mammedov Signed-off-by: Andreas F=C3=A4rber --- target-i386/cpu.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 9c020a4..967529a 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1706,15 +1706,7 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, = char *features, Error **errp) } else if ((val =3D strchr(featurestr, '=3D'))) { *val =3D 0; val++; feat2prop(featurestr); - if (!strcmp(featurestr, "family")) { - object_property_parse(OBJECT(cpu), val, featurestr, errp= ); - } else if (!strcmp(featurestr, "model")) { - object_property_parse(OBJECT(cpu), val, featurestr, errp= ); - } else if (!strcmp(featurestr, "stepping")) { - object_property_parse(OBJECT(cpu), val, featurestr, errp= ); - } else if (!strcmp(featurestr, "level")) { - object_property_parse(OBJECT(cpu), val, featurestr, errp= ); - } else if (!strcmp(featurestr, "xlevel")) { + if (!strcmp(featurestr, "xlevel")) { char *err; char num[32]; =20 @@ -1730,10 +1722,6 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, = char *features, Error **errp) } snprintf(num, sizeof(num), "%" PRIu32, numvalue); object_property_parse(OBJECT(cpu), num, featurestr, errp= ); - } else if (!strcmp(featurestr, "vendor")) { - object_property_parse(OBJECT(cpu), val, featurestr, errp= ); - } else if (!strcmp(featurestr, "model-id")) { - object_property_parse(OBJECT(cpu), val, featurestr, errp= ); } else if (!strcmp(featurestr, "tsc-freq")) { int64_t tsc_freq; char *err; @@ -1765,8 +1753,7 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, c= har *features, Error **errp) snprintf(num, sizeof(num), "%" PRId32, numvalue); object_property_parse(OBJECT(cpu), num, featurestr, errp= ); } else { - error_setg(errp, "unrecognized feature %s", featurestr); - goto out; + object_property_parse(OBJECT(cpu), val, featurestr, errp= ); } } else { feat2prop(featurestr); --=20 1.8.4