aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-10-22 18:15:33 -0400
committerKees Cook <keescook@chromium.org>2017-11-01 14:27:04 -0400
commitfa60a31b0cf07794d643924328cd7e3a78e99aca (patch)
treeee6a3a1bfe2a7cfc034d9e1a6a70d37c5b76cf99
parent8c4602f3c147caaecf33adf3aaf0c5bc84c6b409 (diff)
scsi: csiostor: 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: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com> Cc: Varun Prakash <varun@chelsio.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> 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/csiostor/csio_hw.c15
-rw-r--r--drivers/scsi/csiostor/csio_mb.c9
-rw-r--r--drivers/scsi/csiostor/csio_mb.h3
3 files changed, 11 insertions, 16 deletions
diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c
index 5be0086142ca..0bd1131b6cc9 100644
--- a/drivers/scsi/csiostor/csio_hw.c
+++ b/drivers/scsi/csiostor/csio_hw.c
@@ -3347,9 +3347,10 @@ csio_mberr_worker(void *data)
3347 * 3347 *
3348 **/ 3348 **/
3349static void 3349static void
3350csio_hw_mb_timer(uintptr_t data) 3350csio_hw_mb_timer(struct timer_list *t)
3351{ 3351{
3352 struct csio_hw *hw = (struct csio_hw *)data; 3352 struct csio_mbm *mbm = from_timer(mbm, t, timer);
3353 struct csio_hw *hw = mbm->hw;
3353 struct csio_mb *mbp = NULL; 3354 struct csio_mb *mbp = NULL;
3354 3355
3355 spin_lock_irq(&hw->lock); 3356 spin_lock_irq(&hw->lock);
@@ -3715,9 +3716,9 @@ csio_mgmt_req_lookup(struct csio_mgmtm *mgmtm, struct csio_ioreq *io_req)
3715 * Return - none. 3716 * Return - none.
3716 */ 3717 */
3717static void 3718static void
3718csio_mgmt_tmo_handler(uintptr_t data) 3719csio_mgmt_tmo_handler(struct timer_list *t)
3719{ 3720{
3720 struct csio_mgmtm *mgmtm = (struct csio_mgmtm *) data; 3721 struct csio_mgmtm *mgmtm = from_timer(mgmtm, t, mgmt_timer);
3721 struct list_head *tmp; 3722 struct list_head *tmp;
3722 struct csio_ioreq *io_req; 3723 struct csio_ioreq *io_req;
3723 3724
@@ -3797,11 +3798,7 @@ csio_mgmtm_cleanup(struct csio_mgmtm *mgmtm)
3797static int 3798static int
3798csio_mgmtm_init(struct csio_mgmtm *mgmtm, struct csio_hw *hw) 3799csio_mgmtm_init(struct csio_mgmtm *mgmtm, struct csio_hw *hw)
3799{ 3800{
3800 struct timer_list *timer = &mgmtm->mgmt_timer; 3801 timer_setup(&mgmtm->mgmt_timer, csio_mgmt_tmo_handler, 0);
3801
3802 init_timer(timer);
3803 timer->function = csio_mgmt_tmo_handler;
3804 timer->data = (unsigned long)mgmtm;
3805 3802
3806 INIT_LIST_HEAD(&mgmtm->active_q); 3803 INIT_LIST_HEAD(&mgmtm->active_q);
3807 INIT_LIST_HEAD(&mgmtm->cbfn_q); 3804 INIT_LIST_HEAD(&mgmtm->cbfn_q);
diff --git a/drivers/scsi/csiostor/csio_mb.c b/drivers/scsi/csiostor/csio_mb.c
index 9451787ca7f2..abcedfbcecda 100644
--- a/drivers/scsi/csiostor/csio_mb.c
+++ b/drivers/scsi/csiostor/csio_mb.c
@@ -1644,13 +1644,10 @@ csio_mb_cancel_all(struct csio_hw *hw, struct list_head *cbfn_q)
1644 */ 1644 */
1645int 1645int
1646csio_mbm_init(struct csio_mbm *mbm, struct csio_hw *hw, 1646csio_mbm_init(struct csio_mbm *mbm, struct csio_hw *hw,
1647 void (*timer_fn)(uintptr_t)) 1647 void (*timer_fn)(struct timer_list *))
1648{ 1648{
1649 struct timer_list *timer = &mbm->timer; 1649 mbm->hw = hw;
1650 1650 timer_setup(&mbm->timer, timer_fn, 0);
1651 init_timer(timer);
1652 timer->function = timer_fn;
1653 timer->data = (unsigned long)hw;
1654 1651
1655 INIT_LIST_HEAD(&mbm->req_q); 1652 INIT_LIST_HEAD(&mbm->req_q);
1656 INIT_LIST_HEAD(&mbm->cbfn_q); 1653 INIT_LIST_HEAD(&mbm->cbfn_q);
diff --git a/drivers/scsi/csiostor/csio_mb.h b/drivers/scsi/csiostor/csio_mb.h
index 1bc82d0bc260..a6823df73015 100644
--- a/drivers/scsi/csiostor/csio_mb.h
+++ b/drivers/scsi/csiostor/csio_mb.h
@@ -137,6 +137,7 @@ struct csio_mbm {
137 uint32_t a_mbox; /* Async mbox num */ 137 uint32_t a_mbox; /* Async mbox num */
138 uint32_t intr_idx; /* Interrupt index */ 138 uint32_t intr_idx; /* Interrupt index */
139 struct timer_list timer; /* Mbox timer */ 139 struct timer_list timer; /* Mbox timer */
140 struct csio_hw *hw; /* Hardware pointer */
140 struct list_head req_q; /* Mbox request queue */ 141 struct list_head req_q; /* Mbox request queue */
141 struct list_head cbfn_q; /* Mbox completion q */ 142 struct list_head cbfn_q; /* Mbox completion q */
142 struct csio_mb *mcurrent; /* Current mailbox */ 143 struct csio_mb *mcurrent; /* Current mailbox */
@@ -252,7 +253,7 @@ void csio_mb_process_portparams_rsp(struct csio_hw *hw, struct csio_mb *mbp,
252 253
253/* MB module functions */ 254/* MB module functions */
254int csio_mbm_init(struct csio_mbm *, struct csio_hw *, 255int csio_mbm_init(struct csio_mbm *, struct csio_hw *,
255 void (*)(uintptr_t)); 256 void (*)(struct timer_list *));
256void csio_mbm_exit(struct csio_mbm *); 257void csio_mbm_exit(struct csio_mbm *);
257void csio_mb_intr_enable(struct csio_hw *); 258void csio_mb_intr_enable(struct csio_hw *);
258void csio_mb_intr_disable(struct csio_hw *); 259void csio_mb_intr_disable(struct csio_hw *);