Commit b3dafee7 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Covert drivers to use msec_to_jiffies

Remove various private implementations of msecs_to_jiffies() and
jiffies_to_msecs().

There are various uppercase versions which should be consolidated.
parent 5b59eadf
...@@ -438,11 +438,6 @@ static int carm_bdev_ioctl(struct inode *ino, struct file *fil, ...@@ -438,11 +438,6 @@ static int carm_bdev_ioctl(struct inode *ino, struct file *fil,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static inline unsigned long msecs_to_jiffies(unsigned long msecs)
{
return ((HZ * msecs + 999) / 1000);
}
static void msleep(unsigned long msecs) static void msleep(unsigned long msecs)
{ {
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
......
...@@ -357,16 +357,6 @@ static ssize_t disk_size_read(struct gendisk * disk, char *page) ...@@ -357,16 +357,6 @@ static ssize_t disk_size_read(struct gendisk * disk, char *page)
return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk)); return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk));
} }
static inline unsigned jiffies_to_msec(unsigned jif)
{
#if 1000 % HZ == 0
return jif * (1000 / HZ);
#elif HZ % 1000 == 0
return jif / (HZ / 1000);
#else
return (jif / HZ) * 1000 + (jif % HZ) * 1000 / HZ;
#endif
}
static ssize_t disk_stats_read(struct gendisk * disk, char *page) static ssize_t disk_stats_read(struct gendisk * disk, char *page)
{ {
disk_round_stats(disk); disk_round_stats(disk);
...@@ -377,14 +367,14 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page) ...@@ -377,14 +367,14 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page)
"\n", "\n",
disk_stat_read(disk, reads), disk_stat_read(disk, read_merges), disk_stat_read(disk, reads), disk_stat_read(disk, read_merges),
(unsigned long long)disk_stat_read(disk, read_sectors), (unsigned long long)disk_stat_read(disk, read_sectors),
jiffies_to_msec(disk_stat_read(disk, read_ticks)), jiffies_to_msecs(disk_stat_read(disk, read_ticks)),
disk_stat_read(disk, writes), disk_stat_read(disk, writes),
disk_stat_read(disk, write_merges), disk_stat_read(disk, write_merges),
(unsigned long long)disk_stat_read(disk, write_sectors), (unsigned long long)disk_stat_read(disk, write_sectors),
jiffies_to_msec(disk_stat_read(disk, write_ticks)), jiffies_to_msecs(disk_stat_read(disk, write_ticks)),
disk->in_flight, disk->in_flight,
jiffies_to_msec(disk_stat_read(disk, io_ticks)), jiffies_to_msecs(disk_stat_read(disk, io_ticks)),
jiffies_to_msec(disk_stat_read(disk, time_in_queue))); jiffies_to_msecs(disk_stat_read(disk, time_in_queue)));
} }
static struct disk_attribute disk_attr_dev = { static struct disk_attribute disk_attr_dev = {
.attr = {.name = "dev", .mode = S_IRUGO }, .attr = {.name = "dev", .mode = S_IRUGO },
...@@ -498,13 +488,13 @@ static int diskstats_show(struct seq_file *s, void *v) ...@@ -498,13 +488,13 @@ static int diskstats_show(struct seq_file *s, void *v)
gp->major, n + gp->first_minor, disk_name(gp, n, buf), gp->major, n + gp->first_minor, disk_name(gp, n, buf),
disk_stat_read(gp, reads), disk_stat_read(gp, read_merges), disk_stat_read(gp, reads), disk_stat_read(gp, read_merges),
(unsigned long long)disk_stat_read(gp, read_sectors), (unsigned long long)disk_stat_read(gp, read_sectors),
jiffies_to_msec(disk_stat_read(gp, read_ticks)), jiffies_to_msecs(disk_stat_read(gp, read_ticks)),
disk_stat_read(gp, writes), disk_stat_read(gp, write_merges), disk_stat_read(gp, writes), disk_stat_read(gp, write_merges),
(unsigned long long)disk_stat_read(gp, write_sectors), (unsigned long long)disk_stat_read(gp, write_sectors),
jiffies_to_msec(disk_stat_read(gp, write_ticks)), jiffies_to_msecs(disk_stat_read(gp, write_ticks)),
gp->in_flight, gp->in_flight,
jiffies_to_msec(disk_stat_read(gp, io_ticks)), jiffies_to_msecs(disk_stat_read(gp, io_ticks)),
jiffies_to_msec(disk_stat_read(gp, time_in_queue))); jiffies_to_msecs(disk_stat_read(gp, time_in_queue)));
/* now show all non-0 size partitions of it */ /* now show all non-0 size partitions of it */
for (n = 0; n < gp->minors - 1; n++) { for (n = 0; n < gp->minors - 1; n++) {
......
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
*/ */
static int clock_division_ratio = WTCSR_CKS_4096; static int clock_division_ratio = WTCSR_CKS_4096;
#define msecs_to_jiffies(msecs) (jiffies + (HZ * msecs + 9999) / 10000)
#define next_ping_period(cks) msecs_to_jiffies(cks - 4) #define next_ping_period(cks) msecs_to_jiffies(cks - 4)
static unsigned long shwdt_is_open; static unsigned long shwdt_is_open;
......
...@@ -357,13 +357,6 @@ static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x6F3F, 0x6F3D, }; ...@@ -357,13 +357,6 @@ static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x6F3F, 0x6F3D, };
static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
static inline unsigned long
msec_to_jiffies(unsigned long ms)
{
return (((ms)*HZ+999)/1000);
}
#define dr32(reg) readl(de->regs + (reg)) #define dr32(reg) readl(de->regs + (reg))
#define dw32(reg,val) writel((val), de->regs + (reg)) #define dw32(reg,val) writel((val), de->regs + (reg))
...@@ -1216,7 +1209,7 @@ static void de_adapter_wake (struct de_private *de) ...@@ -1216,7 +1209,7 @@ static void de_adapter_wake (struct de_private *de)
/* de4x5.c delays, so we do too */ /* de4x5.c delays, so we do too */
current->state = TASK_UNINTERRUPTIBLE; current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout(msec_to_jiffies(10)); schedule_timeout(msecs_to_jiffies(10));
} }
} }
......
...@@ -408,11 +408,6 @@ extern int ata_std_bios_param(struct scsi_device *sdev, ...@@ -408,11 +408,6 @@ extern int ata_std_bios_param(struct scsi_device *sdev,
extern int ata_scsi_slave_config(struct scsi_device *sdev); extern int ata_scsi_slave_config(struct scsi_device *sdev);
static inline unsigned long msecs_to_jiffies(unsigned long msecs)
{
return ((HZ * msecs + 999) / 1000);
}
static inline unsigned int ata_tag_valid(unsigned int tag) static inline unsigned int ata_tag_valid(unsigned int tag)
{ {
return (tag < ATA_MAX_QUEUE) ? 1 : 0; return (tag < ATA_MAX_QUEUE) ? 1 : 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment