Commit 9d8bbc62 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

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

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

Removes unnecessary IDE_MIN()/IDE_MAX() macros
and changes calls to use kernel.h macros instead.
parent 0b15a140
......@@ -741,7 +741,7 @@ static inline ide_drive_t *choose_drive (ide_hwgroup_t *hwgroup)
&& 0 < (signed long)(WAKEUP(drive) - (jiffies - best->service_time))
&& 0 < (signed long)((jiffies + t) - WAKEUP(drive)))
{
ide_stall_queue(best, IDE_MIN(t, 10 * WAIT_MIN_SLEEP));
ide_stall_queue(best, min_t(long, t, 10 * WAIT_MIN_SLEEP));
goto repeat;
}
} while ((drive = drive->next) != best);
......
......@@ -508,8 +508,8 @@ int proc_ide_write_settings
}
if (*p != ':')
goto parse_error;
len = IDE_MIN(p - start, MAX_LEN);
strncpy(name, start, IDE_MIN(len, MAX_LEN));
len = min(p - start, MAX_LEN);
strncpy(name, start, min(len, MAX_LEN));
name[len] = 0;
if (n > 0) {
......
......@@ -262,7 +262,7 @@ static void qd6580_tune_drive (ide_drive_t *drive, u8 pio)
if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) {
pio = ide_get_best_pio_mode(drive, pio, 255, &d);
pio = IDE_MIN(pio,4);
pio = min_t(u8, pio, 4);
switch (pio) {
case 0: break;
......
......@@ -200,7 +200,7 @@ static void program_drive_counts (ide_drive_t *drive, int setup_count, int activ
*/
if (channel) {
drive->drive_data = setup_count;
setup_count = IDE_MAX(drives[0].drive_data,
setup_count = max(drives[0].drive_data,
drives[1].drive_data);
cmdprintk("Secondary interface, setup_count = %d\n",
setup_count);
......
......@@ -375,7 +375,7 @@ static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio)
return;
}
via_set_drive(drive, XFER_PIO_0 + MIN(pio, 5));
via_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5));
}
/**
......
......@@ -146,7 +146,7 @@ static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigne
idescsi_discard_data (drive, bcount);
return;
}
count = IDE_MIN (pc->sg->length - pc->b_count, bcount);
count = min(pc->sg->length - pc->b_count, bcount);
buf = page_address(pc->sg->page) + pc->sg->offset;
atapi_input_bytes (drive, buf + pc->b_count, count);
bcount -= count; pc->b_count += count;
......@@ -168,7 +168,7 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign
idescsi_output_zeros (drive, bcount);
return;
}
count = IDE_MIN (pc->sg->length - pc->b_count, bcount);
count = min(pc->sg->length - pc->b_count, bcount);
buf = page_address(pc->sg->page) + pc->sg->offset;
atapi_output_bytes (drive, buf + pc->b_count, count);
bcount -= count; pc->b_count += count;
......@@ -396,7 +396,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
if (!test_bit(PC_WRITING, &pc->flags) && pc->actually_transferred && pc->actually_transferred <= 1024 && pc->buffer) {
printk(", rst = ");
scsi_buf = pc->scsi_cmd->request_buffer;
hexdump(scsi_buf, IDE_MIN(16, pc->scsi_cmd->request_bufflen));
hexdump(scsi_buf, min_t(unsigned, 16, pc->scsi_cmd->request_bufflen));
} else printk("\n");
}
}
......@@ -413,7 +413,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
static inline unsigned long get_timeout(idescsi_pc_t *pc)
{
return IDE_MAX(WAIT_CMD, pc->timeout - jiffies);
return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies);
}
static int idescsi_expiry(ide_drive_t *drive)
......@@ -580,7 +580,7 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
scsi->pc=pc; /* Set the current packet command */
pc->actually_transferred=0; /* We haven't transferred any data yet */
pc->current_position=pc->buffer;
bcount.all = IDE_MIN(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */
bcount.all = min(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */
feature.all = 0;
if (drive->using_dma && rq->bio) {
......
......@@ -215,8 +215,6 @@ typedef unsigned char byte; /* used everywhere */
#define SECTOR_SIZE 512
#define SECTOR_WORDS (SECTOR_SIZE / 4) /* number of 32bit words per sector */
#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
#define IDE_MIN(a,b) ((a)<(b) ? (a):(b))
#define IDE_MAX(a,b) ((a)>(b) ? (a):(b))
/*
* Timeouts for various operations:
......
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