diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-09-07 13:19:01 -0400 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2016-09-30 06:23:04 -0400 |
commit | c8761e2016aa51a2829563b02a0a55913bdb0be8 (patch) | |
tree | cbceacae7a9d60efbedd2afc5f5bea1041a50c87 /drivers/xen | |
parent | 4d737042d6c4ee10a632cf94b953169d13955a40 (diff) |
xen/events: Convert to hotplug state machine
Install the callbacks via the state machine.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/events/events_fifo.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c index 266c2c733039..7ef27c6ed72f 100644 --- a/drivers/xen/events/events_fifo.c +++ b/drivers/xen/events/events_fifo.c | |||
@@ -418,30 +418,18 @@ static int evtchn_fifo_alloc_control_block(unsigned cpu) | |||
418 | return ret; | 418 | return ret; |
419 | } | 419 | } |
420 | 420 | ||
421 | static int evtchn_fifo_cpu_notification(struct notifier_block *self, | 421 | static int xen_evtchn_cpu_prepare(unsigned int cpu) |
422 | unsigned long action, | ||
423 | void *hcpu) | ||
424 | { | 422 | { |
425 | int cpu = (long)hcpu; | 423 | if (!per_cpu(cpu_control_block, cpu)) |
426 | int ret = 0; | 424 | return evtchn_fifo_alloc_control_block(cpu); |
427 | 425 | return 0; | |
428 | switch (action) { | ||
429 | case CPU_UP_PREPARE: | ||
430 | if (!per_cpu(cpu_control_block, cpu)) | ||
431 | ret = evtchn_fifo_alloc_control_block(cpu); | ||
432 | break; | ||
433 | case CPU_DEAD: | ||
434 | __evtchn_fifo_handle_events(cpu, true); | ||
435 | break; | ||
436 | default: | ||
437 | break; | ||
438 | } | ||
439 | return ret < 0 ? NOTIFY_BAD : NOTIFY_OK; | ||
440 | } | 426 | } |
441 | 427 | ||
442 | static struct notifier_block evtchn_fifo_cpu_notifier = { | 428 | static int xen_evtchn_cpu_dead(unsigned int cpu) |
443 | .notifier_call = evtchn_fifo_cpu_notification, | 429 | { |
444 | }; | 430 | __evtchn_fifo_handle_events(cpu, true); |
431 | return 0; | ||
432 | } | ||
445 | 433 | ||
446 | int __init xen_evtchn_fifo_init(void) | 434 | int __init xen_evtchn_fifo_init(void) |
447 | { | 435 | { |
@@ -456,7 +444,9 @@ int __init xen_evtchn_fifo_init(void) | |||
456 | 444 | ||
457 | evtchn_ops = &evtchn_ops_fifo; | 445 | evtchn_ops = &evtchn_ops_fifo; |
458 | 446 | ||
459 | register_cpu_notifier(&evtchn_fifo_cpu_notifier); | 447 | cpuhp_setup_state_nocalls(CPUHP_XEN_EVTCHN_PREPARE, |
448 | "CPUHP_XEN_EVTCHN_PREPARE", | ||
449 | xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead); | ||
460 | out: | 450 | out: |
461 | put_cpu(); | 451 | put_cpu(); |
462 | return ret; | 452 | return ret; |