From: Marcelo Feitoza Parisi <[email protected]>
Use of the time_after() and time_before() macros, defined at linux/jiffies.h,
which deal with wrapping correctly and are nicer to read.
Signed-off-by: Marcelo Feitoza Parisi <[email protected]>
Signed-off-by: Domen Puncer <[email protected]>
---
floppy.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
Index: quilt/drivers/block/floppy.c
===================================================================
--- quilt.orig/drivers/block/floppy.c
+++ quilt/drivers/block/floppy.c
@@ -179,6 +179,7 @@ static int print_unex = 1;
#include <linux/devfs_fs_kernel.h>
#include <linux/device.h>
#include <linux/buffer_head.h> /* for invalidate_buffers() */
+#include <linux/jiffies.h> /* for time_before() */
/*
* PS/2 floppies have much slower step rates than regular floppies.
@@ -733,7 +734,7 @@ static int disk_change(int drive)
{
int fdc = FDC(drive);
#ifdef FLOPPY_SANITY_CHECK
- if (jiffies - UDRS->select_date < UDP->select_delay)
+ if (time_before(jiffies, UDRS->select_date + UDP->select_delay))
DPRINT("WARNING disk change called early\n");
if (!(FDCS->dor & (0x10 << UNIT(drive))) ||
(FDCS->dor & 3) != UNIT(drive) || fdc != FDC(drive)) {
@@ -1061,7 +1062,7 @@ static int fd_wait_for_completion(unsign
return 1;
}
- if ((signed)(jiffies - delay) < 0) {
+ if (time_before(jiffies, delay)) {
del_timer(&fd_timer);
fd_timer.function = function;
fd_timer.expires = delay;
@@ -1521,7 +1522,7 @@ static void setup_rw_floppy(void)
* again just before spinup completion. Beware that
* after scandrives, we must again wait for selection.
*/
- if ((signed)(ready_date - jiffies) > DP->select_delay) {
+ if (time_after(ready_date, jiffies + DP->select_delay)) {
ready_date -= DP->select_delay;
function = (timeout_fn) floppy_start;
} else
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|