ChangeSet 1.956.3.4, 2002/12/29 23:59:37-08:00, greg@kroah.com TTY: replace MIN and MAX macro usages with min() and max() diff -Nru a/drivers/char/n_tty.c b/drivers/char/n_tty.c --- a/drivers/char/n_tty.c Mon Dec 30 01:04:37 2002 +++ b/drivers/char/n_tty.c Mon Dec 30 01:04:37 2002 @@ -48,10 +48,6 @@ #define IS_CONSOLE_DEV(dev) (kdev_val(dev) == __mkdev(TTY_MAJOR,0)) #define IS_SYSCONS_DEV(dev) (kdev_val(dev) == __mkdev(TTYAUX_MAJOR,1)) -#ifndef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - /* number of characters left in xmit buffer before select has we have room */ #define WAKEUP_CHARS 256 @@ -725,16 +721,18 @@ if (tty->real_raw) { spin_lock_irqsave(&tty->read_lock, cpuflags); - i = MIN(count, MIN(N_TTY_BUF_SIZE - tty->read_cnt, - N_TTY_BUF_SIZE - tty->read_head)); + i = min(N_TTY_BUF_SIZE - tty->read_cnt, + N_TTY_BUF_SIZE - tty->read_head); + i = min(count, i); memcpy(tty->read_buf + tty->read_head, cp, i); tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); tty->read_cnt += i; cp += i; count -= i; - i = MIN(count, MIN(N_TTY_BUF_SIZE - tty->read_cnt, - N_TTY_BUF_SIZE - tty->read_head)); + i = min(N_TTY_BUF_SIZE - tty->read_cnt, + N_TTY_BUF_SIZE - tty->read_head); + i = min(count, i); memcpy(tty->read_buf + tty->read_head, cp, i); tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); tty->read_cnt += i; @@ -915,7 +913,8 @@ retval = 0; spin_lock_irqsave(&tty->read_lock, flags); - n = MIN(*nr, MIN(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail)); + n = min(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail); + n = min((ssize_t)*nr, n); spin_unlock_irqrestore(&tty->read_lock, flags); if (n) { mb(); diff -Nru a/drivers/char/pty.c b/drivers/char/pty.c --- a/drivers/char/pty.c Mon Dec 30 01:04:37 2002 +++ b/drivers/char/pty.c Mon Dec 30 01:04:37 2002 @@ -64,8 +64,6 @@ static struct pty_struct ptm_state[UNIX98_NR_MAJORS][NR_PTYS]; #endif -#define MIN(a,b) ((a) < (b) ? (a) : (b)) - static void pty_close(struct tty_struct * tty, struct file * filp) { if (!tty) @@ -156,7 +154,7 @@ n = count; if (!n) break; - n = MIN(n, PTY_BUF_SIZE); + n = min(n, PTY_BUF_SIZE); n -= copy_from_user(temp_buffer, buf, n); if (!n) { if (!c) diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c --- a/drivers/char/tty_io.c Mon Dec 30 01:04:37 2002 +++ b/drivers/char/tty_io.c Mon Dec 30 01:04:37 2002 @@ -159,13 +159,6 @@ extern void tx3912_rs_init(void); extern void hvc_console_init(void); -#ifndef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif -#ifndef MAX -#define MAX(a,b) ((a) < (b) ? (b) : (a)) -#endif - static struct tty_struct *alloc_tty_struct(void) { struct tty_struct *tty; @@ -714,7 +707,7 @@ unlock_kernel(); } else { for (;;) { - unsigned long size = MAX(PAGE_SIZE*2,16384); + unsigned long size = max((unsigned long)PAGE_SIZE*2, 16384UL); if (size > count) size = count; lock_kernel();