Shouldn't the assigning of the state be inside the lock? . spin_unlock_irq(&ctrl->lock); if (changed) ctrl->state = new_state; return changed;