Commit 0b15a140 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] use kernel min/max in IDE code (1/2)

From: Randy Dunlap <rddunlap@osdl.org>
From: Michael Veeck <michael.veeck@gmx.net>

ide-cd.h: remove unnecessary MIN() macro
ide-cd.c: change MIN() calls to use kernel.h calls
ide-tape.c: use min_t()/max_t() instead of min()/max()
parent d550231d
......@@ -965,7 +965,7 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, unsigned long sector,
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);
......@@ -1114,7 +1114,7 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
/* 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. */
......@@ -1144,7 +1144,7 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
/* 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
......@@ -1860,7 +1860,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
/*
* 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);
......
......@@ -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
......
......@@ -4698,7 +4698,7 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor)
* 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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment