diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-05-24 02:48:50 +0300 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-11-01 21:44:49 +0300 |
commit | 8a47aa9dc636db851254615ea79ba91a52cf9206 (patch) | |
tree | c757f3585118dc416048c693dd7b8a9c7e7d0494 /drivers/target/iscsi/iscsi_target_erl1.c | |
parent | d744644ad7088ec04c0e1ad7c6c1adcec849c51c (diff) | |
download | linux-8a47aa9dc636db851254615ea79ba91a52cf9206.tar.xz |
target/iscsi: Simplify timer manipulation code
Move timer initialization from before add_timer() to the context
where the containing object is initialized. Use setup_timer() and
mod_timer() instead of open coding these. Use 'jiffies' instead
of get_jiffies_64() when calculating expiry times because expiry
times have type unsigned long, just like 'jiffies'.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_erl1.c')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_erl1.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index fe9b7f1e44ac..19b28255b687 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c @@ -1148,7 +1148,7 @@ static int iscsit_set_dataout_timeout_values( /* * NOTE: Called from interrupt (timer) context. */ -static void iscsit_handle_dataout_timeout(unsigned long data) +void iscsit_handle_dataout_timeout(unsigned long data) { u32 pdu_length = 0, pdu_offset = 0; u32 r2t_length = 0, r2t_offset = 0; @@ -1264,13 +1264,9 @@ void iscsit_start_dataout_timer( pr_debug("Starting DataOUT timer for ITT: 0x%08x on" " CID: %hu.\n", cmd->init_task_tag, conn->cid); - init_timer(&cmd->dataout_timer); - cmd->dataout_timer.expires = (get_jiffies_64() + na->dataout_timeout * HZ); - cmd->dataout_timer.data = (unsigned long)cmd; - cmd->dataout_timer.function = iscsit_handle_dataout_timeout; cmd->dataout_timer_flags &= ~ISCSI_TF_STOP; cmd->dataout_timer_flags |= ISCSI_TF_RUNNING; - add_timer(&cmd->dataout_timer); + mod_timer(&cmd->dataout_timer, jiffies + na->dataout_timeout * HZ); } void iscsit_stop_dataout_timer(struct iscsi_cmd *cmd) |