mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
 }
 
+static void ioat_reboot_chan(struct ioatdma_chan *ioat_chan)
+{
+       spin_lock_bh(&ioat_chan->prep_lock);
+       set_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
+       spin_unlock_bh(&ioat_chan->prep_lock);
+
+       ioat_abort_descs(ioat_chan);
+       dev_warn(to_dev(ioat_chan), "Reset channel...\n");
+       ioat_reset_hw(ioat_chan);
+       dev_warn(to_dev(ioat_chan), "Restart channel...\n");
+       ioat_restart_channel(ioat_chan);
+
+       spin_lock_bh(&ioat_chan->prep_lock);
+       clear_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
+       spin_unlock_bh(&ioat_chan->prep_lock);
+}
+
 void ioat_timer_event(struct timer_list *t)
 {
        struct ioatdma_chan *ioat_chan = from_timer(ioat_chan, t, timer);
 
                if (test_bit(IOAT_RUN, &ioat_chan->state)) {
                        spin_lock_bh(&ioat_chan->cleanup_lock);
-                       spin_lock_bh(&ioat_chan->prep_lock);
-                       set_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
-                       spin_unlock_bh(&ioat_chan->prep_lock);
-
-                       ioat_abort_descs(ioat_chan);
-                       dev_warn(to_dev(ioat_chan), "Reset channel...\n");
-                       ioat_reset_hw(ioat_chan);
-                       dev_warn(to_dev(ioat_chan), "Restart channel...\n");
-                       ioat_restart_channel(ioat_chan);
-
-                       spin_lock_bh(&ioat_chan->prep_lock);
-                       clear_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
-                       spin_unlock_bh(&ioat_chan->prep_lock);
+                       ioat_reboot_chan(ioat_chan);
                        spin_unlock_bh(&ioat_chan->cleanup_lock);
                }
 
                dev_dbg(to_dev(ioat_chan), "Active descriptors: %d\n",
                        ioat_ring_active(ioat_chan));
 
-               spin_lock_bh(&ioat_chan->prep_lock);
-               set_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
-               spin_unlock_bh(&ioat_chan->prep_lock);
-
-               ioat_abort_descs(ioat_chan);
-               dev_warn(to_dev(ioat_chan), "Resetting channel...\n");
-               ioat_reset_hw(ioat_chan);
-               dev_warn(to_dev(ioat_chan), "Restarting channel...\n");
-               ioat_restart_channel(ioat_chan);
-
-               spin_lock_bh(&ioat_chan->prep_lock);
-               clear_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
-               spin_unlock_bh(&ioat_chan->prep_lock);
+               ioat_reboot_chan(ioat_chan);
                spin_unlock_bh(&ioat_chan->cleanup_lock);
                return;
        } else