and     EPSW_nSL,d0
        beq     resume_kernel           # returning to supervisor mode
 
-       btst    _TIF_SYSCALL_TRACE,d2
-       beq     work_pending
        LOCAL_IRQ_ENABLE                # could let syscall_trace_exit() call
                                        # schedule() instead
+       btst    _TIF_SYSCALL_TRACE,d2
+       beq     work_pending
        mov     fp,d0
        call    syscall_trace_exit[],0  # do_syscall_trace(regs)
        jmp     resume_userspace
 work_resched:
        call    schedule[],0
 
+resume_userspace:
        # make sure we don't miss an interrupt setting need_resched or
        # sigpending between sampling and the rti
        LOCAL_IRQ_DISABLE
        mov     (TI_flags,a2),d2
        btst    _TIF_WORK_MASK,d2
        beq     restore_all
+
+       LOCAL_IRQ_ENABLE
        btst    _TIF_NEED_RESCHED,d2
        bne     work_resched
 
        and     EPSW_nSL,d0
        beq     resume_kernel           # returning to supervisor mode
 
-ENTRY(resume_userspace)
-       # make sure we don't miss an interrupt setting need_resched or
-       # sigpending between sampling and the rti
-       LOCAL_IRQ_DISABLE
-
-       # is there any work to be done on int/exception return?
-       mov     (TI_flags,a2),d2
-       btst    _TIF_WORK_MASK,d2
-       bne     work_pending
-       jmp     restore_all
-
 #ifdef CONFIG_PREEMPT
 ENTRY(resume_kernel)
        LOCAL_IRQ_DISABLE