File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -436,8 +436,10 @@ static int i8042_start(struct serio *serio)
436436{
437437 struct i8042_port * port = serio -> port_data ;
438438
439+ spin_lock_irq (& i8042_lock );
439440 port -> exists = true;
440- mb ();
441+ spin_unlock_irq (& i8042_lock );
442+
441443 return 0 ;
442444}
443445
@@ -450,16 +452,20 @@ static void i8042_stop(struct serio *serio)
450452{
451453 struct i8042_port * port = serio -> port_data ;
452454
455+ spin_lock_irq (& i8042_lock );
453456 port -> exists = false;
457+ port -> serio = NULL ;
458+ spin_unlock_irq (& i8042_lock );
454459
455460 /*
461+ * We need to make sure that interrupt handler finishes using
462+ * our serio port before we return from this function.
456463 * We synchronize with both AUX and KBD IRQs because there is
457464 * a (very unlikely) chance that AUX IRQ is raised for KBD port
458465 * and vice versa.
459466 */
460467 synchronize_irq (I8042_AUX_IRQ );
461468 synchronize_irq (I8042_KBD_IRQ );
462- port -> serio = NULL ;
463469}
464470
465471/*
@@ -576,7 +582,7 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
576582
577583 spin_unlock_irqrestore (& i8042_lock , flags );
578584
579- if (likely (port -> exists && !filtered ))
585+ if (likely (serio && !filtered ))
580586 serio_interrupt (serio , data , dfl );
581587
582588 out :
You can’t perform that action at this time.
0 commit comments