The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: domen@coderock.org
To: axboe@suse.de
Cc: linux-kernel@vger.kernel.org,
	Marcelo Feitoza Parisi <marcelo@feitoza.com.br>,
	domen@coderock.org
Subject: [patch 1/1] drivers/block/floppy.c : Use of the time_after() and time_before() macros
Date: Sun, 31 Jul 2005 13:10:48 +0200	[thread overview]
Message-ID: <20050731111047.915285000@homer> (raw)

[-- Attachment #1: time_after-drivers_block_floppy --]
[-- Type: text/plain, Size: 1884 bytes --]

From: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>



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 <marcelo@feitoza.com.br>
Signed-off-by: Domen Puncer <domen@coderock.org>

---
 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

--

                 reply	other threads:[~2005-07-31 11:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050731111047.915285000@homer \
    --to=domen@coderock.org \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@feitoza.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox