diff --git a/iscsi-scst/kernel/conn.c b/iscsi-scst/kernel/conn.c index 3b3fcc511..0b5462856 100644 --- a/iscsi-scst/kernel/conn.c +++ b/iscsi-scst/kernel/conn.c @@ -579,9 +579,9 @@ static void iscsi_write_space_ready(struct sock *sk) return; } -static void conn_rsp_timer_fn(unsigned long arg) +static void conn_rsp_timer_fn(struct timer_list *timer) { - struct iscsi_conn *conn = (struct iscsi_conn *)arg; + struct iscsi_conn *conn = container_of(timer, typeof(*conn), rsp_timer); struct iscsi_cmnd *cmnd; unsigned long j = jiffies; @@ -952,7 +952,7 @@ int iscsi_init_conn(struct iscsi_session *session, spin_lock_init(&conn->write_list_lock); INIT_LIST_HEAD(&conn->write_list); INIT_LIST_HEAD(&conn->write_timeout_list); - setup_timer(&conn->rsp_timer, conn_rsp_timer_fn, (unsigned long)conn); + timer_setup(&conn->rsp_timer, conn_rsp_timer_fn, 0); init_waitqueue_head(&conn->read_state_waitQ); init_completion(&conn->ready_to_free); INIT_LIST_HEAD(&conn->reinst_pending_cmd_list); diff --git a/iscsi-scst/kernel/isert-scst/isert_login.c b/iscsi-scst/kernel/isert-scst/isert_login.c index 115c297bd..c367fc7bf 100644 --- a/iscsi-scst/kernel/isert-scst/isert_login.c +++ b/iscsi-scst/kernel/isert-scst/isert_login.c @@ -135,9 +135,10 @@ static void isert_close_conn_fn(struct work_struct *work) isert_close_connection(conn); } -static void isert_conn_timer_fn(unsigned long arg) +static void isert_conn_timer_fn(struct timer_list *timer) { - struct isert_conn_dev *conn_dev = (struct isert_conn_dev *)arg; + struct isert_conn_dev *conn_dev = container_of(timer, typeof(*conn_dev), + tmo_timer); struct iscsi_conn *conn = conn_dev->conn; TRACE_ENTRY(); @@ -171,8 +172,7 @@ static int add_new_connection(struct isert_listener_dev *dev, INIT_WORK(&conn->close_work, isert_close_conn_fn); #endif - setup_timer(&conn_dev->tmo_timer, isert_conn_timer_fn, - (unsigned long)conn_dev); + timer_setup(&conn_dev->tmo_timer, isert_conn_timer_fn, 0); conn_dev->tmo_timer.expires = jiffies + 60 * HZ; add_timer(&conn_dev->tmo_timer); conn_dev->timer_active = 1; diff --git a/qla2x00t/qla_init.c b/qla2x00t/qla_init.c index 69bdaa297..410e3cc85 100644 --- a/qla2x00t/qla_init.c +++ b/qla2x00t/qla_init.c @@ -43,10 +43,9 @@ int qla24xx_update_fcport_fcp_prio(scsi_qla_host_t *, fc_port_t *); /* SRB Extensions ---------------------------------------------------------- */ -void -qla2x00_sp_timeout(unsigned long __data) +void qla2x00_sp_timeout(struct timer_list *timer) { - srb_t *sp = (srb_t *)__data; + srb_t *sp = container_of(timer, typeof(*sp), u.iocb_cmd.timer); struct srb_iocb *iocb; fc_port_t *fcport = sp->fcport; struct qla_hw_data *ha = fcport->vha->hw; diff --git a/qla2x00t/qla_inline.h b/qla2x00t/qla_inline.h index 03ad04c2b..e73c3a8f4 100644 --- a/qla2x00t/qla_inline.h +++ b/qla2x00t/qla_inline.h @@ -171,8 +171,7 @@ done: static inline void qla2x00_init_timer(srb_t *sp, unsigned long tmo) { - setup_timer(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, - (unsigned long)sp); + timer_setup(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, 0); sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ; add_timer(&sp->u.iocb_cmd.timer); sp->free = qla2x00_sp_free; diff --git a/scst/include/backport.h b/scst/include/backport.h index 88f5fa971..d06230ee4 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -680,6 +680,21 @@ struct t10_pi_tuple { }; #endif +/* */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) +/* + * See also commit 686fef928bba ("timer: Prepare to change timer callback + * argument type"). + */ +#define timer_setup(_timer, _fn, _flags) do { \ + init_timer(_timer); \ + (_timer)->function = (void (*)(unsigned long))(_fn); \ + (_timer)->data = (unsigned long)(_timer); \ + (_timer)->flags = (_flags); \ +} while (0) +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 4b051f74a..65fd4c1a4 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -1685,7 +1685,7 @@ static void scst_release_space(struct scst_cmd *cmd); static void scst_clear_reservation(struct scst_tgt_dev *tgt_dev); static int scst_alloc_add_tgt_dev(struct scst_session *sess, struct scst_acg_dev *acg_dev, struct scst_tgt_dev **out_tgt_dev); -static void scst_tgt_retry_timer_fn(unsigned long arg); +static void scst_tgt_retry_timer_fn(struct timer_list *timer); #ifdef CONFIG_SCST_DEBUG_TM static void tm_dbg_init_tgt_dev(struct scst_tgt_dev *tgt_dev); @@ -4091,7 +4091,7 @@ int scst_alloc_tgt(struct scst_tgt_template *tgtt, struct scst_tgt **tgt) t->tgt_supported_dif_block_sizes = tgtt->supported_dif_block_sizes; spin_lock_init(&t->tgt_lock); INIT_LIST_HEAD(&t->retry_cmd_list); - setup_timer(&t->retry_timer, scst_tgt_retry_timer_fn, (unsigned long)t); + timer_setup(&t->retry_timer, scst_tgt_retry_timer_fn, 0); atomic_set(&t->tgt_dif_app_failed_tgt, 0); atomic_set(&t->tgt_dif_ref_failed_tgt, 0); atomic_set(&t->tgt_dif_guard_failed_tgt, 0); @@ -7480,9 +7480,9 @@ void scst_check_retries(struct scst_tgt *tgt) return; } -static void scst_tgt_retry_timer_fn(unsigned long arg) +static void scst_tgt_retry_timer_fn(struct timer_list *timer) { - struct scst_tgt *tgt = (struct scst_tgt *)arg; + struct scst_tgt *tgt = container_of(timer, typeof(*tgt), retry_timer); unsigned long flags; TRACE_RETRY("Retry timer expired (retry_cmds %d)", tgt->retry_cmds);