Skip to contentSkip to conversation

scsi: Switch to use hrtimer_setup()

tip: timers/cleanups tip-bot2 for Nam Cao 1 participant 1 message Feb 18, 2025

Subsystems (3)
lore
Share & tools
lore

tip-bot2 for Nam Cao

author merge bot Applied
#0 lore raw

The following commit has been merged into the timers/cleanups branch of tip:

Commit-ID:     b7011929380d2fce41e9fa7050a1f7f1eb254c2d
Gitweb:        https://git.kernel.org/tip/b7011929380d2fce41e9fa7050a1f7f1eb254c2d
Author:        Nam Cao <[email protected]>
AuthorDate:    Wed, 05 Feb 2025 11:46:01 +01:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Tue, 18 Feb 2025 11:19:03 +01:00

scsi: Switch to use hrtimer_setup()

hrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.

Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.

Patch was created by using Coccinelle.

---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 4 +---
 drivers/scsi/lpfc/lpfc_init.c            | 7 +++----
 drivers/scsi/scsi_debug.c                | 4 ++--
 3 files changed, 6 insertions(+), 9 deletions(-)
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +1 -3
index 16d085d..9e42230 100644
@@ -2922,9 +2922,7 @@ static long ibmvscsis_alloctimer(struct scsi_info *vscsi)
 	struct timer_cb *p_timer;
 
 	p_timer = &vscsi->rsp_q_timer;
-	hrtimer_init(&p_timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-
-	p_timer->timer.function = ibmvscsis_service_wait_q;
+	hrtimer_setup(&p_timer->timer, ibmvscsis_service_wait_q, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	p_timer->started = false;
 	p_timer->timer_pops = 0;
 
drivers/scsi/lpfc/lpfc_init.c +3 -4
index bcadf11..d1ac1d1 100644
@@ -7952,11 +7952,10 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
 	timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0);
 
 	/* CMF congestion timer */
-	hrtimer_init(&phba->cmf_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	phba->cmf_timer.function = lpfc_cmf_timer;
+	hrtimer_setup(&phba->cmf_timer, lpfc_cmf_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	/* CMF 1 minute stats collection timer */
-	hrtimer_init(&phba->cmf_stats_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	phba->cmf_stats_timer.function = lpfc_cmf_stats_timer;
+	hrtimer_setup(&phba->cmf_stats_timer, lpfc_cmf_stats_timer, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	/*
 	 * Control structure for handling external multi-buffer mailbox
drivers/scsi/scsi_debug.c +2 -2
index 5ceaa46..fe5c30b 100644
@@ -6384,8 +6384,8 @@ static struct sdebug_queued_cmd *sdebug_alloc_queued_cmd(struct scsi_cmnd *scmd)
 
 	sd_dp = &sqcp->sd_dp;
 
-	hrtimer_init(&sd_dp->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
-	sd_dp->hrt.function = sdebug_q_cmd_hrt_complete;
+	hrtimer_setup(&sd_dp->hrt, sdebug_q_cmd_hrt_complete, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL_PINNED);
 	INIT_WORK(&sd_dp->ew.work, sdebug_q_cmd_wq_complete);
 
 	sqcp->scmd = scmd;