diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-11 19:25:40 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-10-27 05:22:00 -0400 |
commit | 2c4b9637b69cab846d8c443bf6775356321950c4 (patch) | |
tree | ac26c87d36f52b00a79352e4a9512eaac0a63c1e | |
parent | 1f0849dac19ba35087e7a2056dde8206aa23c5e7 (diff) |
scsi: libiscsi: 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: Lee Duncan <lduncan@suse.com>
Cc: Chris Leech <cleech@redhat.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: open-iscsi@googlegroups.com
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Chris Leech <cleech@redhat.com>
-rw-r--r-- | drivers/scsi/libiscsi.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index bd4605a34f54..af59192cc578 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1805,9 +1805,9 @@ int iscsi_target_alloc(struct scsi_target *starget) | |||
1805 | } | 1805 | } |
1806 | EXPORT_SYMBOL_GPL(iscsi_target_alloc); | 1806 | EXPORT_SYMBOL_GPL(iscsi_target_alloc); |
1807 | 1807 | ||
1808 | static void iscsi_tmf_timedout(unsigned long data) | 1808 | static void iscsi_tmf_timedout(struct timer_list *t) |
1809 | { | 1809 | { |
1810 | struct iscsi_conn *conn = (struct iscsi_conn *)data; | 1810 | struct iscsi_conn *conn = from_timer(conn, t, tmf_timer); |
1811 | struct iscsi_session *session = conn->session; | 1811 | struct iscsi_session *session = conn->session; |
1812 | 1812 | ||
1813 | spin_lock(&session->frwd_lock); | 1813 | spin_lock(&session->frwd_lock); |
@@ -1838,8 +1838,6 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, | |||
1838 | } | 1838 | } |
1839 | conn->tmfcmd_pdus_cnt++; | 1839 | conn->tmfcmd_pdus_cnt++; |
1840 | conn->tmf_timer.expires = timeout * HZ + jiffies; | 1840 | conn->tmf_timer.expires = timeout * HZ + jiffies; |
1841 | conn->tmf_timer.function = iscsi_tmf_timedout; | ||
1842 | conn->tmf_timer.data = (unsigned long)conn; | ||
1843 | add_timer(&conn->tmf_timer); | 1841 | add_timer(&conn->tmf_timer); |
1844 | ISCSI_DBG_EH(session, "tmf set timeout\n"); | 1842 | ISCSI_DBG_EH(session, "tmf set timeout\n"); |
1845 | 1843 | ||
@@ -2089,9 +2087,9 @@ done: | |||
2089 | } | 2087 | } |
2090 | EXPORT_SYMBOL_GPL(iscsi_eh_cmd_timed_out); | 2088 | EXPORT_SYMBOL_GPL(iscsi_eh_cmd_timed_out); |
2091 | 2089 | ||
2092 | static void iscsi_check_transport_timeouts(unsigned long data) | 2090 | static void iscsi_check_transport_timeouts(struct timer_list *t) |
2093 | { | 2091 | { |
2094 | struct iscsi_conn *conn = (struct iscsi_conn *)data; | 2092 | struct iscsi_conn *conn = from_timer(conn, t, transport_timer); |
2095 | struct iscsi_session *session = conn->session; | 2093 | struct iscsi_session *session = conn->session; |
2096 | unsigned long recv_timeout, next_timeout = 0, last_recv; | 2094 | unsigned long recv_timeout, next_timeout = 0, last_recv; |
2097 | 2095 | ||
@@ -2913,9 +2911,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, | |||
2913 | conn->exp_statsn = 0; | 2911 | conn->exp_statsn = 0; |
2914 | conn->tmf_state = TMF_INITIAL; | 2912 | conn->tmf_state = TMF_INITIAL; |
2915 | 2913 | ||
2916 | init_timer(&conn->transport_timer); | 2914 | timer_setup(&conn->transport_timer, iscsi_check_transport_timeouts, 0); |
2917 | conn->transport_timer.data = (unsigned long)conn; | ||
2918 | conn->transport_timer.function = iscsi_check_transport_timeouts; | ||
2919 | 2915 | ||
2920 | INIT_LIST_HEAD(&conn->mgmtqueue); | 2916 | INIT_LIST_HEAD(&conn->mgmtqueue); |
2921 | INIT_LIST_HEAD(&conn->cmdqueue); | 2917 | INIT_LIST_HEAD(&conn->cmdqueue); |
@@ -2939,7 +2935,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, | |||
2939 | goto login_task_data_alloc_fail; | 2935 | goto login_task_data_alloc_fail; |
2940 | conn->login_task->data = conn->data = data; | 2936 | conn->login_task->data = conn->data = data; |
2941 | 2937 | ||
2942 | init_timer(&conn->tmf_timer); | 2938 | timer_setup(&conn->tmf_timer, iscsi_tmf_timedout, 0); |
2943 | init_waitqueue_head(&conn->ehwait); | 2939 | init_waitqueue_head(&conn->ehwait); |
2944 | 2940 | ||
2945 | return cls_conn; | 2941 | return cls_conn; |