mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: akpm <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, zwane@linuxpower.ca
Subject: [PATCH] floppy98.c: use kernel min/max
Date: Sun, 18 Apr 2004 19:51:31 -0700	[thread overview]
Message-ID: <20040418195131.7133cb0f.rddunlap@osdl.org> (raw)
In-Reply-To: <20040418194357.4cd02a06.rddunlap@osdl.org>


Convert floppy98.c to use kernel min/max, like floppy.c.


diffstat:=
 drivers/block/floppy98.c |   28 ++++++----------------------
 1 files changed, 6 insertions(+), 22 deletions(-)


diff -Naurp ./drivers/block/floppy98.c~fd98_minmax ./drivers/block/floppy98.c
--- ./drivers/block/floppy98.c~fd98_minmax	2004-04-18 17:54:42.000000000 -0700
+++ ./drivers/block/floppy98.c	2004-04-18 18:12:38.000000000 -0700
@@ -720,25 +720,9 @@ static void reschedule_timeout(int drive
 	timeout_message = message;
 }
 
-static int maximum(int a, int b)
-{
-	if (a > b)
-		return a;
-	else
-		return b;
-}
-
-#define INFBOUND(a,b) (a)=maximum((a),(b));
-
-static int minimum(int a, int b)
-{
-	if (a < b)
-		return a;
-	else
-		return b;
-}
+#define INFBOUND(a,b) (a)=max_t(int, a, b)
 
-#define SUPBOUND(a,b) (a)=minimum((a),(b));
+#define SUPBOUND(a,b) (a)=min_t(int, a, b)
 
 /*
  * Bottom half floppy driver.
@@ -2556,12 +2540,12 @@ static void copy_buffer(int ssize, int m
 	int size, i;
 
 	max_sector = transfer_size(ssize,
-				   minimum(max_sector, max_sector_2),
+				   min(max_sector, max_sector_2),
 				   current_req->nr_sectors);
 
 	if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE &&
 	    buffer_max > fsector_t + current_req->nr_sectors)
-		current_count_sectors = minimum(buffer_max - fsector_t,
+		current_count_sectors = min_t(int, buffer_max - fsector_t,
 						current_req->nr_sectors);
 
 	remaining = current_count_sectors << 9;
@@ -2580,7 +2564,7 @@ static void copy_buffer(int ssize, int m
 	}
 #endif
 
-	buffer_max = maximum(max_sector, buffer_max);
+	buffer_max = max(max_sector, buffer_max);
 
 	dma_buffer = floppy_track_buffer + ((fsector_t - buffer_min) << 9);
 
@@ -2733,7 +2717,7 @@ static int make_raw_rw_request(void)
 		max_sector = 2 * _floppy->sect / 3;
 		if (fsector_t >= max_sector) {
 			current_count_sectors =
-			    minimum(_floppy->sect - fsector_t,
+			    min_t(int, _floppy->sect - fsector_t,
 				    current_req->nr_sectors);
 			return 1;
 		}
--
~Randy

       reply	other threads:[~2004-04-19  2:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040418194357.4cd02a06.rddunlap@osdl.org>
2004-04-19  2:51 ` Randy.Dunlap [this message]
2004-04-19 12:14   ` Bartlomiej Zolnierkiewicz
2004-04-19 15:51     ` Randy.Dunlap
2004-04-19 16:59       ` Bartlomiej Zolnierkiewicz
2004-04-19 17:05         ` Christoph Hellwig
2004-04-19 18:05           ` Randy.Dunlap
2004-04-19 19:06             ` Bartlomiej Zolnierkiewicz
2004-04-19 17:09         ` Randy.Dunlap
     [not found] ` <20040418194813.629e75bd.randy.dunlap@verizon.net>
2004-04-19  2:51   ` [PATCH] floppy98.c: use C99 struct initializers Randy.Dunlap

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=20040418195131.7133cb0f.rddunlap@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zwane@linuxpower.ca \
    /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

all inboxes | Powered by JetHome®