Skip to content

Commit 2baedcb

Browse files
Leonid Ravichvinodkoul
authored andcommitted
dmaengine: ioat: remove unnesesery double complition timer modification.
removing unnecessary mod_timer from timeout handler incase of ioat_cleanup_preamble() is true for cleaner code Acked-by: Dave Jiang <[email protected]> Signed-off-by: Leonid Ravich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 5a87c50 commit 2baedcb

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

drivers/dma/ioat/dma.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -922,17 +922,23 @@ void ioat_timer_event(struct timer_list *t)
922922
spin_lock_bh(&ioat_chan->prep_lock);
923923
check_active(ioat_chan);
924924
spin_unlock_bh(&ioat_chan->prep_lock);
925-
spin_unlock_bh(&ioat_chan->cleanup_lock);
926-
return;
925+
goto unlock_out;
926+
}
927+
928+
/* handle the missed cleanup case */
929+
if (ioat_cleanup_preamble(ioat_chan, &phys_complete)) {
930+
/* timer restarted in ioat_cleanup_preamble
931+
* and IOAT_COMPLETION_ACK cleared
932+
*/
933+
__cleanup(ioat_chan, phys_complete);
934+
goto unlock_out;
927935
}
928936

929937
/* if we haven't made progress and we have already
930938
* acknowledged a pending completion once, then be more
931939
* forceful with a restart
932940
*/
933-
if (ioat_cleanup_preamble(ioat_chan, &phys_complete))
934-
__cleanup(ioat_chan, phys_complete);
935-
else if (test_bit(IOAT_COMPLETION_ACK, &ioat_chan->state)) {
941+
if (test_bit(IOAT_COMPLETION_ACK, &ioat_chan->state)) {
936942
u32 chanerr;
937943

938944
chanerr = readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET);
@@ -945,12 +951,13 @@ void ioat_timer_event(struct timer_list *t)
945951
ioat_ring_active(ioat_chan));
946952

947953
ioat_reboot_chan(ioat_chan);
948-
spin_unlock_bh(&ioat_chan->cleanup_lock);
949-
return;
950-
} else
951-
set_bit(IOAT_COMPLETION_ACK, &ioat_chan->state);
952954

955+
goto unlock_out;
956+
}
957+
958+
set_bit(IOAT_COMPLETION_ACK, &ioat_chan->state);
953959
mod_timer(&ioat_chan->timer, jiffies + COMPLETION_TIMEOUT);
960+
unlock_out:
954961
spin_unlock_bh(&ioat_chan->cleanup_lock);
955962
}
956963

0 commit comments

Comments
 (0)