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

scsi: lpfc: 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: James Smart <james.smart@broadcom.com>
Cc: Dick Kennedy <dick.kennedy@broadcom.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>

+41 -49
+8 -8
drivers/scsi/lpfc/lpfc_crtn.h
··· 113 113 void lpfc_disc_start(struct lpfc_vport *); 114 114 void lpfc_cleanup_discovery_resources(struct lpfc_vport *); 115 115 void lpfc_cleanup(struct lpfc_vport *); 116 - void lpfc_disc_timeout(unsigned long); 116 + void lpfc_disc_timeout(struct timer_list *); 117 117 118 118 int lpfc_unregister_fcf_prep(struct lpfc_hba *); 119 119 struct lpfc_nodelist *__lpfc_findnode_rpi(struct lpfc_vport *, uint16_t); ··· 154 154 int lpfc_els_rsp_prli_acc(struct lpfc_vport *, struct lpfc_iocbq *, 155 155 struct lpfc_nodelist *); 156 156 void lpfc_cancel_retry_delay_tmo(struct lpfc_vport *, struct lpfc_nodelist *); 157 - void lpfc_els_retry_delay(unsigned long); 157 + void lpfc_els_retry_delay(struct timer_list *); 158 158 void lpfc_els_retry_delay_handler(struct lpfc_nodelist *); 159 159 void lpfc_els_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *, 160 160 struct lpfc_iocbq *); ··· 165 165 void lpfc_els_flush_cmd(struct lpfc_vport *); 166 166 int lpfc_els_disc_adisc(struct lpfc_vport *); 167 167 int lpfc_els_disc_plogi(struct lpfc_vport *); 168 - void lpfc_els_timeout(unsigned long); 168 + void lpfc_els_timeout(struct timer_list *); 169 169 void lpfc_els_timeout_handler(struct lpfc_vport *); 170 170 struct lpfc_iocbq *lpfc_prep_els_iocb(struct lpfc_vport *, uint8_t, uint16_t, 171 171 uint8_t, struct lpfc_nodelist *, ··· 180 180 int lpfc_ns_cmd(struct lpfc_vport *, int, uint8_t, uint32_t); 181 181 int lpfc_fdmi_cmd(struct lpfc_vport *, struct lpfc_nodelist *, int, uint32_t); 182 182 void lpfc_fdmi_num_disc_check(struct lpfc_vport *); 183 - void lpfc_delayed_disc_tmo(unsigned long); 183 + void lpfc_delayed_disc_tmo(struct timer_list *); 184 184 void lpfc_delayed_disc_timeout_handler(struct lpfc_vport *); 185 185 186 186 int lpfc_config_port_prep(struct lpfc_hba *); ··· 279 279 void lpfc_mem_free_all(struct lpfc_hba *); 280 280 void lpfc_stop_vport_timers(struct lpfc_vport *); 281 281 282 - void lpfc_poll_timeout(unsigned long ptr); 282 + void lpfc_poll_timeout(struct timer_list *t); 283 283 void lpfc_poll_start_timer(struct lpfc_hba *); 284 - void lpfc_poll_eratt(unsigned long); 284 + void lpfc_poll_eratt(struct timer_list *); 285 285 int 286 286 lpfc_sli_handle_fast_ring_event(struct lpfc_hba *, 287 287 struct lpfc_sli_ring *, uint32_t); ··· 351 351 lpfc_sli_abort_taskmgmt(struct lpfc_vport *, struct lpfc_sli_ring *, 352 352 uint16_t, uint64_t, lpfc_ctx_cmd); 353 353 354 - void lpfc_mbox_timeout(unsigned long); 354 + void lpfc_mbox_timeout(struct timer_list *t); 355 355 void lpfc_mbox_timeout_handler(struct lpfc_hba *); 356 356 357 357 struct lpfc_nodelist *lpfc_findnode_did(struct lpfc_vport *, uint32_t); ··· 445 445 /* Interface exported by fabric iocb scheduler */ 446 446 void lpfc_fabric_abort_nport(struct lpfc_nodelist *); 447 447 void lpfc_fabric_abort_hba(struct lpfc_hba *); 448 - void lpfc_fabric_block_timeout(unsigned long); 448 + void lpfc_fabric_block_timeout(struct timer_list *); 449 449 void lpfc_unblock_fabric_iocbs(struct lpfc_hba *); 450 450 void lpfc_rampdown_queue_depth(struct lpfc_hba *); 451 451 void lpfc_ramp_down_queue_handler(struct lpfc_hba *);
+2 -2
drivers/scsi/lpfc/lpfc_ct.c
··· 2884 2884 * the worker thread. 2885 2885 **/ 2886 2886 void 2887 - lpfc_delayed_disc_tmo(unsigned long ptr) 2887 + lpfc_delayed_disc_tmo(struct timer_list *t) 2888 2888 { 2889 - struct lpfc_vport *vport = (struct lpfc_vport *)ptr; 2889 + struct lpfc_vport *vport = from_timer(vport, t, delayed_disc_tmo); 2890 2890 struct lpfc_hba *phba = vport->phba; 2891 2891 uint32_t tmo_posted; 2892 2892 unsigned long iflag;
+6 -6
drivers/scsi/lpfc/lpfc_els.c
··· 3131 3131 * to the event associated with the ndlp. 3132 3132 **/ 3133 3133 void 3134 - lpfc_els_retry_delay(unsigned long ptr) 3134 + lpfc_els_retry_delay(struct timer_list *t) 3135 3135 { 3136 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) ptr; 3136 + struct lpfc_nodelist *ndlp = from_timer(ndlp, t, nlp_delayfunc); 3137 3137 struct lpfc_vport *vport = ndlp->vport; 3138 3138 struct lpfc_hba *phba = vport->phba; 3139 3139 unsigned long flags; ··· 7385 7385 * lpfc_els_timeout_handler() to work on the posted event WORKER_ELS_TMO. 7386 7386 **/ 7387 7387 void 7388 - lpfc_els_timeout(unsigned long ptr) 7388 + lpfc_els_timeout(struct timer_list *t) 7389 7389 { 7390 - struct lpfc_vport *vport = (struct lpfc_vport *) ptr; 7390 + struct lpfc_vport *vport = from_timer(vport, t, els_tmofunc); 7391 7391 struct lpfc_hba *phba = vport->phba; 7392 7392 uint32_t tmo_posted; 7393 7393 unsigned long iflag; ··· 9017 9017 * posted event WORKER_FABRIC_BLOCK_TMO. 9018 9018 **/ 9019 9019 void 9020 - lpfc_fabric_block_timeout(unsigned long ptr) 9020 + lpfc_fabric_block_timeout(struct timer_list *t) 9021 9021 { 9022 - struct lpfc_hba *phba = (struct lpfc_hba *) ptr; 9022 + struct lpfc_hba *phba = from_timer(phba, t, fabric_block_timer); 9023 9023 unsigned long iflags; 9024 9024 uint32_t tmo_posted; 9025 9025
+3 -4
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 4370 4370 { 4371 4371 INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp); 4372 4372 INIT_LIST_HEAD(&ndlp->dev_loss_evt.evt_listp); 4373 - setup_timer(&ndlp->nlp_delayfunc, lpfc_els_retry_delay, 4374 - (unsigned long)ndlp); 4373 + timer_setup(&ndlp->nlp_delayfunc, lpfc_els_retry_delay, 0); 4375 4374 ndlp->nlp_DID = did; 4376 4375 ndlp->vport = vport; 4377 4376 ndlp->phba = vport->phba; ··· 5507 5508 */ 5508 5509 /*****************************************************************************/ 5509 5510 void 5510 - lpfc_disc_timeout(unsigned long ptr) 5511 + lpfc_disc_timeout(struct timer_list *t) 5511 5512 { 5512 - struct lpfc_vport *vport = (struct lpfc_vport *) ptr; 5513 + struct lpfc_vport *vport = from_timer(vport, t, fc_disctmo); 5513 5514 struct lpfc_hba *phba = vport->phba; 5514 5515 uint32_t tmo_posted; 5515 5516 unsigned long flags = 0;
+16 -23
drivers/scsi/lpfc/lpfc_init.c
··· 1138 1138 * be cleared by the worker thread after it has taken the event bitmap out. 1139 1139 **/ 1140 1140 static void 1141 - lpfc_hb_timeout(unsigned long ptr) 1141 + lpfc_hb_timeout(struct timer_list *t) 1142 1142 { 1143 1143 struct lpfc_hba *phba; 1144 1144 uint32_t tmo_posted; 1145 1145 unsigned long iflag; 1146 1146 1147 - phba = (struct lpfc_hba *)ptr; 1147 + phba = from_timer(phba, t, hb_tmofunc); 1148 1148 1149 1149 /* Check for heart beat timeout conditions */ 1150 1150 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); ··· 1172 1172 * be cleared by the worker thread after it has taken the event bitmap out. 1173 1173 **/ 1174 1174 static void 1175 - lpfc_rrq_timeout(unsigned long ptr) 1175 + lpfc_rrq_timeout(struct timer_list *t) 1176 1176 { 1177 1177 struct lpfc_hba *phba; 1178 1178 unsigned long iflag; 1179 1179 1180 - phba = (struct lpfc_hba *)ptr; 1180 + phba = from_timer(phba, t, rrq_tmr); 1181 1181 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); 1182 1182 if (!(phba->pport->load_flag & FC_UNLOADING)) 1183 1183 phba->hba_flag |= HBA_RRQ_ACTIVE; ··· 3937 3937 INIT_LIST_HEAD(&vport->rcv_buffer_list); 3938 3938 spin_lock_init(&vport->work_port_lock); 3939 3939 3940 - setup_timer(&vport->fc_disctmo, lpfc_disc_timeout, 3941 - (unsigned long)vport); 3940 + timer_setup(&vport->fc_disctmo, lpfc_disc_timeout, 0); 3942 3941 3943 - setup_timer(&vport->els_tmofunc, lpfc_els_timeout, 3944 - (unsigned long)vport); 3942 + timer_setup(&vport->els_tmofunc, lpfc_els_timeout, 0); 3945 3943 3946 - setup_timer(&vport->delayed_disc_tmo, lpfc_delayed_disc_tmo, 3947 - (unsigned long)vport); 3944 + timer_setup(&vport->delayed_disc_tmo, lpfc_delayed_disc_tmo, 0); 3948 3945 3949 3946 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); 3950 3947 if (error) ··· 4207 4210 * worker thread context. 4208 4211 **/ 4209 4212 static void 4210 - lpfc_sli4_fcf_redisc_wait_tmo(unsigned long ptr) 4213 + lpfc_sli4_fcf_redisc_wait_tmo(struct timer_list *t) 4211 4214 { 4212 - struct lpfc_hba *phba = (struct lpfc_hba *)ptr; 4215 + struct lpfc_hba *phba = from_timer(phba, t, fcf.redisc_wait); 4213 4216 4214 4217 /* Don't send FCF rediscovery event if timer cancelled */ 4215 4218 spin_lock_irq(&phba->hbalock); ··· 5621 5624 INIT_LIST_HEAD(&phba->luns); 5622 5625 5623 5626 /* MBOX heartbeat timer */ 5624 - setup_timer(&psli->mbox_tmo, lpfc_mbox_timeout, (unsigned long)phba); 5627 + timer_setup(&psli->mbox_tmo, lpfc_mbox_timeout, 0); 5625 5628 /* Fabric block timer */ 5626 - setup_timer(&phba->fabric_block_timer, lpfc_fabric_block_timeout, 5627 - (unsigned long)phba); 5629 + timer_setup(&phba->fabric_block_timer, lpfc_fabric_block_timeout, 0); 5628 5630 /* EA polling mode timer */ 5629 - setup_timer(&phba->eratt_poll, lpfc_poll_eratt, 5630 - (unsigned long)phba); 5631 + timer_setup(&phba->eratt_poll, lpfc_poll_eratt, 0); 5631 5632 /* Heartbeat timer */ 5632 - setup_timer(&phba->hb_tmofunc, lpfc_hb_timeout, (unsigned long)phba); 5633 + timer_setup(&phba->hb_tmofunc, lpfc_hb_timeout, 0); 5633 5634 5634 5635 return 0; 5635 5636 } ··· 5653 5658 */ 5654 5659 5655 5660 /* FCP polling mode timer */ 5656 - setup_timer(&phba->fcp_poll_timer, lpfc_poll_timeout, 5657 - (unsigned long)phba); 5661 + timer_setup(&phba->fcp_poll_timer, lpfc_poll_timeout, 0); 5658 5662 5659 5663 /* Host attention work mask setup */ 5660 5664 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); ··· 5823 5829 * Initialize timers used by driver 5824 5830 */ 5825 5831 5826 - setup_timer(&phba->rrq_tmr, lpfc_rrq_timeout, (unsigned long)phba); 5832 + timer_setup(&phba->rrq_tmr, lpfc_rrq_timeout, 0); 5827 5833 5828 5834 /* FCF rediscover timer */ 5829 - setup_timer(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 5830 - (unsigned long)phba); 5835 + timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0); 5831 5836 5832 5837 /* 5833 5838 * Control structure for handling external multi-buffer mailbox
+2 -2
drivers/scsi/lpfc/lpfc_scsi.c
··· 4501 4501 * and FCP Ring interrupt is disable. 4502 4502 **/ 4503 4503 4504 - void lpfc_poll_timeout(unsigned long ptr) 4504 + void lpfc_poll_timeout(struct timer_list *t) 4505 4505 { 4506 - struct lpfc_hba *phba = (struct lpfc_hba *) ptr; 4506 + struct lpfc_hba *phba = from_timer(phba, t, fcp_poll_timer); 4507 4507 4508 4508 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { 4509 4509 lpfc_sli_handle_fast_ring_event(phba,
+4 -4
drivers/scsi/lpfc/lpfc_sli.c
··· 3004 3004 * and wake up worker thread to process it. Otherwise, it will set up the 3005 3005 * Error Attention polling timer for the next poll. 3006 3006 **/ 3007 - void lpfc_poll_eratt(unsigned long ptr) 3007 + void lpfc_poll_eratt(struct timer_list *t) 3008 3008 { 3009 3009 struct lpfc_hba *phba; 3010 3010 uint32_t eratt = 0; 3011 3011 uint64_t sli_intr, cnt; 3012 3012 3013 - phba = (struct lpfc_hba *)ptr; 3013 + phba = from_timer(phba, t, eratt_poll); 3014 3014 3015 3015 /* Here we will also keep track of interrupts per sec of the hba */ 3016 3016 sli_intr = phba->sli.slistat.sli_intr; ··· 7167 7167 * done by the worker thread function lpfc_mbox_timeout_handler. 7168 7168 **/ 7169 7169 void 7170 - lpfc_mbox_timeout(unsigned long ptr) 7170 + lpfc_mbox_timeout(struct timer_list *t) 7171 7171 { 7172 - struct lpfc_hba *phba = (struct lpfc_hba *) ptr; 7172 + struct lpfc_hba *phba = from_timer(phba, t, sli.mbox_tmo); 7173 7173 unsigned long iflag; 7174 7174 uint32_t tmo_posted; 7175 7175