[PATCH] floppy98.c: use kernel min/max

From: Randy.Dunlap
Date: Sun Apr 18 2004 - 21:53:52 EST



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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/