[PATCH 01/12] libata: add msec_to_jiffies()

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

 



Add msec_to_jiffies() to drivers/scsi/libata.h and use it in
ata_wait_register().

Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>

---

 drivers/scsi/libata-core.c |    2 +-
 drivers/scsi/libata.h      |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

017cbbd4749d4f40fca7764281dd8283c562ae4c
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index d8c3bed..61db4f5 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -5904,7 +5904,7 @@ u32 ata_wait_register(void __iomem *reg,
 	 * preceding writes reach the controller before starting to
 	 * eat away the timeout.
 	 */
-	timeout = jiffies + (timeout_msec * HZ) / 1000;
+	timeout = jiffies + msec_to_jiffies(timeout_msec);
 
 	while ((tmp & mask) == val && time_before(jiffies, timeout)) {
 		msleep(interval_msec);
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index c325679..e2fa600 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -38,6 +38,11 @@ struct ata_scsi_args {
 	void			(*done)(struct scsi_cmnd *);
 };
 
+static inline unsigned long msec_to_jiffies(unsigned long ms)
+{
+	return (ms * HZ + 999) / 1000;
+}
+
 /* libata-core.c */
 extern struct workqueue_struct *ata_aux_wq;
 extern int atapi_enabled;
-- 
1.3.2


-
: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux