[PATCH] drivers/scsi/arcmsr/armsr_hba.c: fix "msecs_to_jiffies(6 *

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That's a nonsensical thing, because HZ is already in jiffies.

Presumably it's meant to be a 6s timeout, not a 0.6/1.5/1.8/6 second
timeout (depending on HZ).

Because this is a behaviour change, it needs testing by someone with the
relevant hardware.

There's a second, minor fix: in arcmsr_set_iop_datetime(), let
msecs_to_jiffies() be evaluated at compile time.

That section of code deserves two levels of attention from someone
who understands what it's doing.  First, you might might want to
reword that whole thing in terms of HZ.  And the constant names
are confusing.  ARCMSR_MINUTES is 1 hour, while ARCMSR_HOURS is
4 hours.  E.g.

	next_time = HZ * 60 * 60;	/* 1 hour */
	if (sys_tz.tz_minuteswest)
		next_time *= 4;
	mod_timer(&pacb->refresh_timer, jiffies + next_time);)

Level two would be considering why there are two different timeouts
depending on whether the time zone is GMT or not and whether that's
really justified.

Signed-off-by: George Spelvin <lkml@xxxxxxx>
Cc: Ching Huang <ching2048@xxxxxxxxxxxx>
Cc: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
Cc: "James E.J. Bottomley" <jejb@xxxxxxxxxxxxx>
Cc: linux-scsi@xxxxxxxxxxxxxxx
---
 drivers/scsi/arcmsr/arcmsr_hba.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index db687ef8a99ec..c3a8dbe51b75b 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -916,14 +916,14 @@ static void arcmsr_init_get_devmap_timer(struct AdapterControlBlock *pacb)
 	atomic_set(&pacb->ante_token_value, 16);
 	pacb->fw_flag = FW_NORMAL;
 	timer_setup(&pacb->eternal_timer, arcmsr_request_device_map, 0);
-	pacb->eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ);
+	pacb->eternal_timer.expires = jiffies + 6 * HZ;
 	add_timer(&pacb->eternal_timer);
 }
 
 static void arcmsr_init_set_datetime_timer(struct AdapterControlBlock *pacb)
 {
 	timer_setup(&pacb->refresh_timer, arcmsr_set_iop_datetime, 0);
-	pacb->refresh_timer.expires = jiffies + msecs_to_jiffies(60 * 1000);
+	pacb->refresh_timer.expires = jiffies + 60 * HZ;
 	add_timer(&pacb->refresh_timer);
 }
 
@@ -3746,10 +3746,10 @@ static void arcmsr_set_iop_datetime(struct timer_list *t)
 		}
 	}
 	if (sys_tz.tz_minuteswest)
-		next_time = ARCMSR_HOURS;
+		next_time = msecs_to_jiffies(ARCMSR_HOURS);
 	else
-		next_time = ARCMSR_MINUTES;
-	mod_timer(&pacb->refresh_timer, jiffies + msecs_to_jiffies(next_time));
+		next_time = msecs_to_jiffies(ARCMSR_MINUTES);
+	mod_timer(&pacb->refresh_timer, jiffies + next_time);
 }
 
 static int arcmsr_iop_confirm(struct AdapterControlBlock *acb)
@@ -3968,8 +3968,7 @@ static void arcmsr_request_device_map(struct timer_list *t)
 	if (unlikely(atomic_read(&acb->rq_map_token) == 0) ||
 		(acb->acb_flags & ACB_F_BUS_RESET) ||
 		(acb->acb_flags & ACB_F_ABORT)) {
-		mod_timer(&acb->eternal_timer,
-			jiffies + msecs_to_jiffies(6 * HZ));
+		mod_timer(&acb->eternal_timer, jiffies + 6 * HZ);
 	} else {
 		acb->fw_flag = FW_NORMAL;
 		if (atomic_read(&acb->ante_token_value) ==
@@ -3979,8 +3978,7 @@ static void arcmsr_request_device_map(struct timer_list *t)
 		atomic_set(&acb->ante_token_value,
 			atomic_read(&acb->rq_map_token));
 		if (atomic_dec_and_test(&acb->rq_map_token)) {
-			mod_timer(&acb->eternal_timer, jiffies +
-				msecs_to_jiffies(6 * HZ));
+			mod_timer(&acb->eternal_timer, jiffies + 6 * HZ);
 			return;
 		}
 		switch (acb->adapter_type) {
@@ -4016,7 +4014,7 @@ static void arcmsr_request_device_map(struct timer_list *t)
 			return;
 		}
 		acb->acb_flags |= ACB_F_MSG_GET_CONFIG;
-		mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ));
+		mod_timer(&acb->eternal_timer, jiffies + 6 * HZ);
 	}
 }
 
@@ -4405,8 +4403,7 @@ static int arcmsr_bus_reset(struct scsi_cmnd *cmd)
 		atomic_set(&acb->rq_map_token, 16);
 		atomic_set(&acb->ante_token_value, 16);
 		acb->fw_flag = FW_NORMAL;
-		mod_timer(&acb->eternal_timer, jiffies +
-			msecs_to_jiffies(6 * HZ));
+		mod_timer(&acb->eternal_timer, jiffies + 6 * HZ);
 		acb->acb_flags &= ~ACB_F_BUS_RESET;
 		rtn = SUCCESS;
 		pr_notice("arcmsr: scsi bus reset eh returns with success\n");
@@ -4415,8 +4412,7 @@ static int arcmsr_bus_reset(struct scsi_cmnd *cmd)
 		atomic_set(&acb->rq_map_token, 16);
 		atomic_set(&acb->ante_token_value, 16);
 		acb->fw_flag = FW_NORMAL;
-		mod_timer(&acb->eternal_timer, jiffies +
-			msecs_to_jiffies(6 * HZ));
+		mod_timer(&acb->eternal_timer, jiffies + 6 * HZ);
 		rtn = SUCCESS;
 	}
 	return rtn;
-- 
2.26.0



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux