Commit 31620a19 authored by Konrad Rzeszutek Wilk's avatar Konrad Rzeszutek Wilk

xen/time: Encapsulate the struct clock_event_device in another structure.

We don't do any code movement. We just encapsulate the struct clock_event_device
in a new structure which contains said structure and a pointer to
a char *name. The 'name' will be used in 'xen/time: Don't leak interrupt
name when offlining'.
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 354e7b76
...@@ -377,11 +377,16 @@ static const struct clock_event_device xen_vcpuop_clockevent = { ...@@ -377,11 +377,16 @@ static const struct clock_event_device xen_vcpuop_clockevent = {
static const struct clock_event_device *xen_clockevent = static const struct clock_event_device *xen_clockevent =
&xen_timerop_clockevent; &xen_timerop_clockevent;
static DEFINE_PER_CPU(struct clock_event_device, xen_clock_events) = { .irq = -1 };
struct xen_clock_event_device {
struct clock_event_device evt;
char *name;
};
static DEFINE_PER_CPU(struct xen_clock_event_device, xen_clock_events) = { .evt.irq = -1 };
static irqreturn_t xen_timer_interrupt(int irq, void *dev_id) static irqreturn_t xen_timer_interrupt(int irq, void *dev_id)
{ {
struct clock_event_device *evt = &__get_cpu_var(xen_clock_events); struct clock_event_device *evt = &__get_cpu_var(xen_clock_events).evt;
irqreturn_t ret; irqreturn_t ret;
ret = IRQ_NONE; ret = IRQ_NONE;
...@@ -401,7 +406,7 @@ void xen_setup_timer(int cpu) ...@@ -401,7 +406,7 @@ void xen_setup_timer(int cpu)
struct clock_event_device *evt; struct clock_event_device *evt;
int irq; int irq;
evt = &per_cpu(xen_clock_events, cpu); evt = &per_cpu(xen_clock_events, cpu).evt;
WARN(evt->irq >= 0, "IRQ%d for CPU%d is already allocated\n", evt->irq, cpu); WARN(evt->irq >= 0, "IRQ%d for CPU%d is already allocated\n", evt->irq, cpu);
printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu); printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu);
...@@ -426,7 +431,7 @@ void xen_teardown_timer(int cpu) ...@@ -426,7 +431,7 @@ void xen_teardown_timer(int cpu)
{ {
struct clock_event_device *evt; struct clock_event_device *evt;
BUG_ON(cpu == 0); BUG_ON(cpu == 0);
evt = &per_cpu(xen_clock_events, cpu); evt = &per_cpu(xen_clock_events, cpu).evt;
unbind_from_irqhandler(evt->irq, NULL); unbind_from_irqhandler(evt->irq, NULL);
evt->irq = -1; evt->irq = -1;
} }
...@@ -435,7 +440,7 @@ void xen_setup_cpu_clockevents(void) ...@@ -435,7 +440,7 @@ void xen_setup_cpu_clockevents(void)
{ {
BUG_ON(preemptible()); BUG_ON(preemptible());
clockevents_register_device(&__get_cpu_var(xen_clock_events)); clockevents_register_device(&__get_cpu_var(xen_clock_events).evt);
} }
void xen_timer_resume(void) void xen_timer_resume(void)
......
Markdown is supported
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