Received: from eggs.gnu.org ([2001:4830:134:3::10]:54050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvRZu-0005LY-08 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-00041a-1J for qemu-devel@nongnu.org; Tue, 24 Dec 2013 07:59:17 -0500 Received: from cantor2.suse.de ([195.135.220.15]:52003 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvRZi-00041U-R7 for qemu-devel@nongnu.org; Tue, 24 Dec 2013 07:59:06 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 24 Dec 2013 13:59:00 +0100 Message-Id: <1387889941-9896-10-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 09/10] target-i386: Cleanup 'foo' 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 check, enforce, hv_relaxed and hv_vapic are treated as boolean set to 'on' when passed from command line, so it's not necessary to handle each of them separately. Collapse them to one catch-all branch which will treat any feature in format 'foo' as boolean set to 'on'. Any unknown feature will be rejected by CPU property setter so there is n= o 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 Reviewed-by: Eduardo Habkost Signed-off-by: Andreas F=C3=A4rber --- target-i386/cpu.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 6055035..9c020a4 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1768,18 +1768,9 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, = char *features, Error **errp) error_setg(errp, "unrecognized feature %s", featurestr); goto out; } - } else if (!strcmp(featurestr, "check")) { - object_property_parse(OBJECT(cpu), "on", featurestr, errp); - } else if (!strcmp(featurestr, "enforce")) { - object_property_parse(OBJECT(cpu), "on", featurestr, errp); - } else if (!strcmp(featurestr, "hv_relaxed")) { - object_property_parse(OBJECT(cpu), "on", "hv-relaxed", errp)= ; - } else if (!strcmp(featurestr, "hv_vapic")) { - object_property_parse(OBJECT(cpu), "on", "hv-vapic", errp); } else { - error_setg(errp, "feature string `%s' not in format (+featur= e|" - "-feature|feature=3Dxyz)", featurestr); - goto out; + feat2prop(featurestr); + object_property_parse(OBJECT(cpu), "on", featurestr, errp); } if (error_is_set(errp)) { goto out; --=20 1.8.4