Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: ibmvscsi: 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: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: linux-scsi@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

+9 -12
+6 -8
drivers/scsi/ibmvscsi/ibmvfc.c
··· 1393 1393 * 1394 1394 * Called when an internally generated command times out 1395 1395 **/ 1396 - static void ibmvfc_timeout(struct ibmvfc_event *evt) 1396 + static void ibmvfc_timeout(struct timer_list *t) 1397 1397 { 1398 + struct ibmvfc_event *evt = from_timer(evt, t, timer); 1398 1399 struct ibmvfc_host *vhost = evt->vhost; 1399 1400 dev_err(vhost->dev, "Command timed out (%p). Resetting connection\n", evt); 1400 1401 ibmvfc_reset_host(vhost); ··· 1425 1424 BUG(); 1426 1425 1427 1426 list_add_tail(&evt->queue, &vhost->sent); 1428 - init_timer(&evt->timer); 1427 + timer_setup(&evt->timer, ibmvfc_timeout, 0); 1429 1428 1430 1429 if (timeout) { 1431 - evt->timer.data = (unsigned long) evt; 1432 1430 evt->timer.expires = jiffies + (timeout * HZ); 1433 - evt->timer.function = (void (*)(unsigned long))ibmvfc_timeout; 1434 1431 add_timer(&evt->timer); 1435 1432 } 1436 1433 ··· 3691 3692 * out, reset the CRQ. When the ADISC comes back as cancelled, 3692 3693 * log back into the target. 3693 3694 **/ 3694 - static void ibmvfc_adisc_timeout(struct ibmvfc_target *tgt) 3695 + static void ibmvfc_adisc_timeout(struct timer_list *t) 3695 3696 { 3697 + struct ibmvfc_target *tgt = from_timer(tgt, t, timer); 3696 3698 struct ibmvfc_host *vhost = tgt->vhost; 3697 3699 struct ibmvfc_event *evt; 3698 3700 struct ibmvfc_tmf *tmf; ··· 3778 3778 if (timer_pending(&tgt->timer)) 3779 3779 mod_timer(&tgt->timer, jiffies + (IBMVFC_ADISC_TIMEOUT * HZ)); 3780 3780 else { 3781 - tgt->timer.data = (unsigned long) tgt; 3782 3781 tgt->timer.expires = jiffies + (IBMVFC_ADISC_TIMEOUT * HZ); 3783 - tgt->timer.function = (void (*)(unsigned long))ibmvfc_adisc_timeout; 3784 3782 add_timer(&tgt->timer); 3785 3783 } 3786 3784 ··· 3910 3912 tgt->vhost = vhost; 3911 3913 tgt->need_login = 1; 3912 3914 tgt->cancel_key = vhost->task_set++; 3913 - init_timer(&tgt->timer); 3915 + timer_setup(&tgt->timer, ibmvfc_adisc_timeout, 0); 3914 3916 kref_init(&tgt->kref); 3915 3917 ibmvfc_init_tgt(tgt, ibmvfc_tgt_implicit_logout); 3916 3918 spin_lock_irqsave(vhost->host->host_lock, flags);
+3 -4
drivers/scsi/ibmvscsi/ibmvscsi.c
··· 837 837 * 838 838 * Called when an internally generated command times out 839 839 */ 840 - static void ibmvscsi_timeout(struct srp_event_struct *evt_struct) 840 + static void ibmvscsi_timeout(struct timer_list *t) 841 841 { 842 + struct srp_event_struct *evt_struct = from_timer(evt_struct, t, timer); 842 843 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata; 843 844 844 845 dev_err(hostdata->dev, "Command timed out (%x). Resetting connection\n", ··· 928 927 */ 929 928 list_add_tail(&evt_struct->list, &hostdata->sent); 930 929 931 - init_timer(&evt_struct->timer); 930 + timer_setup(&evt_struct->timer, ibmvscsi_timeout, 0); 932 931 if (timeout) { 933 - evt_struct->timer.data = (unsigned long) evt_struct; 934 932 evt_struct->timer.expires = jiffies + (timeout * HZ); 935 - evt_struct->timer.function = (void (*)(unsigned long))ibmvscsi_timeout; 936 933 add_timer(&evt_struct->timer); 937 934 } 938 935