Commit a3a2b130 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

TTY: replace MIN and MAX macro usages with min() and max()

parent e29145f4
......@@ -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 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
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 @@ static inline int copy_from_read_buf(struct tty_struct *tty,
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();
......
......@@ -64,8 +64,6 @@ static struct termios *pts_termios_locked[UNIX98_NR_MAJORS][NR_PTYS];
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 @@ static int pty_write(struct tty_struct * tty, int from_user,
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)
......
......@@ -159,13 +159,6 @@ extern void tx3912_console_init(void);
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 @@ static inline ssize_t do_tty_write(
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();
......
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