Skip to content

Commit

Permalink
xen: fix unbind_from_irq()
Browse files Browse the repository at this point in the history
Rearrange the tests in unbind_from_irq() so that we can still unbind
an irq even if the underlying event channel is bad.  This allows a
device driver to shuffle its irqs on save/restore before the
underlying event channels have been fixed up.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Jeremy Fitzhardinge authored and Thomas Gleixner committed May 27, 2008
1 parent eb1e305 commit 0f2287a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/xen/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ static void unbind_from_irq(unsigned int irq)

spin_lock(&irq_mapping_update_lock);

if (VALID_EVTCHN(evtchn) && (--irq_bindcount[irq] == 0)) {
if ((--irq_bindcount[irq] == 0) && VALID_EVTCHN(evtchn)) {
close.port = evtchn;
if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
BUG();
Expand All @@ -375,7 +375,7 @@ static void unbind_from_irq(unsigned int irq)
evtchn_to_irq[evtchn] = -1;
irq_info[irq] = IRQ_UNBOUND;

dynamic_irq_init(irq);
dynamic_irq_cleanup(irq);
}

spin_unlock(&irq_mapping_update_lock);
Expand Down

0 comments on commit 0f2287a

Please sign in to comment.