From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com
Subject: [PATCH kvm-unit-tests 1/6] lib/arm/gic: gic_version cleanup
Date: Thu, 25 May 2017 12:28:44 +0200 [thread overview]
Message-ID: <20170525102849.22754-2-drjones@redhat.com> (raw)
In-Reply-To: <20170525102849.22754-1-drjones@redhat.com>
Remove version from ops as it's not an op, nor necessary.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
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
next prev parent reply other threads:[~2017-05-25 10:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-25 10:28 [PATCH kvm-unit-tests 0/6] arm/arm64: some cleanups Andrew Jones
2017-05-25 10:28 ` Andrew Jones [this message]
2017-05-25 13:53 ` [PATCH kvm-unit-tests 1/6] lib/arm/gic: gic_version cleanup Paolo Bonzini
2017-05-25 14:28 ` Andrew Jones
2017-05-25 10:28 ` [PATCH kvm-unit-tests 2/6] lib/arm/psci: make psci less ugly Andrew Jones
2017-05-25 10:28 ` [PATCH kvm-unit-tests 3/6] lib/arm/smp: introduce smp_run Andrew Jones
2017-05-25 13:56 ` Paolo Bonzini
2017-05-25 14:41 ` Andrew Jones
2017-05-25 15:07 ` Paolo Bonzini
2017-05-26 11:47 ` Andrew Jones
2017-05-26 12:11 ` Paolo Bonzini
2017-05-25 10:28 ` [PATCH kvm-unit-tests 4/6] arm/arm64: selftest: apply smp_run Andrew Jones
2017-05-25 10:28 ` [PATCH kvm-unit-tests 5/6] arm/arm64: spinlock-test: " Andrew Jones
2017-05-25 10:28 ` [PATCH kvm-unit-tests 6/6] arm/arm64: gic: " Andrew Jones
2017-05-25 13:56 ` [PATCH kvm-unit-tests 0/6] arm/arm64: some cleanups Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170525102849.22754-2-drjones@redhat.com \
--to=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox