Commit db198544 authored by Andrew Jones's avatar Andrew Jones Committed by Paolo Bonzini
Browse files

lib/arm/gic: gic_version cleanup



Remove version from ops as it's not an op, nor necessary.
Signed-off-by: Andrew Jones's avatarAndrew Jones <drjones@redhat.com>
Message-Id: <20170525102849.22754-2-drjones@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 75a58702
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment