diff options
author | Kees Cook <keescook@chromium.org> | 2017-08-18 19:53:24 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-11-01 14:27:07 -0400 |
commit | 738c6ec546aaba5acde6a4e1d2b7f56aec249d62 (patch) | |
tree | 101886b87ce3c7a022b277a7d491105b7f8b9a93 | |
parent | 9a5d04fcbabd20aa06e5624b824c86f7d260cc80 (diff) |
scsi: ipr: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.
Cc: Brian King <brking@us.ibm.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/ipr.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index f838bd73befa..d53429371127 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -694,7 +694,7 @@ static void ipr_init_ipr_cmnd(struct ipr_cmnd *ipr_cmd, | |||
694 | ipr_cmd->sibling = NULL; | 694 | ipr_cmd->sibling = NULL; |
695 | ipr_cmd->eh_comp = NULL; | 695 | ipr_cmd->eh_comp = NULL; |
696 | ipr_cmd->fast_done = fast_done; | 696 | ipr_cmd->fast_done = fast_done; |
697 | init_timer(&ipr_cmd->timer); | 697 | timer_setup(&ipr_cmd->timer, NULL, 0); |
698 | } | 698 | } |
699 | 699 | ||
700 | /** | 700 | /** |
@@ -990,15 +990,14 @@ static void ipr_send_command(struct ipr_cmnd *ipr_cmd) | |||
990 | **/ | 990 | **/ |
991 | static void ipr_do_req(struct ipr_cmnd *ipr_cmd, | 991 | static void ipr_do_req(struct ipr_cmnd *ipr_cmd, |
992 | void (*done) (struct ipr_cmnd *), | 992 | void (*done) (struct ipr_cmnd *), |
993 | void (*timeout_func) (struct ipr_cmnd *), u32 timeout) | 993 | void (*timeout_func) (struct timer_list *), u32 timeout) |
994 | { | 994 | { |
995 | list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); | 995 | list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); |
996 | 996 | ||
997 | ipr_cmd->done = done; | 997 | ipr_cmd->done = done; |
998 | 998 | ||
999 | ipr_cmd->timer.data = (unsigned long) ipr_cmd; | ||
1000 | ipr_cmd->timer.expires = jiffies + timeout; | 999 | ipr_cmd->timer.expires = jiffies + timeout; |
1001 | ipr_cmd->timer.function = (void (*)(unsigned long))timeout_func; | 1000 | ipr_cmd->timer.function = (TIMER_FUNC_TYPE)timeout_func; |
1002 | 1001 | ||
1003 | add_timer(&ipr_cmd->timer); | 1002 | add_timer(&ipr_cmd->timer); |
1004 | 1003 | ||
@@ -1080,7 +1079,7 @@ static void ipr_init_ioadl(struct ipr_cmnd *ipr_cmd, dma_addr_t dma_addr, | |||
1080 | * none | 1079 | * none |
1081 | **/ | 1080 | **/ |
1082 | static void ipr_send_blocking_cmd(struct ipr_cmnd *ipr_cmd, | 1081 | static void ipr_send_blocking_cmd(struct ipr_cmnd *ipr_cmd, |
1083 | void (*timeout_func) (struct ipr_cmnd *ipr_cmd), | 1082 | void (*timeout_func) (struct timer_list *), |
1084 | u32 timeout) | 1083 | u32 timeout) |
1085 | { | 1084 | { |
1086 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | 1085 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
@@ -2664,8 +2663,9 @@ static void ipr_process_error(struct ipr_cmnd *ipr_cmd) | |||
2664 | * Return value: | 2663 | * Return value: |
2665 | * none | 2664 | * none |
2666 | **/ | 2665 | **/ |
2667 | static void ipr_timeout(struct ipr_cmnd *ipr_cmd) | 2666 | static void ipr_timeout(struct timer_list *t) |
2668 | { | 2667 | { |
2668 | struct ipr_cmnd *ipr_cmd = from_timer(ipr_cmd, t, timer); | ||
2669 | unsigned long lock_flags = 0; | 2669 | unsigned long lock_flags = 0; |
2670 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | 2670 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
2671 | 2671 | ||
@@ -2696,8 +2696,9 @@ static void ipr_timeout(struct ipr_cmnd *ipr_cmd) | |||
2696 | * Return value: | 2696 | * Return value: |
2697 | * none | 2697 | * none |
2698 | **/ | 2698 | **/ |
2699 | static void ipr_oper_timeout(struct ipr_cmnd *ipr_cmd) | 2699 | static void ipr_oper_timeout(struct timer_list *t) |
2700 | { | 2700 | { |
2701 | struct ipr_cmnd *ipr_cmd = from_timer(ipr_cmd, t, timer); | ||
2701 | unsigned long lock_flags = 0; | 2702 | unsigned long lock_flags = 0; |
2702 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | 2703 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
2703 | 2704 | ||
@@ -5449,8 +5450,9 @@ static void ipr_bus_reset_done(struct ipr_cmnd *ipr_cmd) | |||
5449 | * Return value: | 5450 | * Return value: |
5450 | * none | 5451 | * none |
5451 | **/ | 5452 | **/ |
5452 | static void ipr_abort_timeout(struct ipr_cmnd *ipr_cmd) | 5453 | static void ipr_abort_timeout(struct timer_list *t) |
5453 | { | 5454 | { |
5455 | struct ipr_cmnd *ipr_cmd = from_timer(ipr_cmd, t, timer); | ||
5454 | struct ipr_cmnd *reset_cmd; | 5456 | struct ipr_cmnd *reset_cmd; |
5455 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | 5457 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
5456 | struct ipr_cmd_pkt *cmd_pkt; | 5458 | struct ipr_cmd_pkt *cmd_pkt; |
@@ -8271,8 +8273,9 @@ static int ipr_ioafp_identify_hrrq(struct ipr_cmnd *ipr_cmd) | |||
8271 | * Return value: | 8273 | * Return value: |
8272 | * none | 8274 | * none |
8273 | **/ | 8275 | **/ |
8274 | static void ipr_reset_timer_done(struct ipr_cmnd *ipr_cmd) | 8276 | static void ipr_reset_timer_done(struct timer_list *t) |
8275 | { | 8277 | { |
8278 | struct ipr_cmnd *ipr_cmd = from_timer(ipr_cmd, t, timer); | ||
8276 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | 8279 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
8277 | unsigned long lock_flags = 0; | 8280 | unsigned long lock_flags = 0; |
8278 | 8281 | ||
@@ -8308,9 +8311,8 @@ static void ipr_reset_start_timer(struct ipr_cmnd *ipr_cmd, | |||
8308 | list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); | 8311 | list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); |
8309 | ipr_cmd->done = ipr_reset_ioa_job; | 8312 | ipr_cmd->done = ipr_reset_ioa_job; |
8310 | 8313 | ||
8311 | ipr_cmd->timer.data = (unsigned long) ipr_cmd; | ||
8312 | ipr_cmd->timer.expires = jiffies + timeout; | 8314 | ipr_cmd->timer.expires = jiffies + timeout; |
8313 | ipr_cmd->timer.function = (void (*)(unsigned long))ipr_reset_timer_done; | 8315 | ipr_cmd->timer.function = (TIMER_FUNC_TYPE)ipr_reset_timer_done; |
8314 | add_timer(&ipr_cmd->timer); | 8316 | add_timer(&ipr_cmd->timer); |
8315 | } | 8317 | } |
8316 | 8318 | ||
@@ -8394,9 +8396,8 @@ static int ipr_reset_next_stage(struct ipr_cmnd *ipr_cmd) | |||
8394 | } | 8396 | } |
8395 | } | 8397 | } |
8396 | 8398 | ||
8397 | ipr_cmd->timer.data = (unsigned long) ipr_cmd; | ||
8398 | ipr_cmd->timer.expires = jiffies + stage_time * HZ; | 8399 | ipr_cmd->timer.expires = jiffies + stage_time * HZ; |
8399 | ipr_cmd->timer.function = (void (*)(unsigned long))ipr_oper_timeout; | 8400 | ipr_cmd->timer.function = (TIMER_FUNC_TYPE)ipr_oper_timeout; |
8400 | ipr_cmd->done = ipr_reset_ioa_job; | 8401 | ipr_cmd->done = ipr_reset_ioa_job; |
8401 | add_timer(&ipr_cmd->timer); | 8402 | add_timer(&ipr_cmd->timer); |
8402 | 8403 | ||
@@ -8466,9 +8467,8 @@ static int ipr_reset_enable_ioa(struct ipr_cmnd *ipr_cmd) | |||
8466 | return IPR_RC_JOB_CONTINUE; | 8467 | return IPR_RC_JOB_CONTINUE; |
8467 | } | 8468 | } |
8468 | 8469 | ||
8469 | ipr_cmd->timer.data = (unsigned long) ipr_cmd; | ||
8470 | ipr_cmd->timer.expires = jiffies + (ioa_cfg->transop_timeout * HZ); | 8470 | ipr_cmd->timer.expires = jiffies + (ioa_cfg->transop_timeout * HZ); |
8471 | ipr_cmd->timer.function = (void (*)(unsigned long))ipr_oper_timeout; | 8471 | ipr_cmd->timer.function = (TIMER_FUNC_TYPE)ipr_oper_timeout; |
8472 | ipr_cmd->done = ipr_reset_ioa_job; | 8472 | ipr_cmd->done = ipr_reset_ioa_job; |
8473 | add_timer(&ipr_cmd->timer); | 8473 | add_timer(&ipr_cmd->timer); |
8474 | list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); | 8474 | list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); |