From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [PATCH kvm-unit-tests 1/6] lib/arm/gic: gic_version cleanup Date: Thu, 25 May 2017 12:28:44 +0200 Message-ID: <20170525102849.22754-2-drjones@redhat.com> References: <20170525102849.22754-1-drjones@redhat.com> Cc: pbonzini@redhat.com, rkrcmar@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:45054 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031092AbdEYK3C (ORCPT ); Thu, 25 May 2017 06:29:02 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65C7CC04B943 for ; Thu, 25 May 2017 10:29:02 +0000 (UTC) In-Reply-To: <20170525102849.22754-1-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Remove version from ops as it's not an op, nor necessary. Signed-off-by: Andrew Jones --- lib/arm/gic.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/arm/gic.c b/lib/arm/gic.c index 3ed539727f8c..59273b1716d6 100644 --- a/lib/arm/gic.c +++ b/lib/arm/gic.c @@ -11,7 +11,6 @@ struct gicv2_data gicv2_data; struct gicv3_data gicv3_data; struct gic_common_ops { - int gic_version; void (*enable_defaults)(void); u32 (*read_iar)(void); u32 (*iar_irqnr)(u32 iar); @@ -23,7 +22,6 @@ struct gic_common_ops { static const struct gic_common_ops *gic_common_ops; static const struct gic_common_ops gicv2_common_ops = { - .gic_version = 2, .enable_defaults = gicv2_enable_defaults, .read_iar = gicv2_read_iar, .iar_irqnr = gicv2_iar_irqnr, @@ -33,7 +31,6 @@ static const struct gic_common_ops gicv2_common_ops = { }; static const struct gic_common_ops gicv3_common_ops = { - .gic_version = 3, .enable_defaults = gicv3_enable_defaults, .read_iar = gicv3_read_iar, .iar_irqnr = gicv3_iar_irqnr, @@ -88,18 +85,24 @@ int gicv3_init(void) &gicv3_data.redist_base[0]); } -int gic_init(void) +int gic_version(void) { - if (gicv2_init()) { - gic_common_ops = &gicv2_common_ops; + if (gic_common_ops == &gicv2_common_ops) return 2; - } else if (gicv3_init()) { - gic_common_ops = &gicv3_common_ops; + else if (gic_common_ops == &gicv3_common_ops) return 3; - } return 0; } +int gic_init(void) +{ + if (gicv2_init()) + gic_common_ops = &gicv2_common_ops; + else if (gicv3_init()) + gic_common_ops = &gicv3_common_ops; + return gic_version(); +} + void gic_enable_defaults(void) { if (!gic_common_ops) { @@ -110,12 +113,6 @@ void gic_enable_defaults(void) gic_common_ops->enable_defaults(); } -int gic_version(void) -{ - assert(gic_common_ops); - return gic_common_ops->gic_version; -} - u32 gic_read_iar(void) { assert(gic_common_ops && gic_common_ops->read_iar); -- 2.9.4