Skip to contentSkip to conversation

drivers/ide/ MIN/MAX removal

PATCH New Michael Veeck 1 participant 1 message Feb 26, 2004 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/ide/ MIN/MAX removal

Patch (against 2.6.3) removes unnecessary min/max macros and changes calls to use kernel.h macros instead.

Regards
Michael

drivers/ide/ide-cd.c +4 -4
diff -Nau linux-2.6.3.org/drivers/ide/ide-cd.c linux-2.6.3.test/drivers/ide/ide-cd.c
@@ -1012,7 +1012,7 @@
 	struct cdrom_info *info = drive->driver_data;
 
 	/* Number of sectors to read into the buffer. */
-	int sectors_to_buffer = MIN (sectors_to_transfer,
+	int sectors_to_buffer = min_t(int, sectors_to_transfer,
 				     (SECTOR_BUFFER_SIZE >> SECTOR_BITS) -
 				       info->nsectors_buffered);
 
@@ -1161,7 +1161,7 @@
 
 	/* First, figure out if we need to bit-bucket
 	   any of the leading sectors. */
-	nskip = MIN((int)(rq->current_nr_sectors - bio_cur_sectors(rq->bio)), sectors_to_transfer);
+	nskip = min_t(int, (rq->current_nr_sectors - bio_cur_sectors(rq->bio)), sectors_to_transfer);
 
 	while (nskip > 0) {
 		/* We need to throw away a sector. */
@@ -1191,7 +1191,7 @@
 			/* Transfer data to the buffers.
 			   Figure out how many sectors we can transfer
 			   to the current buffer. */
-			this_transfer = MIN (sectors_to_transfer,
+			this_transfer = min_t(int, sectors_to_transfer,
 					     rq->current_nr_sectors);
 
 			/* Read this_transfer sectors
@@ -1907,7 +1907,7 @@
 		/*
 		 * Figure out how many sectors we can transfer
 		 */
-		this_transfer = MIN(sectors_to_transfer,rq->current_nr_sectors);
+		this_transfer = min_t(int, sectors_to_transfer,rq->current_nr_sectors);
 
 		while (this_transfer > 0) {
 			HWIF(drive)->atapi_output_bytes(drive, rq->buffer, SECTOR_SIZE);
drivers/ide/ide-cd.h +0 -2
diff -Nau linux-2.6.3.org/drivers/ide/ide-cd.h linux-2.6.3.test/drivers/ide/ide-cd.h
@@ -54,8 +54,6 @@
 
 #define BLOCKS_PER_FRAME	(CD_FRAMESIZE / BLOCK_SIZE)
 
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
 /* special command codes for strategy routine. */
 #define PACKET_COMMAND        4315
 #define REQUEST_SENSE_COMMAND 4316
drivers/ide/ide-proc.c +0 -4
diff -Nau linux-2.6.3.org/drivers/ide/ide-proc.c linux-2.6.3.test/drivers/ide/ide-proc.c
@@ -74,10 +74,6 @@
 
 #include <asm/io.h>
 
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
 static int ide_getxdigit(char c)
 {
 	int digit;
drivers/ide/ide-tape.c +1 -1
diff -Nau linux-2.6.3.org/drivers/ide/ide-tape.c linux-2.6.3.test/drivers/ide/ide-tape.c
@@ -6298,7 +6298,7 @@
 	 *	Ensure that the number we got makes sense; limit
 	 *	it within IDETAPE_DSC_RW_MIN and IDETAPE_DSC_RW_MAX.
 	 */
-	tape->best_dsc_rw_frequency = max((unsigned long) min(t, (unsigned long) IDETAPE_DSC_RW_MAX), (unsigned long) IDETAPE_DSC_RW_MIN);
+	tape->best_dsc_rw_frequency = max_t(unsigned long, min_t(unsigned long, t, IDETAPE_DSC_RW_MAX), IDETAPE_DSC_RW_MIN);
 	printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, "
 		"%dkB pipeline, %lums tDSC%s\n",
 		drive->name, tape->name, tape->capabilities.speed,

Common subdirectories: linux-2.6.3.org/drivers/ide/legacy and linux-2.6.3.test/drivers/ide/legacy Common subdirectories: linux-2.6.3.org/drivers/ide/pci and linux-2.6.3.test/drivers/ide/pci Common subdirectories: linux-2.6.3.org/drivers/ide/ppc and linux-2.6.3.test/drivers/ide/ppc

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors